Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: 文字コード系のwriteText関連処理を一箇所にまとめる #1448

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions src/components/Dialog.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { Dialog, DialogChainObject, Notify, Loading } from "quasar";
import {
AudioKey,
ConfirmedTips,
Encoding as EncodingType,
} from "@/type/preload";
import { AudioKey, ConfirmedTips } from "@/type/preload";
import {
AllActions,
SaveResultObject,
Expand Down Expand Up @@ -149,20 +145,17 @@ export async function generateAndSaveOneAudioWithDialog({
audioKey,
dispatch,
filePath,
encoding,
disableNotifyOnGenerate,
}: {
audioKey: AudioKey;
dispatch: Dispatch<AllActions>;
filePath?: string;
encoding?: EncodingType;
disableNotifyOnGenerate: boolean;
}): Promise<void> {
const result: SaveResultObject = await withProgress(
dispatch("GENERATE_AND_SAVE_AUDIO", {
audioKey,
filePath,
encoding,
}),
dispatch
);
Expand All @@ -184,18 +177,15 @@ export async function generateAndSaveOneAudioWithDialog({
export async function generateAndSaveAllAudioWithDialog({
dispatch,
dirPath,
encoding,
disableNotifyOnGenerate,
}: {
dispatch: Dispatch<AllActions>;
dirPath?: string;
encoding?: EncodingType;
disableNotifyOnGenerate: boolean;
}): Promise<void> {
const result = await withProgress(
dispatch("GENERATE_AND_SAVE_ALL_AUDIO", {
dirPath,
encoding,
callback: (finishedCount, totalCount) =>
dispatch("SET_PROGRESS_FROM_COUNT", { finishedCount, totalCount }),
}),
Expand Down Expand Up @@ -249,18 +239,15 @@ export async function generateAndSaveAllAudioWithDialog({
export async function generateAndConnectAndSaveAudioWithDialog({
dispatch,
filePath,
encoding,
disableNotifyOnGenerate,
}: {
dispatch: Dispatch<AllActions>;
filePath?: string;
encoding?: EncodingType;
disableNotifyOnGenerate: boolean;
}): Promise<void> {
const result = await withProgress(
dispatch("GENERATE_AND_CONNECT_AND_SAVE_AUDIO", {
filePath,
encoding,
callback: (finishedCount, totalCount) =>
dispatch("SET_PROGRESS_FROM_COUNT", { finishedCount, totalCount }),
}),
Expand All @@ -283,17 +270,14 @@ export async function generateAndConnectAndSaveAudioWithDialog({
export async function connectAndExportTextWithDialog({
dispatch,
filePath,
encoding,
disableNotifyOnGenerate,
}: {
dispatch: Dispatch<AllActions>;
filePath?: string;
encoding?: EncodingType;
disableNotifyOnGenerate: boolean;
}): Promise<void> {
const result = await dispatch("CONNECT_AND_EXPORT_TEXT", {
filePath,
encoding,
});

if (result === undefined || result.result === "CANCELED") return;
Expand Down
3 changes: 0 additions & 3 deletions src/components/HeaderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,18 @@ const generateAndSaveOneAudio = async () => {
await generateAndSaveOneAudioWithDialog({
audioKey: activeAudioKey.value,
dispatch: store.dispatch,
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
});
};
const generateAndSaveAllAudio = async () => {
await generateAndSaveAllAudioWithDialog({
dispatch: store.dispatch,
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
});
};
const generateAndConnectAndSaveAudio = async () => {
await generateAndConnectAndSaveAudioWithDialog({
dispatch: store.dispatch,
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
});
};
Expand Down
4 changes: 0 additions & 4 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ const createNewProject = async () => {
const generateAndSaveAllAudio = async () => {
if (!uiLocked.value) {
await generateAndSaveAllAudioWithDialog({
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
dispatch: store.dispatch,
});
Expand All @@ -142,7 +141,6 @@ const generateAndConnectAndSaveAllAudio = async () => {
if (!uiLocked.value) {
await generateAndConnectAndSaveAudioWithDialog({
dispatch: store.dispatch,
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
});
}
Expand All @@ -162,7 +160,6 @@ const generateAndSaveOneAudio = async () => {

await generateAndSaveOneAudioWithDialog({
audioKey: activeAudioKey,
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
dispatch: store.dispatch,
});
Expand All @@ -172,7 +169,6 @@ const connectAndExportText = async () => {
if (!uiLocked.value) {
await connectAndExportTextWithDialog({
dispatch: store.dispatch,
encoding: store.state.savingSetting.fileEncoding,
disableNotifyOnGenerate: store.state.confirmedTips.notifyOnGenerate,
});
}
Expand Down
Loading