From fdc420f35b0954a8fb211f0686f5aa420b0fe424 Mon Sep 17 00:00:00 2001 From: Masanobu YOSHIOKA Date: Sun, 7 Nov 2021 11:41:35 +0900 Subject: [PATCH 01/34] =?UTF-8?q?nsis-web=20=E3=82=A4=E3=83=B3=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=83=BC=E3=83=A9=E3=83=BC=E3=81=A7=E3=81=AE=E3=83=80?= =?UTF-8?q?=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=81=AB=E3=82=BF=E3=82=A4=E3=83=A0=E3=82=A2=E3=82=A6=E3=83=88?= =?UTF-8?q?=E6=99=82=E9=96=93=E3=81=AE=E6=8C=87=E5=AE=9A=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=20(#449)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * undo/redoable devoicing (#435) * undo/redoable devoicing * remove unnecessary codes * add timeout options close #448. Co-authored-by: Yosshi999 --- build/installer.nsh | 11 ++++++++--- src/components/AudioDetail.vue | 22 +++++++++++++++++++++- src/components/AudioParameter.vue | 20 +------------------- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/build/installer.nsh b/build/installer.nsh index 08a0edb7bd..88859ae665 100644 --- a/build/installer.nsh +++ b/build/installer.nsh @@ -7,6 +7,11 @@ ; !define DOWNLOAD_BASE_URL "http://127.0.0.1:8080" !define DOWNLOAD_BASE_URL "${APP_PACKAGE_URL}" +; inetc::get で使用するタイムアウト時間(秒) +; https://nsis.sourceforge.io/Inetc_plug-in#Commands +!define CONNECTTIMEOUT "300" +!define RECEIVETIMEOUT "300" + !ifndef BUILD_UNINSTALLER ; インストール後のサイズ @@ -130,7 +135,7 @@ Exch $0 ; $0 Push $1 ; $1 $0 - inetc::get /POPUP "" /CAPTION "$(^Name) セットアップ" /RESUME "追加ファイルのダウンロードに失敗しました。$\r$\n再試行しますか?" "${DOWNLOAD_BASE_URL}/$archiveName.ini" "$0" /END + inetc::get /CONNECTTIMEOUT ${CONNECTTIMEOUT} /RECEIVETIMEOUT ${RECEIVETIMEOUT} /POPUP "" /CAPTION "$(^Name) セットアップ" /RESUME "追加ファイルのダウンロードに失敗しました。$\r$\n再試行しますか?" "${DOWNLOAD_BASE_URL}/$archiveName.ini" "$0" /END Pop $0 ; Stack $1 $0 @@ -222,7 +227,7 @@ verifyPartedFile_finish${UniqueID}: Goto downloadFile_finish ${EndIf} - inetc::get /POPUP "" /CAPTION "$(^Name) セットアップ ($3/$numFiles)" /RESUME "ファイルのダウンロード中にエラーが発生しました。$\r$\n再試行しますか?" "${DOWNLOAD_BASE_URL}/$archiveName.$2" "$4" /END + inetc::get /CONNECTTIMEOUT ${CONNECTTIMEOUT} /RECEIVETIMEOUT ${RECEIVETIMEOUT} /POPUP "" /CAPTION "$(^Name) セットアップ ($3/$numFiles)" /RESUME "ファイルのダウンロード中にエラーが発生しました。$\r$\n再試行しますか?" "${DOWNLOAD_BASE_URL}/$archiveName.$2" "$4" /END Pop $0 ; プロキシーなしでリトライする処理は合理的な理由が見つからないのでひとまずやめる @@ -230,7 +235,7 @@ verifyPartedFile_finish${UniqueID}: ; https://github.com/electron-userland/electron-builder/issues/2049 ; ${If} $0 != "OK" ; ${AndIf} $0 != "Cancelled" - ; inetc::get /NOPROXY /POPUP "" /CAPTION "$(^Name) セットアップ ($3/$numFiles)" /RESUME "ファイルのダウンロード中にエラーが発生しました。$\r$\n再試行しますか?" "${DOWNLOAD_BASE_URL}/$archiveName.$2" "$4" /END + ; inetc::get /CONNECTTIMEOUT ${CONNECTTIMEOUT} /RECEIVETIMEOUT ${RECEIVETIMEOUT} /NOPROXY /POPUP "" /CAPTION "$(^Name) セットアップ ($3/$numFiles)" /RESUME "ファイルのダウンロード中にエラーが発生しました。$\r$\n再試行しますか?" "${DOWNLOAD_BASE_URL}/$archiveName.$2" "$4" /END ; Pop $0 ; ${EndIf} diff --git a/src/components/AudioDetail.vue b/src/components/AudioDetail.vue index 274ff8c392..b8966bbc84 100644 --- a/src/components/AudioDetail.vue +++ b/src/components/AudioDetail.vue @@ -219,6 +219,7 @@ import { onUnmounted, reactive, ref, + watch, } from "vue"; import { useStore } from "@/store"; import { useQuasar } from "quasar"; @@ -306,6 +307,17 @@ export default defineComponent({ const query = computed(() => audioItem.value?.query); const accentPhrases = computed(() => query.value?.accentPhrases); + const lastPitches = ref([]); + watch(accentPhrases, (newPhrases) => { + if (newPhrases) { + lastPitches.value = newPhrases.map((phrase) => + phrase.moras.map((mora) => mora.pitch) + ); + } else { + lastPitches.value = []; + } + }); + const changeAccent = (accentPhraseIndex: number, accent: number) => store.dispatch("COMMAND_CHANGE_ACCENT", { audioKey: props.activeAudioKey, @@ -332,6 +344,9 @@ export default defineComponent({ data: number, type: MoraDataType ) => { + if (type == "pitch") { + lastPitches.value[accentPhraseIndex][moraIndex] = data; + } store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", { audioKey: props.activeAudioKey, accentPhraseIndex, @@ -594,7 +609,12 @@ export default defineComponent({ ) { let data = 0; if (mora.pitch == 0) { - data = 5.5; // don't worry, it will be overwritten by template itself + if (lastPitches.value[accentPhraseIndex][moraIndex] == 0) { + // 元々無声だった場合、適当な値を代入 + data = 5.5; + } else { + data = lastPitches.value[accentPhraseIndex][moraIndex]; + } } changeMoraData(accentPhraseIndex, moraIndex, data, "voicing"); } diff --git a/src/components/AudioParameter.vue b/src/components/AudioParameter.vue index 8ab48e3aed..02de0bd28e 100644 --- a/src/components/AudioParameter.vue +++ b/src/components/AudioParameter.vue @@ -33,7 +33,7 @@ @@ -48,7 +43,7 @@ img { opacity: 0.3 !important; } &.bg-primary:hover > .q-focus-helper { - background-color: white !important; + background-color: var(--color-background) !important; opacity: 0.2 !important; } } @@ -58,7 +53,7 @@ img { background-color: global.$primary; } .bg-primary > .q-ripple > .q-ripple__inner { - background-color: white; + background-color: var(--color-background); } .q-dialog, @@ -127,17 +122,21 @@ img { ::-webkit-scrollbar { width: 15px; height: 15px; - background-color: rgba(global.$primary, 0.2); + background-color: rgba(global.$primary-light-rgb, 0.2); border-radius: 5px; } ::-webkit-scrollbar-thumb { - background-color: rgba(global.$primary, 0.5); + background-color: rgba(global.$primary-light-rgb, 0.5); border-radius: 5px; &:hover { - background-color: rgba(global.$primary, 0.6); + background-color: rgba(global.$primary-light-rgb, 0.6); } &:active { - background-color: rgba(global.$primary, 0.8); + background-color: rgba(global.$primary-light-rgb, 0.8); } } + +::-webkit-scrollbar-corner { + background: var(--color-background); +} diff --git a/src/background.ts b/src/background.ts index 32e4146e14..d475a48f7a 100644 --- a/src/background.ts +++ b/src/background.ts @@ -21,6 +21,7 @@ import { HotkeySetting, MetasJson, SavingSetting, + ThemeConf, StyleInfo, } from "./type/preload"; @@ -66,6 +67,7 @@ const store = new Store<{ savingSetting: SavingSetting; hotkeySettings: HotkeySetting[]; defaultStyleIds: DefaultStyleId[]; + currentTheme: string; }>({ schema: { useGpu: { @@ -198,6 +200,10 @@ const store = new Store<{ }, default: [], }, + currentTheme: { + type: "string", + default: "Default", + }, }, migrations: { ">=0.7.3": (store) => { @@ -360,6 +366,7 @@ async function createWindow() { height: 600, frame: false, minWidth: 320, + show: false, webPreferences: { preload: path.join(__dirname, "preload.js"), nodeIntegration: true, @@ -640,6 +647,25 @@ ipcMainHandle("HOTKEY_SETTINGS", (_, { newData }) => { return store.get("hotkeySettings"); }); +ipcMainHandle("THEME", (_, { newData }) => { + if (newData !== undefined) { + store.set("currentTheme", newData); + return; + } + const dir = path.join(__static, "themes"); + const themes: ThemeConf[] = []; + const files = fs.readdirSync(dir); + files.forEach((file) => { + const theme = JSON.parse(fs.readFileSync(path.join(dir, file)).toString()); + themes.push(theme); + }); + return { currentTheme: store.get("currentTheme"), availableThemes: themes }; +}); + +ipcMainHandle("ON_VUEX_READY", () => { + win.show(); +}); + ipcMainHandle("CHECK_FILE_EXISTS", (_, { file }) => { return fs.existsSync(file); }); diff --git a/src/components/AudioAccent.vue b/src/components/AudioAccent.vue index c5ea311899..9f19482c9f 100644 --- a/src/components/AudioAccent.vue +++ b/src/components/AudioAccent.vue @@ -12,6 +12,7 @@ v-if="accentPhrase.moras.length > 1" snap dense + color="primary-light" :min="previewAccentSlider.qSliderProps.min.value" :max="previewAccentSlider.qSliderProps.max.value" :step="previewAccentSlider.qSliderProps.step.value" @@ -34,7 +35,11 @@ }" > - +