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

WIP: 初回起動時にトークとソングのどちらかを選択できるダイアログを表示する #2409

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
28e5882
初期設定ダイアログデバッグ用のボタンを設置
jdkfx Dec 10, 2024
728da61
簡易的な初期設定ダイアログを表示
jdkfx Dec 10, 2024
a86855a
ボタンによるエディタ切り替え
jdkfx Dec 11, 2024
8a9a8e5
Merge branch 'main' into feature/#2011
jdkfx Dec 13, 2024
b653097
エディタ選択後にダイアログを非表示にする
jdkfx Dec 13, 2024
1d60c07
デザインを少し考えてみる
jdkfx Dec 13, 2024
7ce0017
Merge branch 'main' into feature/#2011
jdkfx Dec 15, 2024
8b09574
過去に開いていたエディタがundefinedの時ダイアログを開く
jdkfx Dec 15, 2024
5f799d0
Merge branch 'main' into feature/#2011
jdkfx Dec 19, 2024
253e843
Merge branch 'main' into feature/#2011
jdkfx Dec 20, 2024
47c42c7
Merge branch 'main' into feature/#2011
Hiroshiba Dec 29, 2024
101bd4c
feat: 初期設定ダイアログの状態管理を追加し、openedEditorをオプショナルに変更
Hiroshiba Dec 29, 2024
cdbc3d7
Merge branch 'VOICEVOX:main' into feature/#2011
jdkfx Jan 11, 2025
6f7c945
Merge pull request #5 from Hiroshiba/hiho-counter-pr-101bd4c3
jdkfx Jan 20, 2025
ea58503
Merge branch 'main' into feature/#2011
jdkfx Jan 20, 2025
2eb2c57
Merge branch 'main' into feature/#2011
jdkfx Jan 26, 2025
7fdd64d
デバッグ用ボタン削除
jdkfx Jan 26, 2025
6184761
Merge branch 'main' into feature/#2011
jdkfx Feb 18, 2025
94fd07c
スナップショットの更新
jdkfx Feb 19, 2025
d1489a8
Merge branch 'main' into feature/#2011
jdkfx Mar 1, 2025
253a9c5
いらないvoidを消す
jdkfx Mar 11, 2025
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
16 changes: 16 additions & 0 deletions src/components/Dialog/AllDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/>
<ExportSongAudioDialog v-model="isExportSongAudioDialogOpen" />
<ImportSongProjectDialog v-model="isImportSongProjectDialogOpenComputed" />
<InitialSettingsDialog v-model="isInitialSettingsDialogOpenComputed" />
</template>

<script setup lang="ts">
Expand All @@ -40,6 +41,7 @@
import EngineManageDialog from "@/components/Dialog/EngineManageDialog.vue";
import UpdateNotificationDialogContainer from "@/components/Dialog/UpdateNotificationDialog/Container.vue";
import ImportSongProjectDialog from "@/components/Dialog/ImportSongProjectDialog.vue";
import InitialSettingsDialog from "@/components/Dialog/InitialSettingsDialog.vue";
import ExportSongAudioDialog from "@/components/Dialog/ExportSongAudioDialog/Container.vue";
import { useStore } from "@/store";
import { filterCharacterInfosByStyleType } from "@/store/utility";
Expand Down Expand Up @@ -178,4 +180,18 @@
isImportSongProjectDialogOpen: val,
}),
});

// 初期設定ダイアログ
const isSelectedEditorType = computed(() => store.state.openedEditor);
console.log(isSelectedEditorType.value);

Check warning on line 186 in src/components/Dialog/AllDialog.vue

View workflow job for this annotation

GitHub Actions / build_preview_pages

Unexpected console statement

Check warning on line 186 in src/components/Dialog/AllDialog.vue

View workflow job for this annotation

GitHub Actions / build_preview_pages

Unexpected console statement

Check warning on line 186 in src/components/Dialog/AllDialog.vue

View workflow job for this annotation

GitHub Actions / build-test

Unexpected console statement
const isInitialSettingsDialogOpenComputed = computed({
get: () => store.state.isInitialSettingsDialogOpen,
set: (val) => {
if (isSelectedEditorType.value) {
void store.actions.SET_DIALOG_OPEN({
isInitialSettingsDialogOpen: val,
});
}
},
});
Copy link
Contributor Author

@jdkfx jdkfx Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store.state.openedEditorから開いていたエディタを取得し、undefinedの時にSET_DIALOG_OPENでエディタを選択できるダイアログを表示するような処理にしている。

`openedEditor: EditorType | undefined; // undefinedのときはどのエディタを開くか定まっていない`

https://github.com/VOICEVOX/voicevox/blob/main/src/store/type.ts#L1857

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hiroshiba

初回起動の動作確認はnpm run electron:serveを実行した際、store.state.openedEditorundefinedとなり、このダイアログが開かれるのでそこで確認できます。
すでにどちらかのエディタを開き、再起動した際にこのダイアログが表示されないという挙動をどう確認しようかなと悩んでいます。

Copy link
Member

@Hiroshiba Hiroshiba Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ちょっと問題を把握できないのですがコメントまで!!

openedEditorは前回どっちのエディターが開かれていたかが入っています!
デフォルト値は今talkに設定されているので、これをデフォルトundefiendにする必要がありそうです。

こうすれば、config.jsonがない状態で起動すればこのダイアログが開かれて、1回エディタが開かれた後にもう一度起動すればダイアログが表示されないはず。
ちなみに開発環境の設定ファイルconfig.jsonC:\Users\[ユーザー名]\AppData\Roaming\voicevox-devにあります。

なんですが、ちょっとこの辺のダイアログを開くかどうか周りとかが入り組んでいるので、こちらでちょこっと変更してプルリクエスト送ろうと思います!!

</script>
92 changes: 92 additions & 0 deletions src/components/Dialog/InitialSettingsDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<template>
<QDialog v-model="isInitialSettingsDialogOpenComputed">
<QCard class="q-pa-md">
<QCardSection class="dialog-text">
<div class="text-h5">どちらに興味がありますか?</div>
<div class="text-body2 text-grey-8">
選択したエディタを開きます。アプリケーション右上からトークとソングを切り替えることができます。
</div>
</QCardSection>
<QCardActions class="q-px-md q-py-sm">
<div class="button-group col q-px-md">
<QBtn
outline
textColor="display"
class="text-no-wrap text-h4 text-bold q-mr-sm"
@click="selectEditor('talk')"
@update:modelValue="selectEditor"
>
<label>トーク</label>
<QIcon
name="mic"
class="q-icon material-icons"
aria-hidden="true"
size="5rem"
/>
</QBtn>
<QBtn
outline
textColor="display"
class="text-no-wrap text-h4 text-bold q-mr-sm"
@click="selectEditor('song')"
@update:modelValue="selectEditor"
>
<label>ソング</label>
<QIcon
name="music_note"
class="q-icon material-icons"
aria-hidden="true"
size="5rem"
/>
</QBtn>
</div>
</QCardActions>
</QCard>
</QDialog>
</template>

<script setup lang="ts">
import { computed } from "vue";
import { QIcon } from "quasar";
import { useStore } from "@/store";
import { EditorType } from "@/type/preload";

const props = defineProps<{
modelValue: boolean;
}>();
const emit = defineEmits<{
(e: "update:modelValue", value: boolean): void;
}>();

const isInitialSettingsDialogOpenComputed = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val),
});

const store = useStore();

const selectEditor = async (editorType: EditorType) => {
await store.actions.SET_ROOT_MISC_SETTING({
key: "openedEditor",
value: editorType,
});

isInitialSettingsDialogOpenComputed.value = false;
};
</script>

<style scoped lang="scss">
@use "@/styles/colors" as colors;

.dialog-text {
text-align: center;
}

.button-group {
display: grid;
grid-auto-columns: 1fr;
grid-auto-flow: column;
gap: 1rem;
width: fit-content;
}
</style>
10 changes: 10 additions & 0 deletions src/components/Menu/MenuBar/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,16 @@ const menudata = computed<MenuItemData[]>(() => [
},
disableWhenUiLocked: false,
},
{
type: "button",
label: "初期設定ダイアログデバッグ用ボタン",
onClick() {
void store.actions.SET_DIALOG_OPEN({
isInitialSettingsDialogOpen: true,
});
},
disableWhenUiLocked: true,
},
],
},
{
Expand Down
1 change: 1 addition & 0 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,7 @@ export type DialogStates = {
isUpdateNotificationDialogOpen: boolean;
isExportSongAudioDialogOpen: boolean;
isImportSongProjectDialogOpen: boolean;
isInitialSettingsDialogOpen: boolean;
};

export type UiStoreTypes = {
Expand Down
1 change: 1 addition & 0 deletions src/store/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const uiStoreState: UiStoreState = {
isUpdateNotificationDialogOpen: false,
isExportSongAudioDialogOpen: false,
isImportSongProjectDialogOpen: false,
isInitialSettingsDialogOpen: true,
isMaximized: false,
isPinned: false,
isFullscreen: false,
Expand Down
Loading