diff --git a/src/components/Dialog/Dialog.ts b/src/components/Dialog/Dialog.ts index 38edc9b31f..c29b0cd5cb 100644 --- a/src/components/Dialog/Dialog.ts +++ b/src/components/Dialog/Dialog.ts @@ -54,8 +54,6 @@ export type NotifyAndNotShowAgainButtonOption = { tipName: keyof ConfirmedTips; }; -export type LoadingScreenOption = { message: string }; - // 汎用ダイアログを表示 /** メッセージを知らせるダイアログ */ @@ -404,6 +402,8 @@ export const showNotifyAndNotShowAgainButton = ( }); }; +type LoadingScreenOption = { message: string }; + export const showLoadingScreen = (options: LoadingScreenOption) => { Loading.show({ spinnerColor: "primary", diff --git a/src/components/Dialog/SettingDialog/SettingDialog.vue b/src/components/Dialog/SettingDialog/SettingDialog.vue index 004be181eb..65113506c5 100644 --- a/src/components/Dialog/SettingDialog/SettingDialog.vue +++ b/src/components/Dialog/SettingDialog/SettingDialog.vue @@ -681,16 +681,10 @@ const acceptRetrieveTelemetryComputed = computed({ }); const changeUseGpu = async (useGpu: boolean) => { - void store.actions.SHOW_LOADING_SCREEN({ - message: "起動モードを変更中です", - }); - await store.actions.CHANGE_USE_GPU({ useGpu, engineId: selectedEngineId.value, }); - - void store.actions.HIDE_ALL_LOADING_SCREEN(); }; const changeinheritAudioInfo = async (inheritAudioInfo: boolean) => { diff --git a/src/store/setting.ts b/src/store/setting.ts index 1cd2aa1dd9..6cd5ad630b 100644 --- a/src/store/setting.ts +++ b/src/store/setting.ts @@ -3,7 +3,9 @@ import { createUILockAction } from "./ui"; import { createPartialStore } from "./vuex"; import { themes } from "@/domain/theme"; import { + hideAllLoadingScreen, showAlertDialog, + showLoadingScreen, showQuestionDialog, } from "@/components/Dialog/Dialog"; import { @@ -357,24 +359,34 @@ export const settingStore = createPartialStore({ */ action: createUILockAction( async ({ state, actions }, { useGpu, engineId }) => { - const isAvailableGPUMode = await window.backend.isAvailableGPUMode(); - // 対応するGPUがない場合に変更を続行するか問う - if (useGpu && !isAvailableGPUMode) { - const result = await showQuestionDialog({ - type: "warning", - title: "対応するGPUデバイスが見つかりません", - message: - "GPUモードの利用には対応するGPUデバイスが必要です。\n" + - "このままGPUモードに変更するとエンジンエラーが発生する可能性があります。本当に変更しますか?", - buttons: ["変更しない", "変更する"], - cancel: 0, - }); - if (result == 0) { - return; + if (useGpu) { + showLoadingScreen({ message: "GPUデバイスを確認中です" }); + + const isAvailableGPUMode = await window.backend.isAvailableGPUMode(); + + hideAllLoadingScreen(); + + if (!isAvailableGPUMode) { + const result = await showQuestionDialog({ + type: "warning", + title: "対応するGPUデバイスが見つかりません", + message: + "GPUモードの利用には対応するGPUデバイスが必要です。\n" + + "このままGPUモードに変更するとエンジンエラーが発生する可能性があります。本当に変更しますか?", + buttons: ["変更しない", "変更する"], + cancel: 0, + }); + if (result == 0) { + return; + } } } + showLoadingScreen({ + message: "起動モードを変更中です", + }); + void actions.SET_ENGINE_SETTING({ engineSetting: { ...state.engineSettings[engineId], useGpu }, engineId, @@ -383,6 +395,8 @@ export const settingStore = createPartialStore({ engineIds: [engineId], }); + hideAllLoadingScreen(); + // GPUモードに変更できなかった場合はCPUモードに戻す // FIXME: useGpu設定を保存してからエンジン起動を試すのではなく、逆にしたい if (!result.success && useGpu) { diff --git a/src/store/type.ts b/src/store/type.ts index a57e243881..ebb5f10314 100644 --- a/src/store/type.ts +++ b/src/store/type.ts @@ -58,7 +58,6 @@ import { IEngineConnectorFactory } from "@/infrastructures/EngineConnector"; import { TextDialogResult, NotifyAndNotShowAgainButtonOption, - LoadingScreenOption, MessageDialogOptions, ConfirmDialogOptions, WarningDialogOptions, @@ -2087,14 +2086,6 @@ export type UiStoreTypes = { action(payload: NotifyAndNotShowAgainButtonOption): void; }; - SHOW_LOADING_SCREEN: { - action(payload: LoadingScreenOption): void; - }; - - HIDE_ALL_LOADING_SCREEN: { - action(): void; - }; - ON_VUEX_READY: { mutation: void; action(): void; diff --git a/src/store/ui.ts b/src/store/ui.ts index 14eab4b367..f75913f5d6 100644 --- a/src/store/ui.ts +++ b/src/store/ui.ts @@ -17,16 +17,13 @@ import { MessageDialogOptions, ConfirmDialogOptions, WarningDialogOptions, - LoadingScreenOption, NotifyAndNotShowAgainButtonOption, connectAndExportTextWithDialog, generateAndConnectAndSaveAudioWithDialog, generateAndSaveOneAudioWithDialog, - hideAllLoadingScreen, multiGenerateAndSaveAudioWithDialog, showAlertDialog, showConfirmDialog, - showLoadingScreen, showNotifyAndNotShowAgainButton, showWarningDialog, } from "@/components/Dialog/Dialog"; @@ -229,18 +226,6 @@ export const uiStore = createPartialStore({ }, }, - SHOW_LOADING_SCREEN: { - action(_, payload: LoadingScreenOption) { - showLoadingScreen(payload); - }, - }, - - HIDE_ALL_LOADING_SCREEN: { - action() { - hideAllLoadingScreen(); - }, - }, - HYDRATE_UI_STORE: { async action({ mutations }) { mutations.SET_INHERIT_AUDIOINFO({ diff --git a/src/styles/_index.scss b/src/styles/_index.scss index ae0b795b5e..64ba2f891c 100644 --- a/src/styles/_index.scss +++ b/src/styles/_index.scss @@ -278,7 +278,7 @@ img { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; - font-size: 24px; /* Preferred icon size */ + font-size: 24px; /* Preferred icon size */ display: inline-block; line-height: 1; text-transform: none;