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

フルスクリーンモードを追加(#2251) #2273

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ export const api: Sandbox = {
maximizeWindow() {
throw new Error(`Not supported on Browser version: maximizeWindow`);
},
toggleFullScreenMode() {
throw new Error(`Not supported on Browser version: toggleFullScreenMode`);
},
/* eslint-disable no-console */ // ログの吐き出し先は console ぐらいしかないので、ここでは特例で許可している
logError(...params: unknown[]) {
console.error(...params);
Expand Down
8 changes: 7 additions & 1 deletion src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,13 @@ registerIpcMainHandle<IpcMainHandle>({
win.maximize();
}
},

TOGGLE_FULLSCREENMODE: () => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TOGGLE_FULLSCREENMODE: () => {
TOGGLE_FULLSCREEN: () => {

の方がいいかも?(これを変えるなら他のところも変える必要があるはず)

Copy link
Member

Choose a reason for hiding this comment

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

たしかにFULLSCREENMODE一単語はほんのちょっぴり違和感あるかもですね!
TOGGLE_FULLSCREEN_MODEという手もありそう。

if (win.isFullScreen()) {
win.setFullScreen(false);
} else {
win.setFullScreen(true);
}
},
OPEN_LOG_DIRECTORY: () => {
void shell.openPath(app.getPath("logs"));
},
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.MAXIMIZE_WINDOW();
},

toggleFullScreenMode: () => {
void ipcRendererInvokeProxy.TOGGLE_FULLSCREENMODE();
},

logError: (...params) => {
console.error(...params);
// 経緯 https://github.com/VOICEVOX/voicevox/pull/1620#discussion_r1371804569
Expand Down
19 changes: 18 additions & 1 deletion src/components/Menu/MenuBar/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ const openHelpDialog = () => {
});
};

const toggleFullScreenMode = async () => {
window.backend.toggleFullScreenMode();
};

const createNewProject = async () => {
if (!uiLocked.value) {
await store.dispatch("CREATE_NEW_PROJECT", {});
Expand Down Expand Up @@ -396,7 +400,16 @@ const menudata = computed<MenuItemData[]>(() => [
closeAllDialog();
},
disableWhenUiLocked: false,
subMenu: [...props.viewSubMenuData],
subMenu: [
...props.viewSubMenuData,
{ type: "separator" },
Copy link
Member

Choose a reason for hiding this comment

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

(細かいですが)トークエディタだと一番上にseparatorが来そう?

Copy link
Member

Choose a reason for hiding this comment

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

ほんとですね!! ちょっと見た目変になりそう。
残しといていただいたら後でちょっとこちらで調整させていただきます! 🙏

Copy link
Author

Choose a reason for hiding this comment

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

コメントありがとうございます!
@Hiroshiba
個人的な感想として、フルスクリーンモード切替ボタンと他のボタンをセパレーターで区切る意味はそんなにないかなと思います。このPRにおいては、セパレーターを消す方向で修正進めてもいいでしょうか?(一旦残して後から修正入れていただく方向でも大丈夫です!)

Copy link
Member

Choose a reason for hiding this comment

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

大丈夫だと思います。

Copy link
Member

Choose a reason for hiding this comment

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

たしかに、一旦なしがとりあえずで一番良さそう!ご提案ありがとうございます!

{
type: "button",
label: "全画面表示/ウィンドウ表示切り替え",
onClick: toggleFullScreenMode,
disableWhenUiLocked: false,
},
],
},
{
type: "root",
Expand Down Expand Up @@ -527,6 +540,10 @@ function registerHotkeyForAllEditors(action: Omit<HotkeyAction, "editor">) {
});
}

registerHotkeyForAllEditors({
callback: toggleFullScreenMode,
name: "全画面表示/ウィンドウ表示切り替え",
});
registerHotkeyForAllEditors({
callback: createNewProject,
name: "新規プロジェクト",
Expand Down
5 changes: 5 additions & 0 deletions src/type/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ export type IpcIHData = {
return: void;
};

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

OPEN_LOG_DIRECTORY: {
args: [];
return: void;
Expand Down
6 changes: 6 additions & 0 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ export const defaultHotkeySettings: HotkeySettingType[] = [
action: "新規プロジェクト",
combination: HotkeyCombination(!isMac ? "Ctrl N" : "Meta N"),
},
{
action: "全画面表示/ウィンドウ表示切り替え",
combination: HotkeyCombination(!isMac ? "F11" : "Ctrl Meta F"),
},
{
action: "プロジェクトを名前を付けて保存",
combination: HotkeyCombination(!isMac ? "Ctrl Shift S" : "Shift Meta S"),
Expand Down Expand Up @@ -273,6 +277,7 @@ export interface Sandbox {
closeWindow(): void;
minimizeWindow(): void;
maximizeWindow(): void;
toggleFullScreenMode(): void;
logError(...params: unknown[]): void;
logWarn(...params: unknown[]): void;
logInfo(...params: unknown[]): void;
Expand Down Expand Up @@ -466,6 +471,7 @@ export const hotkeyActionNameSchema = z.enum([
"元に戻す",
"やり直す",
"新規プロジェクト",
"全画面表示/ウィンドウ表示切り替え",
Copy link
Member

Choose a reason for hiding this comment

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

丁寧な表記いいですね!
ちょっと長いのでこうしちゃうのどうでしょ!

Suggested change
"全画面表示/ウィンドウ表示切り替え",
"全画面表示の切り替え",

(slackが「フルスクリーン表示の切り替え」だったので真似してみました)

"プロジェクトを名前を付けて保存",
"プロジェクトを上書き保存",
"プロジェクトを読み込む",
Expand Down
Loading