Skip to content

Commit

Permalink
「エンジンを再起動する機能」を機能するように修正 (VOICEVOX#800)
Browse files Browse the repository at this point in the history
* add detectNvidia function

* follow to menu bar

* remove no longer a variable

* run fmt

* fix typo

* remove utils.ts and some changes in background.ts

* change message box type and detail, and change behaviour of setOnLaunchModeItemClicked

* recreate package-lock.json using node 12.18.2

* re recreate package-lock.json using node 12.18.2 and npm 7.20.5

* recreate package-lock.json using node 12.18.2 and npm 6.14.5

* recreate package-lock.json using node 12.18.2 and npm 7.20.3

* fix conflict

* fix feature of restart engine, add a argument
  • Loading branch information
madosuki committed May 8, 2022
1 parent 9f8cf04 commit fc04a18
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ export default defineComponent({
type: "button",
label: "再起動",
onClick: () => {
store.dispatch("RESTART_ENGINE");
store.dispatch("RESTART_ENGINE", {
engineKey: store.state.engineInfos[0].key,
}); // TODO: 複数エンジン対応
},
},
],
Expand Down
8 changes: 6 additions & 2 deletions src/components/SettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,9 @@ export default defineComponent({
const change = async () => {
await store.dispatch("SET_USE_GPU", { useGpu });
store.dispatch("RESTART_ENGINE");
store.dispatch("RESTART_ENGINE", {
engineKey: store.state.engineInfos[0].key,
}); // TODO: 複数エンジン対応
$q.dialog({
title: "エンジンの起動モードを変更しました",
Expand Down Expand Up @@ -894,7 +896,9 @@ export default defineComponent({
};
const restartEngineProcess = () => {
store.dispatch("RESTART_ENGINE");
store.dispatch("RESTART_ENGINE", {
engineKey: store.state.engineInfos[0].key,
}); // TODO: 複数エンジン対応
};
const savingSetting = computed(() => store.state.savingSetting);
Expand Down
4 changes: 2 additions & 2 deletions src/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ const api: Sandbox = {
return ipcRendererInvoke("ENGINE_INFOS");
},

restartEngine: () => {
return ipcRendererInvoke("RESTART_ENGINE");
restartEngine: (engineKey) => {
return ipcRendererInvoke("RESTART_ENGINE", { engineKey: engineKey });
},

savingSetting: (newData) => {
Expand Down
4 changes: 2 additions & 2 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1501,10 +1501,10 @@ export const audioStore: VoiceVoxStoreOptions<
commit("SET_ENGINE_STATE", { engineState: "ERROR" });
}
},
async RESTART_ENGINE({ dispatch, commit }) {
async RESTART_ENGINE({ dispatch, commit }, { engineKey }) {
await commit("SET_ENGINE_STATE", { engineState: "STARTING" });
window.electron
.restartEngine()
.restartEngine(engineKey)
.then(() => dispatch("START_WAITING_ENGINE"))
.catch(() => dispatch("DETECTED_ENGINE_ERROR"));
},
Expand Down
2 changes: 1 addition & 1 deletion src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ type AudioStoreTypes = {
};

RESTART_ENGINE: {
action(): void;
action(payload: { engineKey: string }): void;
};

DETECTED_ENGINE_ERROR: {
Expand Down
2 changes: 1 addition & 1 deletion src/type/ipc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type IpcIHData = {
};

RESTART_ENGINE: {
args: [];
args: [obj: { engineKey: string }];
return: void;
};

Expand Down
2 changes: 1 addition & 1 deletion src/type/preload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface Sandbox {
logError(...params: unknown[]): void;
logInfo(...params: unknown[]): void;
engineInfos(): Promise<EngineInfo[]>;
restartEngine(): Promise<void>;
restartEngine(engineKey: string): Promise<void>;
savingSetting(newData?: SavingSetting): Promise<SavingSetting>;
hotkeySettings(newData?: HotkeySetting): Promise<HotkeySetting[]>;
toolbarSetting(newData?: ToolbarSetting): Promise<ToolbarSetting>;
Expand Down

0 comments on commit fc04a18

Please sign in to comment.