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

vuexのstoreの呼び出しをリテラル引数からDot記法へ: components/Menu #2329

Merged
merged 3 commits into from
Oct 28, 2024
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
58 changes: 28 additions & 30 deletions src/components/Menu/MenuBar/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,62 +110,60 @@ watch(titleText, (newTitle) => {
});

const closeAllDialog = () => {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isSettingDialogOpen: false,
});
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isHelpDialogOpen: false,
});
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isHotkeySettingDialogOpen: false,
});
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isToolbarSettingDialogOpen: false,
});
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isCharacterOrderDialogOpen: false,
});
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isDefaultStyleSelectDialogOpen: false,
});
};

const openHelpDialog = () => {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isHelpDialogOpen: true,
});
};

const createNewProject = async () => {
if (!uiLocked.value) {
await store.dispatch("CREATE_NEW_PROJECT", {});
await store.actions.CREATE_NEW_PROJECT({});
}
};

const saveProject = async () => {
if (!uiLocked.value) {
await store.dispatch("SAVE_PROJECT_FILE", { overwrite: true });
await store.actions.SAVE_PROJECT_FILE({ overwrite: true });
}
};

const saveProjectAs = async () => {
if (!uiLocked.value) {
await store.dispatch("SAVE_PROJECT_FILE", {});
await store.actions.SAVE_PROJECT_FILE({});
}
};

const importProject = () => {
if (!uiLocked.value) {
void store.dispatch("LOAD_PROJECT_FILE", {});
void store.actions.LOAD_PROJECT_FILE({});
}
};

// 「最近使ったプロジェクト」のメニュー
const recentProjectsSubMenuData = ref<MenuItemData[]>([]);
const updateRecentProjects = async () => {
const recentlyUsedProjects = await store.dispatch(
"GET_RECENTLY_USED_PROJECTS",
);
const recentlyUsedProjects = await store.actions.GET_RECENTLY_USED_PROJECTS();
recentProjectsSubMenuData.value =
recentlyUsedProjects.length === 0
? [
Expand All @@ -183,7 +181,7 @@ const updateRecentProjects = async () => {
type: "button",
label: projectFilePath,
onClick: () => {
void store.dispatch("LOAD_PROJECT_FILE", {
void store.actions.LOAD_PROJECT_FILE({
filePath: projectFilePath,
});
},
Expand All @@ -206,7 +204,7 @@ const engineSubMenuData = computed<MenuItemData[]>(() => {
type: "button",
label: "再起動",
onClick: () => {
void store.dispatch("RESTART_ENGINES", {
void store.actions.RESTART_ENGINES({
engineIds: [engineInfo.uuid],
});
},
Expand All @@ -228,7 +226,7 @@ const engineSubMenuData = computed<MenuItemData[]>(() => {
type: "button",
label: "フォルダを開く",
onClick: () => {
void store.dispatch("OPEN_ENGINE_DIRECTORY", {
void store.actions.OPEN_ENGINE_DIRECTORY({
engineId: engineInfo.uuid,
});
},
Expand All @@ -238,7 +236,7 @@ const engineSubMenuData = computed<MenuItemData[]>(() => {
type: "button",
label: "再起動",
onClick: () => {
void store.dispatch("RESTART_ENGINES", {
void store.actions.RESTART_ENGINES({
engineIds: [engineInfo.uuid],
});
},
Expand All @@ -254,7 +252,7 @@ const engineSubMenuData = computed<MenuItemData[]>(() => {
type: "button",
label: "全てのエンジンを再起動",
onClick: () => {
void store.dispatch("RESTART_ENGINES", {
void store.actions.RESTART_ENGINES({
engineIds: engineIds.value,
});
},
Expand All @@ -267,7 +265,7 @@ const engineSubMenuData = computed<MenuItemData[]>(() => {
type: "button",
label: "エンジンの管理",
onClick: () => {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isEngineManageDialogOpen: true,
});
},
Expand All @@ -280,7 +278,7 @@ const engineSubMenuData = computed<MenuItemData[]>(() => {
type: "button",
label: "マルチエンジンをオンにして再読み込み",
onClick() {
void store.dispatch("RELOAD_APP", {
void store.actions.RELOAD_APP({
isMultiEngineOffMode: false,
});
},
Expand Down Expand Up @@ -355,7 +353,7 @@ const menudata = computed<MenuItemData[]>(() => [
label: "元に戻す",
onClick: async () => {
if (!uiLocked.value) {
await store.dispatch("UNDO", { editor: props.editor });
await store.actions.UNDO({ editor: props.editor });
}
},
disabled: !canUndo.value,
Expand All @@ -366,7 +364,7 @@ const menudata = computed<MenuItemData[]>(() => [
label: "やり直す",
onClick: async () => {
if (!uiLocked.value) {
await store.dispatch("REDO", { editor: props.editor });
await store.actions.REDO({ editor: props.editor });
}
},
disabled: !canRedo.value,
Expand All @@ -379,7 +377,7 @@ const menudata = computed<MenuItemData[]>(() => [
label: "すべて選択",
onClick: async () => {
if (!uiLocked.value && isMultiSelectEnabled.value) {
await store.dispatch("SET_SELECTED_AUDIO_KEYS", {
await store.actions.SET_SELECTED_AUDIO_KEYS({
audioKeys: audioKeys.value,
});
}
Expand Down Expand Up @@ -421,7 +419,7 @@ const menudata = computed<MenuItemData[]>(() => [
type: "button",
label: "キー割り当て",
onClick() {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isHotkeySettingDialogOpen: true,
});
},
Expand All @@ -431,7 +429,7 @@ const menudata = computed<MenuItemData[]>(() => [
type: "button",
label: "ツールバーのカスタマイズ",
onClick() {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isToolbarSettingDialogOpen: true,
});
},
Expand All @@ -441,7 +439,7 @@ const menudata = computed<MenuItemData[]>(() => [
type: "button",
label: "キャラクター並び替え・試聴",
onClick() {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isCharacterOrderDialogOpen: true,
});
},
Expand All @@ -451,7 +449,7 @@ const menudata = computed<MenuItemData[]>(() => [
type: "button",
label: "デフォルトスタイル",
onClick() {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isDefaultStyleSelectDialogOpen: true,
});
},
Expand All @@ -461,7 +459,7 @@ const menudata = computed<MenuItemData[]>(() => [
type: "button",
label: "読み方&アクセント辞書",
onClick() {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isDictionaryManageDialogOpen: true,
});
},
Expand All @@ -472,7 +470,7 @@ const menudata = computed<MenuItemData[]>(() => [
type: "button",
label: "オプション",
onClick() {
void store.dispatch("SET_DIALOG_OPEN", {
void store.actions.SET_DIALOG_OPEN({
isSettingDialogOpen: true,
});
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/MenuBar/MinMaxCloseButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const $q = useQuasar();
const store = useStore();

const closeWindow = async () => {
void store.dispatch("CHECK_EDITED_AND_NOT_SAVE", { closeOrReload: "close" });
void store.actions.CHECK_EDITED_AND_NOT_SAVE({ closeOrReload: "close" });
};
const minimizeWindow = () => window.backend.minimizeWindow();
const maximizeWindow = () => window.backend.maximizeWindow();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu/MenuBar/TitleBarEditorSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const openedEditor = computed(() => store.state.openedEditor);
const uiLocked = computed(() => store.getters.UI_LOCKED);

const switchEditor = async (editor: EditorType) => {
await store.dispatch("SET_OPENED_EDITOR", { editor });
await store.actions.SET_OPENED_EDITOR({ editor });
};
</script>

Expand Down
Loading