Skip to content

Commit

Permalink
Add: 「音声合成エンジンのログフォルダを開く」ボタンを実装
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Dec 31, 2024
1 parent fabfaf9 commit bbf01fb
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- エラーログ

> [!NOTE]
> エラーログは AivisSpeech ソフトウェア内のヘルプ → お問い合わせ → 「ログフォルダを開く」ボタンから確認できます。
> エラーログは AivisSpeech ソフトウェア内のヘルプ → お問い合わせ → 「ログフォルダを開く」「音声合成エンジンのログフォルダを開く」ボタンから確認できます。
> [!WARNING]
> エラーログには PC ユーザー名などのシステム情報が含まれる場合があります。
Expand Down
6 changes: 4 additions & 2 deletions public/qAndA.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ PC の空きメモリが不足している環境では、音声合成エンジ

### Q. エラーログはどこで確認できますか?

ヘルプ → お問い合わせ → ログフォルダを開くボタン から確認できます。具体的には以下のフォルダに保存されています。
ヘルプ → お問い合わせ → 「ログフォルダを開く」ボタンをクリックすると、ログの保存先フォルダが開きます。
具体的には、以下のフォルダに保存されています。

#### Windows 版

Expand All @@ -225,7 +226,8 @@ PC の空きメモリが不足している環境では、音声合成エンジ

### Q. 音声合成エンジンのエラーログはどこで確認できますか?

以下のフォルダに保存されています。
ヘルプ → お問い合わせ → 「音声合成エンジンのログフォルダを開く」ボタンをクリックすると、音声合成エンジンのログの保存先フォルダが開きます。
具体的には、以下のフォルダに保存されています。

#### Windows 版

Expand Down
3 changes: 3 additions & 0 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ export const api: Sandbox = {
openLogDirectory() {
throw new Error("Not supported on Browser version: openLogDirectory");
},
openDefaultEngineLogDirectory() {
throw new Error("Not supported on Browser version: openDefaultEngineLogDirectory");
},
/* eslint-enable no-console */
engineInfos() {
return Promise.resolve([defaultEngine]);
Expand Down
20 changes: 20 additions & 0 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,29 @@ registerIpcMainHandle<IpcMainHandle>({
ZOOM_RESET: () => {
win.webContents.setZoomFactor(1);
},

OPEN_LOG_DIRECTORY: () => {
void shell.openPath(app.getPath("logs"));
},
OPEN_DEFAULT_ENGINE_LOG_DIRECTORY: () => {
// AivisSpeech Engine のログ保存先ディレクトリを OS ごとに取得
let logPath = "";
switch (process.platform) {
case "win32":
logPath = path.join(app.getPath("appData"), "AivisSpeech-Engine", "Logs");
break;
case "darwin":
logPath = path.join(app.getPath("appData"), "AivisSpeech-Engine", "Logs");
break;
case "linux":
logPath = path.join(app.getPath("home"), ".local", "share", "AivisSpeech-Engine", "Logs");
break;
default:
return;
}
// ログディレクトリを開く
void shell.openPath(logPath);
},

ENGINE_INFOS: () => {
// エンジン情報を設定ファイルに保存しないためにelectron-storeは使わない
Expand Down
4 changes: 4 additions & 0 deletions src/backend/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ const api: Sandbox = {
void ipcRendererInvokeProxy.OPEN_LOG_DIRECTORY();
},

openDefaultEngineLogDirectory: () => {
void ipcRendererInvokeProxy.OPEN_DEFAULT_ENGINE_LOG_DIRECTORY();
},

engineInfos: () => {
return ipcRendererInvokeProxy.ENGINE_INFOS();
},
Expand Down
10 changes: 10 additions & 0 deletions src/components/Dialog/HelpDialog/HelpDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@
class="text-no-wrap text-bold q-mr-sm"
@click="openLogDirectory"
/>
<QBtn
v-if="page.component === ContactInfo"
outline
icon="sym_r_description"
label="音声合成エンジンのログフォルダを開く"
textColor="display"
class="text-no-wrap text-bold q-mr-sm"
@click="openDefaultEngineLogDirectory"
/>
</QToolbar>
</QHeader>
<Component :is="page.component" v-bind="page.props" />
Expand Down Expand Up @@ -274,6 +283,7 @@ const selectedPageIndex = ref(0);
// });
const openLogDirectory = () => window.backend.openLogDirectory();
const openDefaultEngineLogDirectory = () => window.backend.openDefaultEngineLogDirectory();
</script>

<style scoped lang="scss">
Expand Down
5 changes: 5 additions & 0 deletions src/type/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ export type IpcIHData = {
return: void;
};

OPEN_DEFAULT_ENGINE_LOG_DIRECTORY: {
args: [];
return: void;
};

ENGINE_INFOS: {
args: [];
return: EngineInfo[];
Expand Down
1 change: 1 addition & 0 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export interface Sandbox {
logWarn(...params: unknown[]): void;
logInfo(...params: unknown[]): void;
openLogDirectory(): void;
openDefaultEngineLogDirectory(): void;
engineInfos(): Promise<EngineInfo[]>;
restartEngine(engineId: EngineId): Promise<void>;
openEngineDirectory(engineId: EngineId): void;
Expand Down

0 comments on commit bbf01fb

Please sign in to comment.