diff --git a/src/components/App.vue b/src/components/App.vue index d14de67080..db73ce923c 100644 --- a/src/components/App.vue +++ b/src/components/App.vue @@ -92,13 +92,13 @@ onMounted(async () => { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); - await store.dispatch("INIT_VUEX"); + await store.actions.INIT_VUEX(); // プロジェクトファイルのパスを取得 const projectFilePath = urlParams.get("projectFilePath"); // どちらのエディタを開くか設定 - await store.dispatch("SET_OPENED_EDITOR", { editor: "talk" }); + await store.actions.SET_OPENED_EDITOR({ editor: "talk" }); // ショートカットキーの設定を登録 const hotkeySettings = store.state.hotkeySettings; @@ -107,11 +107,11 @@ onMounted(async () => { // エンジンの初期化開始 // エンジン情報取得 - await store.dispatch("GET_ENGINE_INFOS"); + await store.actions.GET_ENGINE_INFOS(); // URLパラメータに従ってマルチエンジンをオフにする const isMultiEngineOffMode = urlParams.get("isMultiEngineOffMode") === "true"; - void store.dispatch("SET_IS_MULTI_ENGINE_OFF_MODE", isMultiEngineOffMode); + void store.actions.SET_IS_MULTI_ENGINE_OFF_MODE(isMultiEngineOffMode); // マルチエンジンオフモードのときはデフォルトエンジンだけにする let engineIds: EngineId[]; @@ -126,18 +126,18 @@ onMounted(async () => { } else { engineIds = store.state.engineIds; } - await store.dispatch("LOAD_USER_CHARACTER_ORDER"); - await store.dispatch("POST_ENGINE_START", { + await store.actions.LOAD_USER_CHARACTER_ORDER(); + await store.actions.POST_ENGINE_START({ engineIds, }); // 辞書を同期 - await store.dispatch("SYNC_ALL_USER_DICT"); + await store.actions.SYNC_ALL_USER_DICT(); isEnginesReady.value = true; // エンジン起動後にダイアログを開く - void store.dispatch("SET_DIALOG_OPEN", { + void store.actions.SET_DIALOG_OPEN({ isAcceptRetrieveTelemetryDialogOpen: store.state.acceptRetrieveTelemetry === "Unconfirmed", isAcceptTermsDialogOpen: @@ -147,7 +147,7 @@ onMounted(async () => { // プロジェクトファイルが指定されていればロード if (typeof projectFilePath === "string" && projectFilePath !== "") { - isProjectFileLoaded.value = await store.dispatch("LOAD_PROJECT_FILE", { + isProjectFileLoaded.value = await store.actions.LOAD_PROJECT_FILE({ filePath: projectFilePath, }); } else { diff --git a/src/components/Dialog/Dialog.ts b/src/components/Dialog/Dialog.ts index 1883ee1f8d..e3a7702edc 100644 --- a/src/components/Dialog/Dialog.ts +++ b/src/components/Dialog/Dialog.ts @@ -7,8 +7,8 @@ import { SaveResult, ErrorTypeForSaveAllResultDialog, } from "@/store/type"; -import { Dispatch } from "@/store/vuex"; -import { withProgress } from "@/store/ui"; +import { DotNotationDispatch } from "@/store/vuex"; +import { withProgressDotNotation as withProgress } from "@/store/ui"; type MediaType = "audio" | "text"; @@ -143,21 +143,21 @@ const setCommonDialogCallback = ( export async function generateAndSaveOneAudioWithDialog({ audioKey, - dispatch, + actions, filePath, disableNotifyOnGenerate, }: { audioKey: AudioKey; - dispatch: Dispatch; + actions: DotNotationDispatch; filePath?: string; disableNotifyOnGenerate: boolean; }): Promise { const result: SaveResultObject = await withProgress( - dispatch("GENERATE_AND_SAVE_AUDIO", { + actions.GENERATE_AND_SAVE_AUDIO({ audioKey, filePath, }), - dispatch, + actions, ); if (result.result === "CANCELED") return; @@ -167,35 +167,35 @@ export async function generateAndSaveOneAudioWithDialog({ // 書き出し成功時に通知をする showWriteSuccessNotify({ mediaType: "audio", - dispatch, + actions, }); } else { - showWriteErrorDialog({ mediaType: "audio", result, dispatch }); + showWriteErrorDialog({ mediaType: "audio", result, actions }); } } export async function multiGenerateAndSaveAudioWithDialog({ audioKeys, - dispatch, + actions, dirPath, disableNotifyOnGenerate, }: { audioKeys: AudioKey[]; - dispatch: Dispatch; + actions: DotNotationDispatch; dirPath?: string; disableNotifyOnGenerate: boolean; }): Promise { const result = await withProgress( - dispatch("MULTI_GENERATE_AND_SAVE_AUDIO", { + actions.MULTI_GENERATE_AND_SAVE_AUDIO({ audioKeys, dirPath, callback: (finishedCount) => - dispatch("SET_PROGRESS_FROM_COUNT", { + actions.SET_PROGRESS_FROM_COUNT({ finishedCount, totalCount: audioKeys.length, }), }), - dispatch, + actions, ); if (result == undefined) return; @@ -226,7 +226,7 @@ export async function multiGenerateAndSaveAudioWithDialog({ // 書き出し成功時に通知をする showWriteSuccessNotify({ mediaType: "audio", - dispatch, + actions, }); } @@ -243,21 +243,21 @@ export async function multiGenerateAndSaveAudioWithDialog({ } export async function generateAndConnectAndSaveAudioWithDialog({ - dispatch, + actions, filePath, disableNotifyOnGenerate, }: { - dispatch: Dispatch; + actions: DotNotationDispatch; filePath?: string; disableNotifyOnGenerate: boolean; }): Promise { const result = await withProgress( - dispatch("GENERATE_AND_CONNECT_AND_SAVE_AUDIO", { + actions.GENERATE_AND_CONNECT_AND_SAVE_AUDIO({ filePath, callback: (finishedCount, totalCount) => - dispatch("SET_PROGRESS_FROM_COUNT", { finishedCount, totalCount }), + actions.SET_PROGRESS_FROM_COUNT({ finishedCount, totalCount }), }), - dispatch, + actions, ); if (result == undefined || result.result === "CANCELED") return; @@ -266,23 +266,23 @@ export async function generateAndConnectAndSaveAudioWithDialog({ if (disableNotifyOnGenerate) return; showWriteSuccessNotify({ mediaType: "audio", - dispatch, + actions, }); } else { - showWriteErrorDialog({ mediaType: "audio", result, dispatch }); + showWriteErrorDialog({ mediaType: "audio", result, actions }); } } export async function connectAndExportTextWithDialog({ - dispatch, + actions, filePath, disableNotifyOnGenerate, }: { - dispatch: Dispatch; + actions: DotNotationDispatch; filePath?: string; disableNotifyOnGenerate: boolean; }): Promise { - const result = await dispatch("CONNECT_AND_EXPORT_TEXT", { + const result = await actions.CONNECT_AND_EXPORT_TEXT({ filePath, }); @@ -292,26 +292,26 @@ export async function connectAndExportTextWithDialog({ if (disableNotifyOnGenerate) return; showWriteSuccessNotify({ mediaType: "text", - dispatch, + actions, }); } else { - showWriteErrorDialog({ mediaType: "text", result, dispatch }); + showWriteErrorDialog({ mediaType: "text", result, actions }); } } // 書き出し成功時の通知を表示 const showWriteSuccessNotify = ({ mediaType, - dispatch, + actions, }: { mediaType: MediaType; - dispatch: Dispatch; + actions: DotNotationDispatch; }): void => { const mediaTypeNames: Record = { audio: "音声", text: "テキスト", }; - void dispatch("SHOW_NOTIFY_AND_NOT_SHOW_AGAIN_BUTTON", { + void actions.SHOW_NOTIFY_AND_NOT_SHOW_AGAIN_BUTTON({ message: `${mediaTypeNames[mediaType]}を書き出しました`, tipName: "notifyOnGenerate", }); @@ -321,15 +321,15 @@ const showWriteSuccessNotify = ({ const showWriteErrorDialog = ({ mediaType, result, - dispatch, + actions, }: { mediaType: MediaType; result: SaveResultObject; - dispatch: Dispatch; + actions: DotNotationDispatch; }) => { if (mediaType === "text") { // テキスト書き出し時のエラーを出力 - void dispatch("SHOW_ALERT_DIALOG", { + void actions.SHOW_ALERT_DIALOG({ title: "テキストの書き出しに失敗しました。", message: "書き込みエラーによって失敗しました。空き容量があることや、書き込み権限があることをご確認ください。", @@ -345,7 +345,7 @@ const showWriteErrorDialog = ({ }; // 音声書き出し時のエラーを出力 - void dispatch("SHOW_ALERT_DIALOG", { + void actions.SHOW_ALERT_DIALOG({ title: "書き出しに失敗しました。", message: result.errorMessage ?? defaultErrorMessages[result.result] ?? "", }); @@ -356,9 +356,9 @@ const NOTIFY_TIMEOUT = 7000; export const showNotifyAndNotShowAgainButton = ( { - dispatch, + actions, }: { - dispatch: Dispatch; + actions: DotNotationDispatch; }, options: NotifyAndNotShowAgainButtonOption, ) => { @@ -376,7 +376,7 @@ export const showNotifyAndNotShowAgainButton = ( label: "今後このメッセージを表示しない", textColor: "toast-button-display" + suffix, handler: () => { - void dispatch("SET_CONFIRMED_TIP", { + void actions.SET_CONFIRMED_TIP({ confirmedTip: { [options.tipName]: true, }, diff --git a/src/components/EngineStartupOverlay.vue b/src/components/EngineStartupOverlay.vue index 3dd83c1ad6..a826ebf25d 100644 --- a/src/components/EngineStartupOverlay.vue +++ b/src/components/EngineStartupOverlay.vue @@ -91,7 +91,7 @@ watch(allEngineState, (newEngineState) => { }); const reloadAppWithMultiEngineOffMode = () => { - void store.dispatch("CHECK_EDITED_AND_NOT_SAVE", { + void store.actions.CHECK_EDITED_AND_NOT_SAVE({ closeOrReload: "reload", isMultiEngineOffMode: true, }); diff --git a/src/components/Talk/AccentPhrase.vue b/src/components/Talk/AccentPhrase.vue index 92e2eaa772..070ba90d7f 100644 --- a/src/components/Talk/AccentPhrase.vue +++ b/src/components/Talk/AccentPhrase.vue @@ -245,7 +245,7 @@ const contextMenudata = ref<[MenuItemButton]>([ type: "button", label: "削除", onClick: () => { - void store.dispatch("COMMAND_DELETE_ACCENT_PHRASE", { + void store.actions.COMMAND_DELETE_ACCENT_PHRASE({ audioKey: props.audioKey, accentPhraseIndex: props.index, }); @@ -278,7 +278,7 @@ const handleChangePronounce = (newPronunciation: string) => { popUntilPause = true; } } - void store.dispatch("COMMAND_CHANGE_SINGLE_ACCENT_PHRASE", { + void store.actions.COMMAND_CHANGE_SINGLE_ACCENT_PHRASE({ audioKey: props.audioKey, newPronunciation, accentPhraseIndex: props.index, @@ -345,13 +345,13 @@ const getHoveredText = (mora: Mora, moraIndex: number) => { }; const changeAccent = (accentPhraseIndex: number, accent: number) => - store.dispatch("COMMAND_CHANGE_ACCENT", { + store.actions.COMMAND_CHANGE_ACCENT({ audioKey: props.audioKey, accentPhraseIndex, accent, }); const toggleAccentPhraseSplit = (isPause: boolean, moraIndex?: number) => { - void store.dispatch("COMMAND_CHANGE_ACCENT_PHRASE_SPLIT", { + void store.actions.COMMAND_CHANGE_ACCENT_PHRASE_SPLIT({ audioKey: props.audioKey, accentPhraseIndex: props.index, ...(!isPause ? { isPause, moraIndex: moraIndex as number } : { isPause }), @@ -376,7 +376,7 @@ const changeMoraData = ( if (type == "pitch") { lastPitches.value[moraIndex] = data; } - return store.dispatch("COMMAND_SET_AUDIO_MORA_DATA", { + return store.actions.COMMAND_SET_AUDIO_MORA_DATA({ audioKey: props.audioKey, accentPhraseIndex, moraIndex, @@ -384,7 +384,7 @@ const changeMoraData = ( type, }); } else { - return store.dispatch("COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE", { + return store.actions.COMMAND_SET_AUDIO_MORA_DATA_ACCENT_PHRASE({ audioKey: props.audioKey, accentPhraseIndex, moraIndex, diff --git a/src/components/Talk/AudioCell.vue b/src/components/Talk/AudioCell.vue index 63d957739e..b3575367fc 100644 --- a/src/components/Talk/AudioCell.vue +++ b/src/components/Talk/AudioCell.vue @@ -181,8 +181,8 @@ const isMultiSelectEnabled = computed( ); const selectAndSetActiveAudioKey = () => { - void store.dispatch("SET_ACTIVE_AUDIO_KEY", { audioKey: props.audioKey }); - void store.dispatch("SET_SELECTED_AUDIO_KEYS", { + void store.actions.SET_ACTIVE_AUDIO_KEY({ audioKey: props.audioKey }); + void store.actions.SET_SELECTED_AUDIO_KEYS({ audioKeys: [props.audioKey], }); }; @@ -248,8 +248,8 @@ const onClickWithModifierKey = (event: MouseEvent) => { newSelectedAudioKeys = [...currentSelectedAudioKeys, props.audioKey]; } } - void store.dispatch("SET_ACTIVE_AUDIO_KEY", { audioKey: newActiveAudioKey }); - void store.dispatch("SET_SELECTED_AUDIO_KEYS", { + void store.actions.SET_ACTIVE_AUDIO_KEY({ audioKey: newActiveAudioKey }); + void store.actions.SET_SELECTED_AUDIO_KEYS({ audioKeys: newSelectedAudioKeys, }); }; @@ -273,7 +273,7 @@ const selectedVoice = computed({ }, set(voice: Voice | undefined) { if (voice == undefined) return; - void store.dispatch("COMMAND_MULTI_CHANGE_VOICE", { + void store.actions.COMMAND_MULTI_CHANGE_VOICE({ audioKeys: isMultiSelectEnabled.value ? store.getters.SELECTED_AUDIO_KEYS : [props.audioKey], @@ -312,7 +312,7 @@ const pushAudioTextIfNeeded = async (event?: KeyboardEvent) => { if (event && event.isComposing) return; if (!willRemove.value && isChangeFlag.value && !willFocusOrBlur.value) { isChangeFlag.value = false; - await store.dispatch("COMMAND_CHANGE_AUDIO_TEXT", { + await store.actions.COMMAND_CHANGE_AUDIO_TEXT({ audioKey: props.audioKey, text: audioTextBuffer.value, }); @@ -383,7 +383,7 @@ const putMultilineText = async (texts: string[]) => { await pushAudioTextIfNeeded(); } - const audioKeys = await store.dispatch("COMMAND_PUT_TEXTS", { + const audioKeys = await store.actions.COMMAND_PUT_TEXTS({ texts, voice: audioItem.value.voice, prevAudioKey, @@ -422,7 +422,7 @@ const moveCell = (offset: number) => (e?: KeyboardEvent) => { audioKey: audioKeys.value[index], focusTarget: "root", }); - void store.dispatch("SET_SELECTED_AUDIO_KEYS", { + void store.actions.SET_SELECTED_AUDIO_KEYS({ audioKeys: [ ...selectedAudioKeysBefore, props.audioKey, @@ -491,7 +491,7 @@ const removeCell = async () => { }); } - void store.dispatch("COMMAND_MULTI_REMOVE_AUDIO_ITEM", { + void store.actions.COMMAND_MULTI_REMOVE_AUDIO_ITEM({ audioKeys: audioKeysToDelete, }); } @@ -513,7 +513,7 @@ const selectCharacterAt = (index: number) => { speakerId: speakerUuid, styleId: style.styleId, }; - void store.dispatch("COMMAND_MULTI_CHANGE_VOICE", { + void store.actions.COMMAND_MULTI_CHANGE_VOICE({ audioKeys: isMultiSelectEnabled.value ? store.getters.SELECTED_AUDIO_KEYS : [props.audioKey], @@ -600,7 +600,7 @@ const contextMenudata = ref< onClick: async () => { contextMenu.value?.hide(); isChangeFlag.value = false; - await store.dispatch("COMMAND_CHANGE_DISPLAY_TEXT", { + await store.actions.COMMAND_CHANGE_DISPLAY_TEXT({ audioKey: props.audioKey, text: audioTextBuffer.value, }); diff --git a/src/components/Talk/AudioDetail.vue b/src/components/Talk/AudioDetail.vue index 97d7823873..a32016174b 100644 --- a/src/components/Talk/AudioDetail.vue +++ b/src/components/Talk/AudioDetail.vue @@ -153,7 +153,7 @@ registerHotkeyWithCleanup({ const audioKeys = store.state.experimentalSetting.enableMultiSelect ? store.getters.SELECTED_AUDIO_KEYS : [store.getters.ACTIVE_AUDIO_KEY]; - void store.dispatch("COMMAND_MULTI_RESET_MORA_PITCH_AND_LENGTH", { + void store.actions.COMMAND_MULTI_RESET_MORA_PITCH_AND_LENGTH({ audioKeys, }); } @@ -168,7 +168,7 @@ registerHotkeyWithCleanup({ store.getters.ACTIVE_AUDIO_KEY && store.getters.AUDIO_PLAY_START_POINT != undefined ) { - void store.dispatch("COMMAND_RESET_SELECTED_MORA_PITCH_AND_LENGTH", { + void store.actions.COMMAND_RESET_SELECTED_MORA_PITCH_AND_LENGTH({ audioKey: store.getters.ACTIVE_AUDIO_KEY, accentPhraseIndex: store.getters.AUDIO_PLAY_START_POINT, }); @@ -211,7 +211,7 @@ const startPoint = computed({ return store.getters.AUDIO_PLAY_START_POINT; }, set: (startPoint) => { - void store.dispatch("SET_AUDIO_PLAY_START_POINT", { startPoint }); + void store.actions.SET_AUDIO_PLAY_START_POINT({ startPoint }); }, }); // アクティブ(再生されている状態)なアクセント句 @@ -243,12 +243,12 @@ watch(accentPhrases, async () => { // audio play const play = async () => { try { - await store.dispatch("PLAY_AUDIO", { + await store.actions.PLAY_AUDIO({ audioKey: props.activeAudioKey, }); } catch (e) { const msg = handlePossiblyNotMorphableError(e); - void store.dispatch("SHOW_ALERT_DIALOG", { + void store.actions.SHOW_ALERT_DIALOG({ title: "再生に失敗しました", message: msg ?? "エンジンの再起動をお試しください。", }); @@ -256,7 +256,7 @@ const play = async () => { }; const stop = () => { - void store.dispatch("STOP_AUDIO"); + void store.actions.STOP_AUDIO(); }; const nowPlaying = computed(() => store.getters.NOW_PLAYING); @@ -310,7 +310,7 @@ const scrollToActivePoint = () => { let requestId: number | undefined; watch(nowPlaying, async (newState) => { if (newState) { - const accentPhraseOffsets = await store.dispatch("GET_AUDIO_PLAY_OFFSETS", { + const accentPhraseOffsets = await store.actions.GET_AUDIO_PLAY_OFFSETS({ audioKey: props.activeAudioKey, }); // 現在再生されているaudio elementの再生時刻を描画毎に取得(監視)し、 diff --git a/src/components/Talk/TalkEditor.vue b/src/components/Talk/TalkEditor.vue index 6b068c99c7..b31cf1bf71 100644 --- a/src/components/Talk/TalkEditor.vue +++ b/src/components/Talk/TalkEditor.vue @@ -163,7 +163,7 @@ registerHotkeyWithCleanup({ name: "音声書き出し", callback: () => { if (!uiLocked.value) { - void store.dispatch("SHOW_GENERATE_AND_SAVE_ALL_AUDIO_DIALOG"); + void store.actions.SHOW_GENERATE_AND_SAVE_ALL_AUDIO_DIALOG(); } }, }); @@ -172,7 +172,7 @@ registerHotkeyWithCleanup({ name: "選択音声を書き出し", callback: () => { if (!uiLocked.value) { - void store.dispatch("SHOW_GENERATE_AND_SAVE_SELECTED_AUDIO_DIALOG"); + void store.actions.SHOW_GENERATE_AND_SAVE_SELECTED_AUDIO_DIALOG(); } }, }); @@ -181,7 +181,7 @@ registerHotkeyWithCleanup({ name: "音声を繋げて書き出し", callback: () => { if (!uiLocked.value) { - void store.dispatch("SHOW_GENERATE_AND_CONNECT_ALL_AUDIO_DIALOG"); + void store.actions.SHOW_GENERATE_AND_CONNECT_ALL_AUDIO_DIALOG(); } }, }); @@ -190,7 +190,7 @@ registerHotkeyWithCleanup({ name: "テキストを読み込む", callback: () => { if (!uiLocked.value) { - void store.dispatch("SHOW_CONNECT_AND_EXPORT_TEXT_DIALOG"); + void store.actions.SHOW_CONNECT_AND_EXPORT_TEXT_DIALOG(); } }, }); @@ -252,7 +252,7 @@ registerHotkeyWithCleanup({ name: "すべて選択", callback: () => { if (!uiLocked.value && isMultiSelectEnabled.value) { - void store.dispatch("SET_SELECTED_AUDIO_KEYS", { + void store.actions.SET_SELECTED_AUDIO_KEYS({ audioKeys: audioKeys.value, }); } @@ -326,7 +326,7 @@ const updateSplitterPosition = async ( ...splitterPosition.value, [propertyName]: newValue, }; - await store.dispatch("SET_ROOT_MISC_SETTING", { + await store.actions.SET_ROOT_MISC_SETTING({ key: "splitterPosition", value: newSplitterPosition, }); @@ -362,7 +362,7 @@ const resizeObserverRef = ref(); // DaD const updateAudioKeys = (audioKeys: AudioKey[]) => - store.dispatch("COMMAND_SET_AUDIO_KEYS", { audioKeys }); + store.actions.COMMAND_SET_AUDIO_KEYS({ audioKeys }); const itemKey = (key: string) => key; // セルを追加 @@ -381,13 +381,13 @@ const addAudioItem = async () => { baseAudioItem = store.state.audioItems[prevAudioKey]; } - const audioItem = await store.dispatch("GENERATE_AUDIO_ITEM", { + const audioItem = await store.actions.GENERATE_AUDIO_ITEM({ voice, presetKey, baseAudioItem, }); - const newAudioKey = await store.dispatch("COMMAND_REGISTER_AUDIO_ITEM", { + const newAudioKey = await store.actions.COMMAND_REGISTER_AUDIO_ITEM({ audioItem, prevAudioKey: activeAudioKey.value, }); @@ -401,7 +401,7 @@ const duplicateAudioItem = async () => { const prevAudioItem = toRaw(store.state.audioItems[prevAudioKey]); - const newAudioKey = await store.dispatch("COMMAND_REGISTER_AUDIO_ITEM", { + const newAudioKey = await store.actions.COMMAND_REGISTER_AUDIO_ITEM({ audioItem: structuredClone(prevAudioItem), prevAudioKey: activeAudioKey.value, }); @@ -501,7 +501,7 @@ watch(userOrderedCharacterInfos, (userOrderedCharacterInfos) => { }; // FIXME: UNDOができてしまうのでできれば直したい - void store.dispatch("COMMAND_MULTI_CHANGE_VOICE", { + void store.actions.COMMAND_MULTI_CHANGE_VOICE({ audioKeys: [first], voice: voice, }); @@ -518,14 +518,14 @@ onetimeWatch( return "continue"; if (!isProjectFileLoaded) { // 最初のAudioCellを作成 - const audioItem = await store.dispatch("GENERATE_AUDIO_ITEM", {}); - const newAudioKey = await store.dispatch("REGISTER_AUDIO_ITEM", { + const audioItem = await store.actions.GENERATE_AUDIO_ITEM({}); + const newAudioKey = await store.actions.REGISTER_AUDIO_ITEM({ audioItem, }); focusCell({ audioKey: newAudioKey, focusTarget: "textField" }); // 最初の話者を初期化 - void store.dispatch("SETUP_SPEAKER", { + void store.actions.SETUP_SPEAKER({ audioKeys: [newAudioKey], engineId: audioItem.voice.engineId, styleId: audioItem.voice.styleId, @@ -557,7 +557,7 @@ watch( const altPort = store.state.altPortInfos[engineId]; if (!altPort) return; - void store.dispatch("SHOW_NOTIFY_AND_NOT_SHOW_AGAIN_BUTTON", { + void store.actions.SHOW_NOTIFY_AND_NOT_SHOW_AGAIN_BUTTON({ message: `${altPort.from}番ポートが使用中であるため ${engineName} は、${altPort.to}番ポートで起動しました`, icon: "compare_arrows", tipName: "engineStartedOnAltPort", @@ -573,13 +573,13 @@ const loadDraggedFile = (event: { dataTransfer: DataTransfer | null }) => { const file = event.dataTransfer.files[0]; switch (path.extname(file.name)) { case ".txt": - void store.dispatch("COMMAND_IMPORT_FROM_FILE", { filePath: file.path }); + void store.actions.COMMAND_IMPORT_FROM_FILE({ filePath: file.path }); break; case ".vvproj": - void store.dispatch("LOAD_PROJECT_FILE", { filePath: file.path }); + void store.actions.LOAD_PROJECT_FILE({ filePath: file.path }); break; default: - void store.dispatch("SHOW_ALERT_DIALOG", { + void store.actions.SHOW_ALERT_DIALOG({ title: "対応していないファイルです", message: "テキストファイル (.txt) とVOICEVOXプロジェクトファイル (.vvproj) に対応しています。", @@ -619,7 +619,7 @@ const onAudioCellPaneClick = () => { store.state.experimentalSetting.enableMultiSelect && activeAudioKey.value ) { - void store.dispatch("SET_SELECTED_AUDIO_KEYS", { + void store.actions.SET_SELECTED_AUDIO_KEYS({ audioKeys: [activeAudioKey.value], }); } diff --git a/src/components/Talk/ToolBar.vue b/src/components/Talk/ToolBar.vue index 6a8d12a9b8..5bbb6e1e2c 100644 --- a/src/components/Talk/ToolBar.vue +++ b/src/components/Talk/ToolBar.vue @@ -87,24 +87,24 @@ registerHotkeyWithCleanup({ }); const undo = () => { - void store.dispatch("UNDO", { editor }); + void store.actions.UNDO({ editor }); }; const redo = () => { - void store.dispatch("REDO", { editor }); + void store.actions.REDO({ editor }); }; const playContinuously = async () => { try { - await store.dispatch("PLAY_CONTINUOUSLY_AUDIO"); + await store.actions.PLAY_CONTINUOUSLY_AUDIO(); } catch (e) { const msg = handlePossiblyNotMorphableError(e); - void store.dispatch("SHOW_ALERT_DIALOG", { + void store.actions.SHOW_ALERT_DIALOG({ title: "再生に失敗しました", message: msg ?? "エンジンの再起動をお試しください。", }); } }; const stop = () => { - void store.dispatch("STOP_AUDIO"); + void store.actions.STOP_AUDIO(); }; const generateAndSaveSelectedAudio = async () => { if (activeAudioKey.value == undefined) @@ -117,35 +117,35 @@ const generateAndSaveSelectedAudio = async () => { ) { await multiGenerateAndSaveAudioWithDialog({ audioKeys: selectedAudioKeys, - dispatch: store.dispatch, + actions: store.actions, disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate, }); } else { await generateAndSaveOneAudioWithDialog({ audioKey: activeAudioKey.value, disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate, - dispatch: store.dispatch, + actions: store.actions, }); } }; const generateAndSaveAllAudio = async () => { await multiGenerateAndSaveAudioWithDialog({ audioKeys: store.state.audioKeys, - dispatch: store.dispatch, + actions: store.actions, disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate, }); }; const generateAndConnectAndSaveAudio = async () => { await generateAndConnectAndSaveAudioWithDialog({ - dispatch: store.dispatch, + actions: store.actions, disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate, }); }; const saveProject = async () => { - await store.dispatch("SAVE_PROJECT_FILE", { overwrite: true }); + await store.actions.SAVE_PROJECT_FILE({ overwrite: true }); }; const importTextFile = () => { - void store.dispatch("COMMAND_IMPORT_FROM_FILE", {}); + void store.actions.COMMAND_IMPORT_FROM_FILE({}); }; const usableButtons: Record< diff --git a/src/components/Talk/menuBarData.ts b/src/components/Talk/menuBarData.ts index a94c351c40..c0bd892dad 100644 --- a/src/components/Talk/menuBarData.ts +++ b/src/components/Talk/menuBarData.ts @@ -12,7 +12,7 @@ export const useMenuBarData = () => { type: "button", label: "音声書き出し", onClick: () => { - void store.dispatch("SHOW_GENERATE_AND_SAVE_ALL_AUDIO_DIALOG"); + void store.actions.SHOW_GENERATE_AND_SAVE_ALL_AUDIO_DIALOG(); }, disableWhenUiLocked: true, }, @@ -20,7 +20,7 @@ export const useMenuBarData = () => { type: "button", label: "選択音声を書き出し", onClick: () => { - void store.dispatch("SHOW_GENERATE_AND_SAVE_SELECTED_AUDIO_DIALOG"); + void store.actions.SHOW_GENERATE_AND_SAVE_SELECTED_AUDIO_DIALOG(); }, disableWhenUiLocked: true, }, @@ -28,7 +28,7 @@ export const useMenuBarData = () => { type: "button", label: "音声を繋げて書き出し", onClick: () => { - void store.dispatch("SHOW_GENERATE_AND_CONNECT_ALL_AUDIO_DIALOG"); + void store.actions.SHOW_GENERATE_AND_CONNECT_ALL_AUDIO_DIALOG(); }, disableWhenUiLocked: true, }, @@ -37,7 +37,7 @@ export const useMenuBarData = () => { type: "button", label: "テキストを繋げて書き出し", onClick: () => { - void store.dispatch("SHOW_CONNECT_AND_EXPORT_TEXT_DIALOG"); + void store.actions.SHOW_CONNECT_AND_EXPORT_TEXT_DIALOG(); }, disableWhenUiLocked: true, }, @@ -45,7 +45,7 @@ export const useMenuBarData = () => { type: "button", label: "テキスト読み込み", onClick: () => { - void store.dispatch("COMMAND_IMPORT_FROM_FILE", {}); + void store.actions.COMMAND_IMPORT_FROM_FILE({}); }, disableWhenUiLocked: true, }, diff --git a/src/components/ToolTip.vue b/src/components/ToolTip.vue index c3f9dca839..491016b971 100644 --- a/src/components/ToolTip.vue +++ b/src/components/ToolTip.vue @@ -31,7 +31,7 @@ const store = useStore(); const tipConfirmed = computed({ get: () => store.state.confirmedTips[props.tipKey], set: (value) => - store.dispatch("SET_CONFIRMED_TIPS", { + store.actions.SET_CONFIRMED_TIPS({ confirmedTips: { ...store.state.confirmedTips, [props.tipKey]: value, diff --git a/src/store/ui.ts b/src/store/ui.ts index 70ceb566a2..9d6bdb5afa 100644 --- a/src/store/ui.ts +++ b/src/store/ui.ts @@ -282,9 +282,8 @@ export const uiStore = createPartialStore({ }, SHOW_NOTIFY_AND_NOT_SHOW_AGAIN_BUTTON: { - // FIXME: showNotifyAndNotShowAgainButtonをDotNotationに対応させて修正 - action({ dispatch }, payload: NotifyAndNotShowAgainButtonOption) { - showNotifyAndNotShowAgainButton({ dispatch }, payload); + action({ actions }, payload: NotifyAndNotShowAgainButtonOption) { + showNotifyAndNotShowAgainButton({ actions }, payload); }, }, @@ -520,28 +519,26 @@ export const uiStore = createPartialStore({ // TODO: この4つのアクションをVue側に移動したい SHOW_GENERATE_AND_SAVE_ALL_AUDIO_DIALOG: { - async action({ state, dispatch }) { - // FIXME: `multiGenerateAndSaveAudioWithDialog`をDotNotationに対応させて修正 + async action({ state, actions }) { await multiGenerateAndSaveAudioWithDialog({ audioKeys: state.audioKeys, disableNotifyOnGenerate: state.confirmedTips.notifyOnGenerate, - dispatch, + actions, }); }, }, SHOW_GENERATE_AND_CONNECT_ALL_AUDIO_DIALOG: { - async action({ dispatch, state }) { - // FIXME: `generateAndConnectAndSaveAudioWithDialog`をDotNotationに対応させて修正 + async action({ actions, state }) { await generateAndConnectAndSaveAudioWithDialog({ - dispatch, + actions, disableNotifyOnGenerate: state.confirmedTips.notifyOnGenerate, }); }, }, SHOW_GENERATE_AND_SAVE_SELECTED_AUDIO_DIALOG: { - async action({ getters, dispatch, actions, state }) { + async action({ getters, actions, state }) { const activeAudioKey = getters.ACTIVE_AUDIO_KEY; if (activeAudioKey == undefined) { void actions.SHOW_ALERT_DIALOG({ @@ -556,27 +553,25 @@ export const uiStore = createPartialStore({ state.experimentalSetting.enableMultiSelect && selectedAudioKeys.length > 1 ) { - // FIXME: `multiGenerateAndSaveAudioWithDialog`をDotNotationに対応させて修正 await multiGenerateAndSaveAudioWithDialog({ audioKeys: selectedAudioKeys, - dispatch: dispatch, + actions: actions, disableNotifyOnGenerate: state.confirmedTips.notifyOnGenerate, }); } else { await generateAndSaveOneAudioWithDialog({ audioKey: activeAudioKey, disableNotifyOnGenerate: state.confirmedTips.notifyOnGenerate, - dispatch: dispatch, + actions: actions, }); } }, }, SHOW_CONNECT_AND_EXPORT_TEXT_DIALOG: { - async action({ dispatch, state }) { - // FIXME: `connectAndExportTextWithDialog`をDotNotationに対応させて修正 + async action({ actions, state }) { await connectAndExportTextWithDialog({ - dispatch, + actions, disableNotifyOnGenerate: state.confirmedTips.notifyOnGenerate, }); },