From e249d847e497eca9f69e73849923711d33c0b454 Mon Sep 17 00:00:00 2001 From: viarotel Date: Wed, 1 Nov 2023 11:09:34 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=F0=9F=8E=89=20Add=20OTG=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/languages/en_US.json | 10 ++++++++ src/locales/languages/zh_CN.json | 10 ++++++++ src/store/preference/model/index.js | 3 ++- src/store/preference/model/otg/index.js | 31 +++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/store/preference/model/otg/index.js diff --git a/src/locales/languages/en_US.json b/src/locales/languages/en_US.json index 8ff8aac1..b4cd4ab2 100644 --- a/src/locales/languages/en_US.json +++ b/src/locales/languages/en_US.json @@ -187,6 +187,16 @@ "preferences.audio.audio-output-buffer.placeholder": "Default 5ms", "preferences.audio.disable.name": "Disable Audio", "preferences.audio.disable.placeholder": "Disable audio stream", + "preferences.otg.name": "OTG", + "preferences.otg.enable.name": "Enable OTG", + "preferences.otg.enable.placeholder": "Turn on or off OTG", + "preferences.otg.enable.tips": "Enabling this will allow mouse and keyboard when connected via OTG", + "preferences.otg.hid-keyboard.name": "Use Keyboard", + "preferences.otg.hid-keyboard.placeholder": "Turn on or off keyboard OTG", + "preferences.otg.hid-keyboard.tips": "Enabling this option alone will disable mouse OTG, which can be enabled at the same time as the mouse option", + "preferences.otg.hid-mouse.name": "Use Mouse", + "preferences.otg.hid-mouse.placeholder": "Turn on or off mouse OTG", + "preferences.otg.hid-mouse.tips": "Enabling this option alone will disable keyboard OTG, which can be enabled at the same time as the keyboard option", "about.name": "About", "about.description": "📱 Graphical Scrcpy to display and control Android, devices powered by Electron.", "about.update": "Check for Updates", diff --git a/src/locales/languages/zh_CN.json b/src/locales/languages/zh_CN.json index dae615d8..30da2c59 100644 --- a/src/locales/languages/zh_CN.json +++ b/src/locales/languages/zh_CN.json @@ -187,6 +187,16 @@ "preferences.audio.audio-output-buffer.placeholder": "默认值为 5ms", "preferences.audio.disable.name": "禁用音频", "preferences.audio.disable.placeholder": "开启后将禁用音频功能", + "preferences.otg.name": "OTG 控制", + "preferences.otg.enable.name": "启用 OTG", + "preferences.otg.enable.placeholder": "开启或关闭 OTG 功能", + "preferences.otg.enable.tips": "开启后可以使用物理键盘和鼠标控制安卓设备,注意:仅启用该选项将同时启用鼠标和键盘 OTG 功能", + "preferences.otg.hid-keyboard.name": "启用键盘", + "preferences.otg.hid-keyboard.placeholder": "开启或关闭键盘的 OTG 功能", + "preferences.otg.hid-keyboard.tips": "注意:仅启用该选项将禁用鼠标的 OTG 功能,它可以和启用鼠标选项同时开启", + "preferences.otg.hid-mouse.name": "启用鼠标", + "preferences.otg.hid-mouse.placeholder": "开启或关闭鼠标的 OTG 功能", + "preferences.otg.hid-mouse.tips": "注意:仅启用该选项将禁用键盘的 OTG 功能,它可以和启用键盘选项同时开启", "about.name": "关于", "about.description": "📱 使用图形化的 Scrcpy 显示和控制您的 Android 设备,由 Electron 驱动", "about.update": "检查并更新", diff --git a/src/store/preference/model/index.js b/src/store/preference/model/index.js index 8f30ff05..76ef9a0a 100644 --- a/src/store/preference/model/index.js +++ b/src/store/preference/model/index.js @@ -4,5 +4,6 @@ import device from './device/index.js' import window from './window/index.js' import audio from './audio/index.js' import record from './record/index.js' +import otg from './otg/index.js' -export default { common, video, device, window, audio, record } +export default { common, video, device, window, audio, record, otg } diff --git a/src/store/preference/model/otg/index.js b/src/store/preference/model/otg/index.js new file mode 100644 index 00000000..3524eb69 --- /dev/null +++ b/src/store/preference/model/otg/index.js @@ -0,0 +1,31 @@ +export default { + label: 'preferences.otg.name', + field: 'scrcpy', + + children: { + otg: { + label: 'preferences.otg.enable.name', + field: '--otg', + type: 'Switch', + value: null, + placeholder: 'preferences.otg.enable.placeholder', + tips: 'preferences.otg.enable.tips', + }, + hidKeyboard: { + label: 'preferences.otg.hid-keyboard.name', + field: '--hid-keyboard', + type: 'Switch', + value: null, + placeholder: 'preferences.otg.hid-keyboard.placeholder', + tips: 'preferences.otg.hid-keyboard.tips', + }, + hidMouse: { + label: 'preferences.otg.hid-mouse.name', + field: '--hid-mouse', + type: 'Switch', + value: null, + placeholder: 'preferences.otg.hid-mouse.placeholder', + tips: 'preferences.otg.hid-mouse.tips', + }, + }, +}