change start mode checkbox to split-button (#1550)

This commit is contained in:
pa
2025-12-29 15:08:36 +09:00
committed by Natsumi
parent 21c862a583
commit c3a0d28c93
5 changed files with 44 additions and 23 deletions
+36 -15
View File
@@ -53,12 +53,6 @@
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-checkbox
v-model="launchDialog.desktop"
style="display: inline-flex; align-items: center; margin-top: 5px"
@change="saveLaunchDialog">
{{ t('dialog.launch.start_as_desktop') }}
</el-checkbox>
<template #footer> <template #footer>
<el-button <el-button
:disabled="!checkCanInvite(launchDialog.location)" :disabled="!checkCanInvite(launchDialog.location)"
@@ -68,7 +62,7 @@
<template v-if="canOpenInstanceInGame"> <template v-if="canOpenInstanceInGame">
<el-button <el-button
:disabled="!launchDialog.secureOrShortName" :disabled="!launchDialog.secureOrShortName"
@click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)"> @click="handleLaunchGame(launchDialog.location, launchDialog.shortName, false)">
{{ t('dialog.launch.launch') }} {{ t('dialog.launch.launch') }}
</el-button> </el-button>
<el-button <el-button
@@ -80,16 +74,30 @@
</template> </template>
<template v-else> <template v-else>
<el-button <el-button
class="mr-1.25"
:disabled="!launchDialog.secureOrShortName" :disabled="!launchDialog.secureOrShortName"
@click="selfInvite(launchDialog.location, launchDialog.shortName)"> @click="selfInvite(launchDialog.location, launchDialog.shortName)">
{{ t('dialog.launch.self_invite') }} {{ t('dialog.launch.self_invite') }}
</el-button> </el-button>
<el-button <el-dropdown
split-button
type="primary" type="primary"
:disabled="!launchDialog.secureOrShortName" :disabled="!launchDialog.secureOrShortName"
@click="handleLaunchGame(launchDialog.location, launchDialog.shortName, launchDialog.desktop)"> @click="handleLaunchDefault(launchDialog.location, launchDialog.shortName)"
{{ t('dialog.launch.launch') }} @command="(cmd) => handleLaunchCommand(cmd, launchDialog.location, launchDialog.shortName)">
</el-button> {{ launchModeLabel }}
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item :command="launchDialog.desktop ? 'vr' : 'desktop'">
{{
launchDialog.desktop
? t('dialog.launch.launch')
: t('dialog.launch.start_as_desktop')
}}
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template> </template>
</template> </template>
<InviteDialog :invite-dialog="inviteDialog" @closeInviteDialog="closeInviteDialog" /> <InviteDialog :invite-dialog="inviteDialog" @closeInviteDialog="closeInviteDialog" />
@@ -118,9 +126,13 @@
const { launchGame, tryOpenInstanceInVrc } = useLaunchStore(); const { launchGame, tryOpenInstanceInVrc } = useLaunchStore();
const { launchDialogData } = storeToRefs(useLaunchStore()); const { launchDialogData } = storeToRefs(useLaunchStore());
const { canOpenInstanceInGame } = useInviteStore(); const { canOpenInstanceInGame } = storeToRefs(useInviteStore());
const { isGameRunning } = storeToRefs(useGameStore()); const { isGameRunning } = storeToRefs(useGameStore());
const launchModeLabel = computed(() =>
launchDialog.value.desktop ? t('dialog.launch.start_as_desktop') : t('dialog.launch.launch')
);
const launchDialogIndex = ref(2000); const launchDialogIndex = ref(2000);
const launchDialog = ref({ const launchDialog = ref({
@@ -212,6 +224,17 @@
launchGame(location, shortName, desktop); launchGame(location, shortName, desktop);
isVisible.value = false; isVisible.value = false;
} }
function handleLaunchDefault(location, shortName) {
handleLaunchGame(location, shortName, launchDialog.value.desktop);
}
function handleLaunchCommand(command, location, shortName) {
const desktop = command === 'desktop';
launchDialog.value.desktop = desktop;
configRepository.setBool('launchAsDesktop', desktop);
handleLaunchGame(location, shortName, desktop);
}
function handleAttachGame(location, shortName) { function handleAttachGame(location, shortName) {
tryOpenInstanceInVrc(location, shortName); tryOpenInstanceInVrc(location, shortName);
isVisible.value = false; isVisible.value = false;
@@ -235,12 +258,10 @@
return args; return args;
}); });
} }
function getConfig() { function getConfig() {
configRepository.getBool('launchAsDesktop').then((value) => (launchDialog.value.desktop = value)); configRepository.getBool('launchAsDesktop').then((value) => (launchDialog.value.desktop = value));
} }
function saveLaunchDialog() {
configRepository.setBool('launchAsDesktop', launchDialog.value.desktop);
}
async function initLaunchDialog() { async function initLaunchDialog() {
const { tag, shortName } = launchDialogData.value; const { tag, shortName } = launchDialogData.value;
if (!isRealInstance(tag)) { if (!isRealInstance(tag)) {
+2 -2
View File
@@ -1526,9 +1526,9 @@
"short_url_notice": "Short URL's expire after a set period of time", "short_url_notice": "Short URL's expire after a set period of time",
"location": "Location", "location": "Location",
"copy_tooltip": "Copy to clipboard", "copy_tooltip": "Copy to clipboard",
"start_as_desktop": "Start as Desktop (No VR)", "start_as_desktop": "Launch (Desktop)",
"invite": "Invite", "invite": "Invite",
"launch": "Launch", "launch": "Launch (VR)",
"open_ingame": "Open in-game", "open_ingame": "Open in-game",
"self_invite": "Self invite", "self_invite": "Self invite",
"game_running_warning": "Are you sure you want to launch a second VRChat instance?", "game_running_warning": "Are you sure you want to launch a second VRChat instance?",
+2 -2
View File
@@ -1381,9 +1381,9 @@
"short_url_notice": "短縮URLは一定時間後に失効します。", "short_url_notice": "短縮URLは一定時間後に失効します。",
"location": "場所", "location": "場所",
"copy_tooltip": "クリップボードにコピー", "copy_tooltip": "クリップボードにコピー",
"start_as_desktop": "デスクトップモードで起動 (VR無し)", "start_as_desktop": "起動(デスクトップモード",
"invite": "招待", "invite": "招待",
"launch": "起動", "launch": "起動VRモード)",
"open_ingame": "ゲーム内で開く", "open_ingame": "ゲーム内で開く",
"self_invite": "自分を招待", "self_invite": "自分を招待",
"game_running_warning": "本当に2つ目のVRChatインスタンスを起動しますか?", "game_running_warning": "本当に2つ目のVRChatインスタンスを起動しますか?",
+2 -2
View File
@@ -1482,9 +1482,9 @@
"short_url_notice": "短链接会在一段时间后过期", "short_url_notice": "短链接会在一段时间后过期",
"location": "地点", "location": "地点",
"copy_tooltip": "复制到剪贴板", "copy_tooltip": "复制到剪贴板",
"start_as_desktop": "桌面模式启动游戏(不使用 VR", "start_as_desktop": "启动(桌面模式)",
"invite": "邀请", "invite": "邀请",
"launch": "启动", "launch": "启动VR模式)",
"open_ingame": "在 VRChat 中打开", "open_ingame": "在 VRChat 中打开",
"self_invite": "自我邀请", "self_invite": "自我邀请",
"game_running_warning": "你确定要启动另一个 VRChat 客户端吗?", "game_running_warning": "你确定要启动另一个 VRChat 客户端吗?",
+2 -2
View File
@@ -1467,9 +1467,9 @@
"short_url_notice": "短網址會在一段時間後過期", "short_url_notice": "短網址會在一段時間後過期",
"location": "地點", "location": "地點",
"copy_tooltip": "複製到剪貼簿", "copy_tooltip": "複製到剪貼簿",
"start_as_desktop": "桌面模式啟動(無 VR", "start_as_desktop": "啟動(桌面模式)",
"invite": "邀請", "invite": "邀請",
"launch": "啟動", "launch": "啟動VR模式)",
"open_ingame": "於遊戲中開啟", "open_ingame": "於遊戲中開啟",
"self_invite": "自我邀請", "self_invite": "自我邀請",
"game_running_warning": "你確定要啟動第二個 VRChat 房間嗎?", "game_running_warning": "你確定要啟動第二個 VRChat 房間嗎?",