perf: ️ Supports adjusting the closing method of the application in preferences

This commit is contained in:
viarotel 2024-12-06 16:40:22 +08:00
parent 6a8c19099d
commit e643f8e2d7
7 changed files with 80 additions and 64 deletions

View File

@ -72,7 +72,7 @@ export default (mainWindow) => {
},
},
{
label: await t('close.quit'),
label: await t('appClose.quit'),
click: () => {
quitApp()
},
@ -95,30 +95,23 @@ export default (mainWindow) => {
event.preventDefault()
const appCloseCode = appStore.get('appCloseCode')
let appCloseCode = appStore.get('common.appCloseCode')
if (typeof appCloseCode === 'number') {
closeApp(appCloseCode)
return true
}
const { response, checkboxChecked } = await dialog.showMessageBox({
if (![0, 1].includes(appCloseCode)) {
const { response } = await dialog.showMessageBox({
type: 'question',
buttons: [
await t('close.quit'),
await t('close.minimize'),
await t('close.quit.cancel'),
await t('appClose.quit'),
await t('appClose.minimize'),
await t('appClose.quit.cancel'),
],
title: await t('common.tips'),
message: await t('close.message'),
checkboxChecked: false,
checkboxLabel: await t('close.remember'),
message: await t('appClose.message'),
})
if (checkboxChecked && [0, 1].includes(response)) {
appStore.set('appCloseCode', response)
appCloseCode = response
}
closeApp(response)
closeApp(appCloseCode)
})
}

View File

@ -44,11 +44,13 @@
"time.unit.second": "second",
"time.unit.millisecond": "millisecond",
"close.quit": "Quit",
"close.quit.cancel": "Cancel quit",
"close.minimize": "Minimize to tray",
"close.message": "Are you sure you want to quit?",
"close.remember": "Remember this choice?",
"appClose.name": "Close Main Panel",
"appClose.question": "Ask Every Time",
"appClose.minimize": "Minimize to Tray",
"appClose.quit": "Exit Directly",
"appClose.quit.cancel": "Cancel Exit",
"appClose.message": "Are you sure you want to exit?",
"appClose.remember": "Remember the Choice?",
"dependencies.lack.title": "Notice",
"dependencies.lack.content": "This software relies on {name}. Please ensure that the mentioned dependencies are correctly installed, or manually configure the location of the dependencies in the preferences.",
@ -189,7 +191,7 @@
"device.control.mirror-group.tips": "When enabled, can mirror multiple simulated secondary displays and achieve multi-screen collaboration by operating each mirrored window. Note this requires ROM support and desktop mode enabled.",
"device.control.mirror-group.open": "Open {num} windows",
"device.control.mirror-group.close": "Close auxiliary display devices",
"device.control.mirror-group.close.tips": "Used to solve the issue of automatic closure failure after certain devices exit all control windows.",
"device.control.mirror-group.appClose.tips": "Used to solve the issue of automatic closure failure after certain devices exit all control windows.",
"device.control.volume.name": "Volume",
"device.control.volume-up.name": "Volume Up",
"device.control.volume-down.name": "Volume Down",

View File

@ -44,11 +44,13 @@
"time.unit.second": "секунда",
"time.unit.millisecond": "миллисекунда",
"close.quit": "Выйти",
"close.quit.cancel": "Отменить выход",
"close.minimize": "Свернуть в трей",
"close.message": "Вы уверены, что хотите выйти?",
"close.remember": "Запомнить этот выбор?",
"appClose.name": "Закрыть главную панель",
"appClose.question": "Спрашивать каждый раз",
"appClose.minimize": "Свернуть в трей",
"appClose.quit": "Выйти сразу",
"appClose.quit.cancel": "Отменить выход",
"appClose.message": "Вы уверены, что хотите выйти?",
"appClose.remember": "Запомнить выбор?",
"dependencies.lack.title": "Уведомление",
"dependencies.lack.content": "Это программное обеспечение зависит от {name}. Пожалуйста, убедитесь, что указанные зависимости правильно установлены, или вручную настройте расположение зависимостей в настройках.",
@ -189,7 +191,7 @@
"device.control.mirror-group.tips": "При включении можно отображать несколько эмулируемых вторичных дисплеев и осуществлять многопоточную работу, управляя каждым окном зеркалирования. Обратите внимание, что для этого требуется поддержка ROM и включенный режим рабочего стола.",
"device.control.mirror-group.open": "Открыть {num} окон",
"device.control.mirror-group.close": "Закрыть вспомогательные дисплеи",
"device.control.mirror-group.close.tips": "Используется для решения проблемы автоматического закрытия после того, как некоторые устройства выходят из всех окон управления.",
"device.control.mirror-group.appClose.tips": "Используется для решения проблемы автоматического закрытия после того, как некоторые устройства выходят из всех окон управления.",
"device.control.volume.name": "Громкость",
"device.control.volume-up.name": "Увеличить громкость",
"device.control.volume-down.name": "Уменьшить громкость",

View File

@ -44,11 +44,13 @@
"time.unit.second": "秒",
"time.unit.millisecond": "毫秒",
"close.quit": "退出",
"close.quit.cancel": "取消退出",
"close.minimize": "最小化到托盘",
"close.message": "确定要退出吗?",
"close.remember": "是否记住选择?",
"appClose.name": "关闭主面板",
"appClose.question": "每次询问",
"appClose.minimize": "最小化到托盘",
"appClose.quit": "直接退出",
"appClose.quit.cancel": "取消退出",
"appClose.message": "确定要退出吗?",
"appClose.remember": "是否记住选择?",
"dependencies.lack.title": "注意事项",
"dependencies.lack.content": "此软件依赖于{name}。请确保正确安装了上述依赖项,或手动配置偏好设置中依赖项的位置",
@ -189,7 +191,7 @@
"device.control.mirror-group.tips": "开启后,可以同时镜像多个模拟辅助显示设备,并通过操作各个镜像窗口实现多屏协同功能。请注意,此功能需要手机 ROM 支持,并且必须开启强制使用桌面模式选项。",
"device.control.mirror-group.open": "开启 {num} 个窗口",
"device.control.mirror-group.close": "关闭辅助显示设备",
"device.control.mirror-group.close.tips": "用于解决某些机型退出所有控制窗口后自动关闭失败的问题",
"device.control.mirror-group.appClose.tips": "用于解决某些机型退出所有控制窗口后自动关闭失败的问题",
"device.control.volume.name": "音量控制",
"device.control.volume-up.name": "增加音量",
"device.control.volume-down.name": "减小音量",

View File

@ -44,11 +44,13 @@
"time.unit.second": "秒",
"time.unit.millisecond": "毫秒",
"close.quit": "結束",
"close.quit.cancel": "取消結束",
"close.minimize": "最小化至系統工具列",
"close.message": "確定要結束嗎?",
"close.remember": "記住此選擇?",
"appClose.name": "關閉主面板",
"appClose.question": "每次詢問",
"appClose.minimize": "最小化到托盤",
"appClose.quit": "直接退出",
"appClose.quit.cancel": "取消退出",
"appClose.message": "確定要退出嗎?",
"appClose.remember": "是否記住選擇?",
"dependencies.lack.title": "注意事項",
"dependencies.lack.content": "此軟體需要 {name} 來運作。請確保已正確安裝所需的工具,或在偏好設定中手動設定工具的位置。",
@ -189,7 +191,7 @@
"device.control.mirror-group.tips": "開啟後,可以同時鏡像多個模擬輔助顯示裝置,並透過操作各個鏡像視窗實現多螢幕協同功能。請注意,此功能需要手機 ROM 支援,並且必須開啟強制使用桌面模式選項。",
"device.control.mirror-group.open": "開啟 {num} 個視窗",
"device.control.mirror-group.close": "關閉輔助顯示裝置",
"device.control.mirror-group.close.tips": "用於解決某些機型關閉所有控制視窗後自動關閉失敗的問題",
"device.control.mirror-group.appClose.tips": "用於解決某些機型關閉所有控制視窗後自動關閉失敗的問題",
"device.control.volume.name": "音量控制",
"device.control.volume-up.name": "增加音量",
"device.control.volume-down.name": "減小音量",

View File

@ -169,12 +169,6 @@ export default {
handleSave() {
this.preferenceStore.setData(this.preferenceData)
this.$message({
message: this.$t('preferences.config.save.placeholder'),
type: 'success',
grouping: true,
})
},
},
}

View File

@ -57,6 +57,27 @@ export default {
},
],
},
appCloseCode: {
label: 'appClose.name',
field: 'appCloseCode',
type: 'Select',
value: window.appStore.get('common.appCloseCode') ?? -1,
placeholder: 'common.select.please',
options: [
{
label: 'appClose.question',
value: -1,
},
{
label: 'appClose.quit',
value: 0,
},
{
label: 'appClose.minimize',
value: 1,
},
],
},
savePath: {
label: 'preferences.common.file.name',
field: 'savePath',
@ -76,16 +97,6 @@ export default {
properties: ['openFile'],
filters: [{ name: 'preferences.common.adb.name', extensions: ['*'] }],
},
scrcpyPath: {
label: 'preferences.common.scrcpy.name',
field: 'scrcpyPath',
value: scrcpyPath,
type: 'PathInput',
placeholder: 'preferences.common.scrcpy.placeholder',
tips: 'preferences.common.scrcpy.tips',
properties: ['openFile'],
filters: [{ name: 'preferences.common.scrcpy.name', extensions: ['*'] }],
},
gnirehtetPath: {
label: 'preferences.common.gnirehtet.name',
field: 'gnirehtetPath',
@ -98,6 +109,16 @@ export default {
{ name: 'preferences.common.gnirehtet.name', extensions: ['*'] },
],
},
scrcpyPath: {
label: 'preferences.common.scrcpy.name',
field: 'scrcpyPath',
value: scrcpyPath,
type: 'PathInput',
placeholder: 'preferences.common.scrcpy.placeholder',
tips: 'preferences.common.scrcpy.tips',
properties: ['openFile'],
filters: [{ name: 'preferences.common.scrcpy.name', extensions: ['*'] }],
},
scrcpyAppend: {
label: 'preferences.common.scrcpy.append.name',
field: 'scrcpyAppend',
@ -105,11 +126,11 @@ export default {
type: 'Input',
placeholder: 'preferences.common.scrcpy.append.placeholder',
tips: 'preferences.common.scrcpy.append.tips',
span: 24,
props: {
type: 'textarea',
rows: 4,
},
span: 24,
},
autoConnect: {
label: 'preferences.common.auto-connect.name',