diff --git a/src-tauri/nsis/installer.nsi b/src-tauri/nsis/installer.nsi deleted file mode 100644 index 2ff485f9..00000000 --- a/src-tauri/nsis/installer.nsi +++ /dev/null @@ -1,257 +0,0 @@ -!include MUI2.nsh -!include nsDialogs.nsh -!include LogicLib.nsh -!include FileFunc.nsh - -!define MANUFACTURER "vrct" -!define PRODUCTNAME "VRCT" -!define VERSION "0.0.0" -!define PRODUCT_VERSION "1.0.0.0" -!define SHORTDESCRIPTION "Communication tool with translation & transcription for VRChat" -!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}" -!define COPYRIGHT "Copyright m's software" -!define MAINBINARYNAME "VRCT" -!define ESTIMATEDSIZE "0x0b304b" - -VIProductVersion "${PRODUCT_VERSION}" -VIFileVersion "${VERSION}" -VIAddVersionKey "ProductName" "${PRODUCTNAME}" -VIAddVersionKey "FileDescription" "${SHORTDESCRIPTION}" -VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" -VIAddVersionKey "FileVersion" "${VERSION}" -VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" - -!define MUI_ICON "icons/icon.ico" -!define MUI_UNICON "icons/icon.ico" - -Unicode true -; アプリケーション名 -Name "VRCT" -; 作成されるインストーラ -OutFile "VRCT_Setup.exe" - -RequestExecutionLevel admin -ShowInstDetails show - -; 圧縮メソッド -SetCompressor lzma -; インストールされるディレクトリ -InstallDir "$LOCALAPPDATA\VRCT" -; XPマニフェスト -XPStyle on -; ページ -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "..\LICENSE" -Page custom OptionPage1 OptionPageLeave1 -Page custom OptionPage2 OptionPageLeave2 -!insertmacro MUI_PAGE_INSTFILES -!insertmacro MUI_PAGE_FINISH -; アンインストーラ ページ -!insertmacro MUI_UNPAGE_WELCOME -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH -; 日本語UI -!insertmacro MUI_LANGUAGE "Japanese" -; 引数取得マクロ -!insertmacro GetParameters -!insertmacro GetOptions -; インターフェース 設定 -!define MUI_ABORTWARNING -; 変数 -Var Checkbox_InstallShortcut -Var Dialog_Options -Var InstallShortcut -Var DropList_Language -Var Set_Langage -Var DownloadWeight -Var RadioButton_Download -Var RadioButton_NotDownload -Var Label_Translation_subtitle_1 -Var Label_Translation_subtitle_2 -Var subFont - -; 初期化時コールバック -Function .onInit - ; オプション値を初期化します。 - StrCpy $InstallShortcut ${BST_CHECKED} - StrCpy $DropList_Language "English" - StrCpy $DownloadWeight ${BST_CHECKED} -FunctionEnd - -; オプション ページ 1 -Function OptionPage1 - !insertmacro MUI_HEADER_TEXT "オプション (Options)" "オプションを設定してください。 (Please set the options.)" - ; nsDialogsを作成します。 - nsDialogs::Create 1018 - ; 作成されたnsDialogsを変数に代入します。 - Pop $Dialog_Options - - ${If} $Dialog_Options == error - ; ダイアログの作成に失敗した場合には終了します。 - Abort - ${EndIf} - - ${NSD_CreateCheckbox} 0 0u 100% 12u "デスクトップにショートカットを作成 (Install shortcut on desktop)" - Pop $Checkbox_InstallShortcut - - ${If} $InstallShortcut == ${BST_CHECKED} - ; チェックが入力済の場合、チェックボックスにチェックを入れます。 - ${NSD_Check} $Checkbox_InstallShortcut - ${EndIf} - nsDialogs::Show -FunctionEnd - -; オプション ページ 1 退出コールバック -Function OptionPageLeave1 - ${NSD_GetState} $Checkbox_InstallShortcut $InstallShortcut -FunctionEnd - -; オプション ページ 2 -Function OptionPage2 - CreateFont $subFont "MS UI Gothic" "8" "400" - - !insertmacro MUI_HEADER_TEXT "初期設定 (Initial Settings)" "後から変更可能です。 (Changeable later.)" - ; nsDialogsを作成します。 - nsDialogs::Create 1018 - ; 作成されたnsDialogsを変数に代入します。 - Pop $Dialog_Options - - ${If} $Dialog_Options == error - ; ダイアログの作成に失敗した場合には終了します。 - Abort - ${EndIf} - - ; ComboBoxを作成します。 - ${NSD_CreateLabel} 0 20u 30% 12u "UIの言語 (Language)" - - ${NSD_CreateDropList} 33% 20u 33% 12u "" - Pop $DropList_Language - - # ラジオボタンを追加しWEIGHTをDownloadするか選択する - ${NSD_CreateLabel} 0 70u 30% 12u "翻訳機能 (Translation)" - ${NSD_CreateLabel} 0 83u 30% 8u "言語モデルをダウンロード" - Pop $Label_Translation_subtitle_1 - SendMessage $Label_Translation_subtitle_1 ${WM_SETFONT} $subFont 0 - SetCtlColors $Label_Translation_subtitle_1 0x696969 0xF0F0F0 - ${NSD_CreateLabel} 0 92u 30% 8u "(Download language model)" - Pop $Label_Translation_subtitle_2 - SendMessage $Label_Translation_subtitle_2 ${WM_SETFONT} $subFont 0 - SetCtlColors $Label_Translation_subtitle_2 0x696969 0xF0F0F0 - - ${NSD_CreateRadioButton} 33% 70u 33% 12u "使用する (Use)" - Pop $RadioButton_Download - ${NSD_CreateRadioButton} 66% 70u 33% 12u "使用しない (Don't use)" - Pop $RadioButton_NotDownload - - ${NSD_CB_AddString} $DropList_Language "English" - ${NSD_CB_AddString} $DropList_Language "日本語" - ${NSD_CB_AddString} $DropList_Language "한국어" - - ${NSD_CB_SelectString} $DropList_Language "English" - - ${If} $DownloadWeight == ${BST_CHECKED} - ; チェックが入力済の場合、チェックボックスにチェックを入れます。 - ${NSD_Check} $RadioButton_Download - ${EndIf} - nsDialogs::Show -FunctionEnd - -; オプション ページ 2 退出コールバック -Function OptionPageLeave2 - ${NSD_GetText} $DropList_Language $DropList_Language - ${NSD_GetState} $RadioButton_Download $DownloadWeight -FunctionEnd - -; デフォルト セクション -Section - ; If VRCT is already running, display a warning message and exit - StrCpy $1 "VRCT.exe" - nsProcess::_FindProcess "$1" - Pop $R1 - ${If} $R1 = 0 - nsExec::ExecToStack "taskkill /IM VRCT.exe" - ${EndIf} - - ; ; ディレクトリを削除 - ; RMDir /r "$INSTDIR" - ; ; スタート メニューから削除 - ; Delete "$SMPROGRAMS\VRCT\VRCT.lnk" - ; RMDir "$SMPROGRAMS\VRCT" - ; ; デスクトップ ショートカットを削除 - ; Delete "$DESKTOP\VRCT.lnk" - ; ; レジストリ キーを削除 - ; DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" - - ; 出力先を指定します。 - SetOutPath "$INSTDIR" - ; インストールされるファイル - File /a "target\release\VRCT.exe" - File /a "target\release\backend.exe" - File /r "target\release\_internal\" - - ; アンインストーラを出力 - WriteUninstaller "$INSTDIR\Uninstall.exe" - - ${If} $InstallShortcut == ${BST_CHECKED} - ; デスクトップにショートカットを作成 - CreateShortCut "$DESKTOP\VRCT.lnk" "$INSTDIR\VRCT.exe" - ${EndIf} - - ; ComboBoxの選択値から言語を判定しconfig.jsonを$INSTDIRに作成 - ${If} $DropList_Language == "English" - StrCpy $Set_Langage "en" - ${ElseIf} $DropList_Language == "日本語" - StrCpy $Set_Langage "ja" - ${ElseIf} $DropList_Language == "한국어" - StrCpy $Set_Langage "ko" - ${EndIf} - - ${If} $DownloadWeight == 1 - StrCpy $DownloadWeight "true" - ${Else} - StrCpy $DownloadWeight "false" - ${EndIf} - - StrCpy $1 '{"UI_LANGUAGE": "$Set_Langage", "USE_TRANSLATION_FEATURE": $DownloadWeight}' - FileOpen $0 "$INSTDIR\config.json" w - FileWrite $0 $1 - FileClose $0 - - ; スタート メニューにショートカットを登録 - CreateDirectory "$SMPROGRAMS\VRCT" - SetOutPath "$INSTDIR" - CreateShortcut "$SMPROGRAMS\VRCT\VRCT.lnk" "$INSTDIR\VRCT.exe" "" - ; レジストリに登録 - WriteRegStr SHCTX "${UNINSTKEY}" "DisplayName" "${PRODUCTNAME}" - WriteRegStr SHCTX "${UNINSTKEY}" "DisplayIcon" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\"" - WriteRegStr SHCTX "${UNINSTKEY}" "DisplayVersion" "${VERSION}" - WriteRegStr SHCTX "${UNINSTKEY}" "Publisher" "${MANUFACTURER}" - WriteRegStr SHCTX "${UNINSTKEY}" "InstallLocation" "$\"$INSTDIR$\"" - WriteRegStr SHCTX "${UNINSTKEY}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" - WriteRegDWORD SHCTX "${UNINSTKEY}" "NoModify" "1" - WriteRegDWORD SHCTX "${UNINSTKEY}" "NoRepair" "1" - WriteRegDWORD SHCTX "${UNINSTKEY}" "EstimatedSize" "${ESTIMATEDSIZE}" -SectionEnd - -; アンインストーラ -Section Uninstall - ; If VRCT is already running, display a warning message and exit - StrCpy $1 "VRCT.exe" - nsProcess::_FindProcess "$1" - Pop $R1 - ${If} $R1 = 0 - MessageBox MB_OK|MB_ICONEXCLAMATION "VRCT is still running. Cannot uninstall this software.$\nPlease close VRCT and try again." /SD IDOK - Abort - ${EndIf} - ; ディレクトリを削除 - RMDir /r "$INSTDIR" - RMDir /r "$LOCALAPPDATA\VRCT" - ; スタート メニューから削除 - Delete "$SMPROGRAMS\VRCT\VRCT.lnk" - RMDir "$SMPROGRAMS\VRCT" - ; デスクトップ ショートカットを削除 - Delete "$DESKTOP\VRCT.lnk" - ; レジストリ キーを削除 - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\VRCT" -SectionEnd \ No newline at end of file diff --git a/src-tauri/nsis/template.nsi b/src-tauri/nsis/template.nsi index 783f23d1..72b27b8f 100644 --- a/src-tauri/nsis/template.nsi +++ b/src-tauri/nsis/template.nsi @@ -128,8 +128,178 @@ VIAddVersionKey "ProductVersion" "${VERSION}" !insertmacro MULTIUSER_PAGE_INSTALLMODE !endif +; 4-1. Choose language page +Var DropListLanguages +Var SelectedLangage +Var DialogChooseLanguage +Page custom PageChooseLanguage PageLeaveChooseLanguage +Function PageChooseLanguage + !insertmacro MUI_HEADER_TEXT "Initial Settings" "Set the language of the VRCT UI (can be changed later)." + nsDialogs::Create 1018 + Pop $DialogChooseLanguage -; 4. Custom page to ask user if he wants to reinstall/uninstall + ${If} $DialogChooseLanguage == error + Abort + ${EndIf} + + ${NSD_CreateLabel} 0 21u 30% 12u "UI Language" + ${NSD_CreateDropList} 33% 20u 33% 12u "" + Pop $DropListLanguages + ${NSD_CB_AddString} $DropListLanguages "English" + ${NSD_CB_AddString} $DropListLanguages "日本語" + ${NSD_CB_AddString} $DropListLanguages "한국어" + ${NSD_CB_AddString} $DropListLanguages "繁體中文" + ${NSD_CB_SelectString} $DropListLanguages "English" + StrCpy $SelectedLangage "en" + nsDialogs::Show +FunctionEnd + +Function PageLeaveChooseLanguage + ${NSD_GetText} $DropListLanguages $0 + ${If} "English" == $0 + StrCpy $SelectedLangage "en" + ${ElseIf} "日本語" == $0 + StrCpy $SelectedLangage "ja" + ${ElseIf} "한국어" == $0 + StrCpy $SelectedLangage "ko" + ${ElseIf} "繁體中文" == $0 + StrCpy $SelectedLangage "zh-Hant" + ${EndIf} +FunctionEnd + +; 4-2. Page Download Translate Model Weight +Var CheckboxUseTranslate +Var DropListCTranslate2DownloadWeightType +Var SelectedCTranslate2DownloadWeightType +Var DialogTranslate +Page custom PageTranslate PageLeaveTranslate +Function PageTranslate + !insertmacro MUI_HEADER_TEXT "Initial Settings" "Set to use the translation function (can be changed later)." + nsDialogs::Create 1018 + Pop $DialogTranslate + + ${If} $DialogTranslate == error + Abort + ${EndIf} + + ${NSD_CreateLabel} 0 21u 33% 12u "Enable Translation" + ${NSD_CreateCheckBox} 33% 20u 33% 12u "" + Pop $CheckboxUseTranslate + ${NSD_CreateLabel} 0 52u 33% 12u "Select AI Model Size" + ${NSD_CreateDropList} 33% 50u 40% 12u "" + Pop $DropListCTranslate2DownloadWeightType + ${NSD_CB_AddString} $DropListCTranslate2DownloadWeightType "Basic model(418MB)" + ${NSD_CB_AddString} $DropListCTranslate2DownloadWeightType "High accuracy model(1.3GB)" + ${NSD_CB_SelectString} $DropListCTranslate2DownloadWeightType "Basic model(418MB)" + StrCpy $SelectedCTranslate2DownloadWeightType "Small" + EnableWindow $DropListCTranslate2DownloadWeightType 0 + ${NSD_OnClick} $CheckboxUseTranslate OnCheckboxCTranslate2DownloadWeightClick + nsDialogs::Show +FunctionEnd + +Function PageLeaveTranslate + ${NSD_GetState} $CheckboxUseTranslate $0 + ${If} $0 == 1 + StrCpy $CheckboxUseTranslate "true" + ${Else} + StrCpy $CheckboxUseTranslate "false" + ${EndIf} + + ${NSD_GetText} $CheckboxCTranslate2DownloadWeight $0 + ${If} "Basic model(418MB)" == $0 + StrCpy $SelectedCTranslate2DownloadWeightType "Small" + ${ElseIf} "High accuracy model(1.3GB)" == $0 + StrCpy $SelectedCTranslate2DownloadWeightType "Large" + ${EndIf} +FunctionEnd + +Function OnCheckboxCTranslate2DownloadWeightClick + Pop $CheckboxUseTranslate + ${NSD_GetState} $CheckboxUseTranslate $0 + ${If} $0 == 1 + EnableWindow $DropListCTranslate2DownloadWeightType 1 + ${Else} + EnableWindow $DropListCTranslate2DownloadWeightType 0 + ${EndIf} +FunctionEnd + +; 4-3. Page Download Transcript Model Weight +Var DropLListTranscriptEngines +Var SelectedTranscriptEngine +Var DropListWhisperDownloadWeightType +Var SelectedWhisperDownloadWeightType +Var DialogTranscript +Page custom PageTranscript PageLeaveTranscript +Function PageTranscript + !insertmacro MUI_HEADER_TEXT "Initial Settings" "Set to use the transcript engine (can be changed later)." + nsDialogs::Create 1018 + Pop $DialogTranscript + + ${If} $DialogTranscript == error + Abort + ${EndIf} + + ${NSD_CreateLabel} 0 21u 33% 12u "Select Transcript Engine" + ${NSD_CreateDropList} 33% 20u 33% 12u "" + Pop $DropLListTranscriptEngines + ${NSD_CB_AddString} $DropLListTranscriptEngines "Google" + ${NSD_CB_AddString} $DropLListTranscriptEngines "Wishper(USE CPU)" + ${NSD_CB_SelectString} $DropLListTranscriptEngines "Google" + ${NSD_CreateLabel} 0 52u 33% 12u "Select AI Model Size" + ${NSD_CreateDropList} 33% 50u 40% 12u "" + Pop $DropListWhisperDownloadWeightType + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "tiny model(74.5MB)" + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "base model(141MB)" + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "small model(463MB)" + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "medium model(1.42GB)" + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "large-v1 model(2.87GB)" + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "large-v2 model(2.87GB)" + ${NSD_CB_AddString} $DropListWhisperDownloadWeightType "large-v3 model(2.87GB)" + ${NSD_CB_SelectString} $DropListWhisperDownloadWeightType "base model(141MB)" + + StrCpy $SelectedWhisperDownloadWeightType "base" + EnableWindow $DropListWhisperDownloadWeightType 0 + ${NSD_OnChange} $DropLListTranscriptEngines OnDropListWishperDownloadWeightClick + nsDialogs::Show +FunctionEnd + +Function PageLeaveTranscript + ${NSD_GetText} $DropLListTranscriptEngines $0 + ${If} $0 == "Google" + StrCpy $SelectedTranscriptEngine "google" + ${Else} + StrCpy $SelectedTranscriptEngine "wishper" + ${EndIf} + ${NSD_GetText} $DropListWhisperDownloadWeightType $0 + ${If} "tiny model(74.5MB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "tiny" + ${ElseIf} "base model(141MB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "base" + ${ElseIf} "small model(463MB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "small" + ${ElseIf} "medium model(1.42GB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "medium" + ${ElseIf} "large-v1 model(2.87GB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "large-v1" + ${ElseIf} "large-v2 model(2.87GB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "large-v2" + ${ElseIf} "large-v3 model(2.87GB)" == $0 + StrCpy $SelectedWhisperDownloadWeightType "large-v3" + ${EndIf} +FunctionEnd + +Function OnDropListWishperDownloadWeightClick + ${NSD_GetText} $DropLListTranscriptEngines $0 + ${If} $0 == "Wishper(USE CPU)" + EnableWindow $DropListWhisperDownloadWeightType 1 + ${Else} + EnableWindow $DropListWhisperDownloadWeightType 0 + ${EndIf} +FunctionEnd + +!insertmacro MUI_PAGE_COMPONENTS + +; 4-4. Custom page to ask user if he wants to reinstall/uninstall ; only if a previous installtion was detected Var ReinstallPageCheck Page custom PageReinstall PageLeaveReinstall @@ -309,6 +479,8 @@ Var AppStartMenuFolder ; 7. Installation page !insertmacro MUI_PAGE_INSTFILES + + ; 8. Finish page ; ; Don't auto jump to finish page after installation page, @@ -619,6 +791,11 @@ Function .onInstSuccess ${GetOptions} $CMDLINE "/ARGS" $R0 nsis_tauri_utils::RunAsUser "$INSTDIR\${MAINBINARYNAME}.exe" "$R0" run_done: + + StrCpy $1 '{"UI_LANGUAGE": "$SelectedLangage", "USE_TRANSLATION_FEATURE": $CheckboxUseTranslate, "SELECTED_TRANSCRIPTION_ENGINE": "$SelectedTranscriptEngine", "CTRANSLATE2_WEIGHT_TYPE": "$SelectedCTranslate2DownloadWeightType", "WHISPER_WEIGHT_TYPE": "$SelectedWhisperDownloadWeightType"}' + FileOpen $0 "$INSTDIR\config.json" w + FileWrite $0 $1 + FileClose $0 FunctionEnd Function un.onInit diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e8eaff54..4710e958 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -72,8 +72,8 @@ "nsis": { "template": "nsis/template.nsi", "license": "../LICENSE", - "displayLanguageSelector": true, - "compression": "lzma" + "installMode": "both", + "displayLanguageSelector": true } } }