Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
madosuki committed Nov 26, 2021
1 parent 573f771 commit 99b1def
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions 001_dummy1_test.txt
@@ -0,0 +1 @@
test
Binary file added 001_dummy1_test.wav
Binary file not shown.
1 change: 1 addition & 0 deletions 001_dummy1_阿呆ですね.txt
@@ -0,0 +1 @@
阿呆ですね
Binary file added 001_dummy1_阿呆ですね.wav
Binary file not shown.
36 changes: 26 additions & 10 deletions src/background.ts
Expand Up @@ -5,7 +5,15 @@ import dotenv from "dotenv";
import treeKill from "tree-kill";
import Store from "electron-store";

import { app, protocol, BrowserWindow, dialog, Menu, shell } from "electron";
import {
app,
protocol,
BrowserWindow,
dialog,
Menu,
shell,
ipcMain,
} from "electron";
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
import installExtension, { VUEJS3_DEVTOOLS } from "electron-devtools-installer";

Expand Down Expand Up @@ -455,36 +463,44 @@ ipcMainHandle("GET_OSS_COMMUNITY_INFOS", () => {
return ossCommunityInfos;
});

ipcMainHandle("SHOW_AUDIO_SAVE_DIALOG", (_, { title, defaultPath }) => {
return dialog.showSaveDialogSync(win, {
ipcMainHandle("SHOW_AUDIO_SAVE_DIALOG", async (_, { title, defaultPath }) => {
const result = await dialog.showSaveDialog(win, {
title,
defaultPath,
filters: [{ name: "Wave File", extensions: ["wav"] }],
properties: ["createDirectory"],
});
return result.filePath;
});

ipcMainHandle("SHOW_OPEN_DIRECTORY_DIALOG", (_, { title }) => {
return dialog.showOpenDialogSync(win, {
ipcMainHandle("SHOW_OPEN_DIRECTORY_DIALOG", async (_, { title }) => {
const result = await dialog.showOpenDialog(win, {
title,
properties: ["openDirectory", "createDirectory"],
})?.[0];
});
if (result.canceled) {
return undefined;
}

return result.filePaths[0];
});

ipcMainHandle("SHOW_PROJECT_SAVE_DIALOG", (_, { title }) => {
return dialog.showSaveDialogSync(win, {
ipcMainHandle("SHOW_PROJECT_SAVE_DIALOG", async (_, { title }) => {
const result = await dialog.showSaveDialog(win, {
title,
filters: [{ name: "VOICEVOX Project file", extensions: ["vvproj"] }],
properties: ["showOverwriteConfirmation"],
});
return result.filePath;
});

ipcMainHandle("SHOW_PROJECT_LOAD_DIALOG", (_, { title }) => {
return dialog.showOpenDialogSync(win, {
ipcMainHandle("SHOW_PROJECT_LOAD_DIALOG", async (_, { title }) => {
const result = await dialog.showOpenDialog(win, {
title,
filters: [{ name: "VOICEVOX Project file", extensions: ["vvproj"] }],
properties: ["openFile"],
});
return result.filePaths;
});

ipcMainHandle("SHOW_INFO_DIALOG", (_, { title, message, buttons }) => {
Expand Down
1 change: 1 addition & 0 deletions src/store/audio.ts
Expand Up @@ -648,6 +648,7 @@ export const audioStore: VoiceVoxStoreOptions<
buildFileName(state, audioKey)
);
} else {
window.electron.logInfo("open window");
filePath ??= await window.electron.showAudioSaveDialog({
title: "音声を保存",
defaultPath: buildFileName(state, audioKey),
Expand Down

0 comments on commit 99b1def

Please sign in to comment.