diff --git a/README-CN.md b/README-CN.md
index 5d0558e..a1363f7 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -143,9 +143,11 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设
9. 支持国际化 ✅
10. 对深色模式的支持 ✅
11. 添加 Gnirehtet 反向供网功能 ✅
-12. 添加 Scrcpy 快捷键查询页面 🚧
-13. 添加新的相机镜像相关功能 🚧
-14. 添加对游戏的增强功能,如游戏键位映射 🚧
+12. 添加新的实现镜像相关功能 ✅
+13. 添加独立的剪切板同步功能 🚧
+14. 更好的多屏协同 🚧
+15. 添加 Scrcpy 快捷键查询页面 🚧
+16. 添加对游戏的增强功能,如游戏键位映射 🚧
## 常见问题
diff --git a/README.md b/README.md
index af785b3..c15790a 100644
--- a/README.md
+++ b/README.md
@@ -141,9 +141,11 @@ Refer to [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master
9. Support internationalization ✅
10. Support for dark mode ✅
11. Add Gnirehtet reverse network function ✅
-12. Add Scrcpy shortcut key query page 🚧
-13. Add new camera mirror related features 🚧"
-14. Add game enhancement features such as game keyboard mapping 🚧
+12. Add new camera mirror related features ✅
+13. Add an clipboard synchronization function 🚧
+14. Better multi -screen collaboration 🚧
+15. Add Scrcpy shortcut key query page 🚧
+16. Add game enhancement features such as game keyboard mapping 🚧
## FAQ
diff --git a/src/components/Preference/components/CameraSwitch/index.vue b/src/components/Preference/components/CameraSwitch/index.vue
new file mode 100644
index 0000000..0804bcf
--- /dev/null
+++ b/src/components/Preference/components/CameraSwitch/index.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
diff --git a/src/components/Preference/composables/otg/index.js b/src/components/Preference/composables/otg/index.js
index 43d3f7b..dca8938 100644
--- a/src/components/Preference/composables/otg/index.js
+++ b/src/components/Preference/composables/otg/index.js
@@ -1,22 +1,6 @@
import { watchEffect } from 'vue'
export function useOtg(data) {
- watchEffect(() => {
- if (data.value['--hid-keyboard'] || data.value['--hid-mouse']) {
- data.value['--otg'] = true
- }
- else {
- data.value['--otg'] = false
- }
- })
-
- watchEffect(() => {
- if (!data.value['--otg']) {
- data.value['--hid-keyboard'] = false
- data.value['--hid-mouse'] = false
- }
- })
-
watchEffect(() => {
if (data.value['--hid-keyboard']) {
data.value['--hid-mouse'] = false
diff --git a/src/components/Preference/index.vue b/src/components/Preference/index.vue
index 03dbfad..001a47e 100644
--- a/src/components/Preference/index.vue
+++ b/src/components/Preference/index.vue
@@ -199,6 +199,7 @@ import PathInput from './components/PathInput/index.vue'
import VideoCodecSelect from './components/VideoCodecSelect/index.vue'
import AudioCodecSelect from './components/AudioCodecSelect/index.vue'
import DisplaySelect from './components/DisplaySelect/index.vue'
+import CameraSwitch from './components/CameraSwitch/index.vue'
import LoadingIcon from '@/components/Device/components/LoadingIcon/index.vue'
import { usePreferenceStore } from '@/store/index.js'
@@ -209,6 +210,7 @@ export default {
VideoCodecSelect,
AudioCodecSelect,
DisplaySelect,
+ CameraSwitch,
},
setup() {
const preferenceStore = usePreferenceStore()
diff --git a/src/locales/languages/en_US.json b/src/locales/languages/en_US.json
index b6531ba..2225845 100644
--- a/src/locales/languages/en_US.json
+++ b/src/locales/languages/en_US.json
@@ -1,6 +1,7 @@
{
"zh_CN": "中文",
"en_US": "English",
+
"common.cancel": "Cancel",
"common.confirm": "Confirm",
"common.restart": "Restart",
@@ -8,11 +9,13 @@
"common.tips": "Tips",
"common.open": "Open",
"common.input.placeholder": "Please input",
+
"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?",
+
"device.list": "Devices",
"device.list.loading": "Loading...",
"device.list.empty": "No devices detected",
@@ -20,6 +23,7 @@
"device.name": "Device Name",
"device.remark": "Remark",
"device.permission.error": "Device permission error, please reconnect device and allow USB debugging",
+
"device.wireless.name": "Wireless",
"device.wireless.mode": "Wireless Mode",
"device.wireless.mode.error": "Do not get the local area network connection address, please check the network",
@@ -50,21 +54,25 @@
"device.wireless.pair.code": "Pair Code",
"device.wireless.pair.code.message": "Pair code cannot be empty",
"device.wireless.pair.code.placeholder": "Input pair code",
+
"device.reset.title": "Operation Failed",
"device.reset.reasons[0]": "This is usually caused by incompatible cached dependencies after updating Escrcpy. Reset dependencies?",
"device.reset.reasons[1]": "Note: Dependencies will be cleared after reset, please backup first.",
"device.reset.confirm": "Reset Dependencies",
"device.reset.cancel": "@:common.cancel",
"device.reset.success": "Success, please try again",
+
"device.refresh.name": "Refresh",
"device.restart.name": "Restart",
"device.log.name": "Logs",
"device.mirror.start": "Mirror",
"device.mirror.progress": "Mirroring",
+
"device.record.start": "Record",
"device.record.progress": "Recording",
"device.record.success.title": "Record Success",
"device.record.success.message": "Open record location?",
+
"device.control.name": "Control",
"device.control.more": "More Controls",
"device.control.install": "Install App",
@@ -89,6 +97,7 @@
"device.control.gnirehtet.tips": "Gnirehtet provides reverse tethering for Android; Note: Initial connection requires authorization on the device.",
"device.control.gnirehtet.progress": "Starting Gnirehtet reverse tethering service...",
"device.control.gnirehtet.success": "Gnirehtet reverse tethering feature started successfully",
+
"preferences.name": "Preferences",
"preferences.reset": "Reset to Default",
"preferences.scope.global": "Global",
@@ -107,6 +116,7 @@
"preferences.config.edit.name": "Edit",
"preferences.config.reset.name": "Reset",
"preferences.config.save.placeholder": "Config saved",
+
"preferences.common.name": "Common",
"preferences.common.theme.name": "Theme",
"preferences.common.theme.placeholder": "Set theme",
@@ -125,6 +135,9 @@
"preferences.common.scrcpy.name": "Scrcpy Path",
"preferences.common.scrcpy.placeholder": "Set scrcpy path",
"preferences.common.scrcpy.tips": "scrcpy path to connect device",
+ "preferences.common.scrcpy.append.name": "Scrcpy Arguments",
+ "preferences.common.scrcpy.append.placeholder": "Append additional arguments to the scrcpy command",
+ "preferences.common.scrcpy.append.tips": "Note: The entered arguments will be directly appended to the scrcpy command without filtering duplicate arguments.",
"preferences.common.gnirehtet.name": "Gnirehtet Path",
"preferences.common.gnirehtet.placeholder": "Set gnirehtet path",
"preferences.common.gnirehtet.tips": "The path for gnirehtet used to provide reverse tethering for devices.",
@@ -135,7 +148,12 @@
"preferences.common.language.placeholder": "Select language",
"preferences.common.language.chinese": "中文",
"preferences.common.language.english": "English",
+
"preferences.video.name": "Video",
+ "preferences.video.video-source.name": "Video Source",
+ "preferences.video.video-source.placeholder": "Defaults to device display",
+ "preferences.video.video-source.display": "Display",
+ "preferences.video.video-source.camera": "Camera",
"preferences.video.resolution.name": "Resolution",
"preferences.video.resolution.placeholder": "Default is device resolution e.g. 1920",
"preferences.video.bit.name": "Video Bit Rate",
@@ -148,12 +166,13 @@
"preferences.video.screen-rotation.placeholder": "Default device rotation",
"preferences.video.screen-cropping.name": "Crop",
"preferences.video.screen-cropping.placeholder": "Default no crop, format is 1224:1440:0:0",
- "preferences.video.multi-display.name": "Display",
- "preferences.video.multi-display.placeholder": "Default 0 (main display)",
+ "preferences.video.display.name": "Display",
+ "preferences.video.display.placeholder": "Default 0 (main display)",
"preferences.video.video-buffer.name": "Video Buffer",
"preferences.video.video-buffer.placeholder": "Default 0ms",
"preferences.video.receiver-buffer.name": "Receiver Buffer (v412)",
"preferences.video.receiver-buffer.placeholder": "Default 0ms",
+
"preferences.device.name": "Device",
"preferences.device.show-touch.name": "Show Touches",
"preferences.device.show-touch.placeholder": "Enable touch feedback dots",
@@ -168,6 +187,7 @@
"preferences.device.control-in-stop-charging.name": "Stop Charging",
"preferences.device.control-in-stop-charging.placeholder": "Stop charging when controlling",
"preferences.device.control-in-stop-charging.tips": "May not work on some models",
+
"preferences.window.name": "Window",
"preferences.window.borderless.name": "Borderless",
"preferences.window.borderless.placeholder": "Borderless control window",
@@ -177,6 +197,7 @@
"preferences.window.always-top.placeholder": "Keep control window topmost",
"preferences.window.disable-screen-saver.name": "Disable Screensaver",
"preferences.window.disable-screen-saver.placeholder": "Disable computer screensaver",
+
"preferences.record.name": "Recording",
"preferences.record.format.name": "Format",
"preferences.record.time-limit.name": "Recording Time Limit",
@@ -184,20 +205,22 @@
"preferences.record.format.placeholder": "Default *.mp4",
"preferences.record.lock-video-orientation.name": "Video Direction",
"preferences.record.lock-video-orientation.placeholder": "Default Device Orientation",
- "preferences.record.disable-video.name": "Disable video recording",
+ "preferences.record.disable-video.name": "Disable Video Recording",
"preferences.record.disable-video.placeholder": "Video recording will be disabled when enabled",
- "preferences.record.disable-audio.name": "Disable audio recording",
+ "preferences.record.disable-audio.name": "Disable Audio Recording",
"preferences.record.disable-audio.placeholder": "Audio recording will be disabled when enabled",
- "preferences.record.no-video-playback.name": "Disable video playback",
+ "preferences.record.no-video-playback.name": "Disable Video Playback",
"preferences.record.no-video-playback.placeholder": "Video playback will be disabled during recording when enabled",
"preferences.record.no-video-playback.tips": "Note: Video will still be recorded, just playback disabled",
- "preferences.record.no-audio-playback.name": "Disable audio playback",
+ "preferences.record.no-audio-playback.name": "Disable Audio Playback",
"preferences.record.no-audio-playback.placeholder": "Audio playback will be disabled during recording when enabled",
"preferences.record.no-audio-playback.tips": "Note: Audio will still be recorded, just playback disabled",
+
"preferences.audio.name": "Audio",
"preferences.audio.audio-source.name": "Audio Source",
"preferences.audio.audio-source.placeholder": "Default Device Audio Output",
"preferences.audio.audio-source.tips": "Tip: Selecting 'Microphone' as the source will allow you to record audio.",
+ "preferences.audio.audio-source.output": "Output",
"preferences.audio.audio-source.mic": "Microphone",
"preferences.audio.audio-code.name": "Audio Codec",
"preferences.audio.audio-code.placeholder": "Default Opus",
@@ -208,16 +231,34 @@
"preferences.audio.audio-buffer.placeholder": "Default 0ms",
"preferences.audio.audio-output-buffer.name": "Audio Output Buffer",
"preferences.audio.audio-output-buffer.placeholder": "Default 5ms",
+
"preferences.otg.name": "OTG",
"preferences.otg.enable.name": "Enable OTG",
"preferences.otg.enable.placeholder": "Enable or disable OTG",
- "preferences.otg.enable.tips": "Enables using physical keyboard and mouse with Android device",
- "preferences.otg.only-keyboard.name": "Keyboard only",
+ "preferences.otg.enable.tips": "Enables using physical keyboard and mouse with Android device. Note: After turning on this function, it will freeze ADB -related functions. It cannot be used at the same time as mirror and recording function, please know.",
+ "preferences.otg.only-keyboard.name": "Keyboard Only",
"preferences.otg.only-keyboard.placeholder": "Enable keyboard-only OTG",
"preferences.otg.only-keyboard.tips": "Note: This disables mouse OTG",
- "preferences.otg.only-mouse.name": "Mouse only",
+ "preferences.otg.only-mouse.name": "Mouse Only",
"preferences.otg.only-mouse.placeholder": "Enable or disable mouse-only OTG",
"preferences.otg.only-mouse.tips": "Note: This disables keyboard OTG",
+
+ "preferences.camera.name": "Camera",
+ "preferences.camera.enable.name": "Enable Camera",
+ "preferences.camera.enable.placeholder": "Enable or disable camera video source",
+ "preferences.camera.enable.tips": "Enabled for camera as video source when mirroring or recording",
+ "preferences.camera.camera-facing.name": "Camera Source",
+ "preferences.camera.camera-facing.placeholder": "Default is device camera source",
+ "preferences.camera.camera-facing.front": "Front Camera",
+ "preferences.camera.camera-facing.back": "Back Camera",
+ "preferences.camera.camera-facing.external": "External Camera",
+ "preferences.camera.camera-size.name": "Camera Size",
+ "preferences.camera.camera-size.placeholder": "Default is device camera size, value format: 1920x1080",
+ "preferences.camera.camera-ar.name": "Camera Aspect Ratio",
+ "preferences.camera.camera-ar.placeholder": "Default is device camera aspect ratio, value format: 4:3, sensor, 1.6 etc",
+ "preferences.camera.camera-fps.name": "Camera Frame Rate",
+ "preferences.camera.camera-fps.placeholder": "Default is device camera frame rate",
+
"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 ff5c25e..c5d3525 100644
--- a/src/locales/languages/zh_CN.json
+++ b/src/locales/languages/zh_CN.json
@@ -1,6 +1,7 @@
{
"zh_CN": "中文",
"en_US": "English",
+
"common.cancel": "取消",
"common.confirm": "确认",
"common.restart": "重启",
@@ -8,11 +9,13 @@
"common.tips": "提示",
"common.open": "打开",
"common.input.placeholder": "请填写",
+
"close.quit": "退出",
"close.quit.cancel": "取消退出",
"close.minimize": "最小化到托盘",
"close.message": "确定要退出吗?",
"close.remember": "是否记住选择?",
+
"device.list": "设备列表",
"device.list.loading": "努力加载中...",
"device.list.empty": "没有检测到设备",
@@ -20,6 +23,7 @@
"device.name": "设备名称",
"device.remark": "备注",
"device.permission.error": "设备可能未授权成功,请重新插拔设备并点击允许USB调试",
+
"device.wireless.name": "无线连接",
"device.wireless.mode": "无线模式",
"device.wireless.mode.error": "没有获取到局域网连接地址,请检查网络",
@@ -50,6 +54,7 @@
"device.wireless.pair.code": "配对码",
"device.wireless.pair.code.message": "配对码不能为空",
"device.wireless.pair.code.placeholder": "请输入配对码",
+
"device.reset.title": "操作失败",
"device.reset.reasons[0]": "通常情况下,这可能是因为更新 Escrcpy 后,缓存的依赖配置不兼容所导致的,是否重置依赖配置?",
"device.reset.reasons[1]": "注意:重置后,之前保存的依赖配置将会被清除,因此建议在执行重置操作之前备份您的配置。",
@@ -65,6 +70,7 @@
"device.record.progress": "正在录制",
"device.record.success.title": "录制成功",
"device.record.success.message": "是否前往录制位置进行查看?",
+
"device.control.name": "操作",
"device.control.more": "设备交互",
"device.control.install": "安装应用",
@@ -89,6 +95,7 @@
"device.control.gnirehtet.tips": "使用 Gnirehtet 为 Android 提供反向网络共享;注意:首次连接需要在设备上进行授权",
"device.control.gnirehtet.progress": "正在启动 Gnirehtet 反向供网服务中...",
"device.control.gnirehtet.success": "Gnirehtet 反向网络共享功能启动成功",
+
"preferences.name": "偏好设置",
"preferences.reset": "恢复默认值",
"preferences.scope.global": "全局",
@@ -107,6 +114,7 @@
"preferences.config.edit.name": "编辑",
"preferences.config.reset.name": "重置",
"preferences.config.save.placeholder": "自动保存配置成功",
+
"preferences.common.name": "通用设置",
"preferences.common.theme.name": "主题",
"preferences.common.theme.placeholder": "设置主题",
@@ -125,6 +133,9 @@
"preferences.common.scrcpy.name": "scrcpy 路径",
"preferences.common.scrcpy.placeholder": "请设置 scrcpy 路径",
"preferences.common.scrcpy.tips": "用于连接设备的 scrcpy 地址。",
+ "preferences.common.scrcpy.append.name": "scrcpy 参数",
+ "preferences.common.scrcpy.append.placeholder": "为 scrcpy 命令附加额外的参数",
+ "preferences.common.scrcpy.append.tips": "注意:录入参数将会直接附加到 scrcpy 命令中,如果存在重复的参数,并不会自动进行过滤。",
"preferences.common.gnirehtet.name": "gnirehtet 路径",
"preferences.common.gnirehtet.placeholder": "请设置 gnirehtet 路径",
"preferences.common.gnirehtet.tips": "用于为设备反向供网的 gnirehtet 地址。",
@@ -135,7 +146,12 @@
"preferences.common.language.placeholder": "选择你需要的语言",
"preferences.common.language.chinese": "中文",
"preferences.common.language.english": "English",
+
"preferences.video.name": "视频控制",
+ "preferences.video.video-source.name": "视频源",
+ "preferences.video.video-source.placeholder": "默认为设备显示器",
+ "preferences.video.video-source.display": "显示器",
+ "preferences.video.video-source.camera": "摄像头",
"preferences.video.resolution.name": "分辨率",
"preferences.video.resolution.placeholder": "默认值为设备分辨率,如 1920",
"preferences.video.bit.name": "视频比特率",
@@ -148,12 +164,13 @@
"preferences.video.screen-rotation.placeholder": "默认值为设备屏幕旋转角度",
"preferences.video.screen-cropping.name": "屏幕裁剪",
"preferences.video.screen-cropping.placeholder": "默认不裁剪,格式为 1224:1440:0:0",
- "preferences.video.multi-display.name": "多显示器",
- "preferences.video.multi-display.placeholder": "默认值为 0(主屏幕)",
+ "preferences.video.display.name": "显示器",
+ "preferences.video.display.placeholder": "默认值为 0(设备显示器)",
"preferences.video.video-buffer.name": "视频缓冲",
"preferences.video.video-buffer.placeholder": "默认值为 0ms",
"preferences.video.receiver-buffer.name": "接收器缓冲(v412)",
"preferences.video.receiver-buffer.placeholder": "默认值为 0ms",
+
"preferences.device.name": "设备控制",
"preferences.device.show-touch.name": "展示触摸点",
"preferences.device.show-touch.placeholder": "开启后将打开开发者选项中的显示点按触摸反馈",
@@ -168,6 +185,7 @@
"preferences.device.control-in-stop-charging.name": "控制时停止充电",
"preferences.device.control-in-stop-charging.placeholder": "开启后控制设备时将停止充电",
"preferences.device.control-in-stop-charging.tips": "某些机型上似乎不起作用",
+
"preferences.window.name": "窗口控制",
"preferences.window.borderless.name": "无边框模式",
"preferences.window.borderless.placeholder": "开启后控制窗口将变为无边框模式",
@@ -177,6 +195,7 @@
"preferences.window.always-top.placeholder": "开启后控制窗口将始终位于顶部",
"preferences.window.disable-screen-saver.name": "禁用屏幕保护程序",
"preferences.window.disable-screen-saver.placeholder": "开启后将禁用计算机屏幕保护程序",
+
"preferences.record.name": "音视频录制",
"preferences.record.format.name": "录制视频格式",
"preferences.record.format.placeholder": "默认为 *.mp4 格式",
@@ -194,10 +213,12 @@
"preferences.record.no-audio-playback.name": "禁用音频播放",
"preferences.record.no-audio-playback.placeholder": "开启后录制时将禁用音频播放",
"preferences.record.no-audio-playback.tips": "注意:只是禁用了播放但是依然会录制音频",
+
"preferences.audio.name": "音频控制",
"preferences.audio.audio-source.name": "音频源",
"preferences.audio.audio-source.placeholder": "默认为设备音频输出",
"preferences.audio.audio-source.tips": "技巧:如果将来源设为麦克风将可以在录制时将声音录制下来",
+ "preferences.audio.audio-source.output": "设备输出",
"preferences.audio.audio-source.mic": "麦克风",
"preferences.audio.audio-code.name": "音频编码",
"preferences.audio.audio-code.placeholder": "默认为 Opus",
@@ -208,16 +229,34 @@
"preferences.audio.audio-buffer.placeholder": "默认值为 0ms",
"preferences.audio.audio-output-buffer.name": "音频输出缓冲",
"preferences.audio.audio-output-buffer.placeholder": "默认值为 5ms",
+
"preferences.otg.name": "OTG 控制",
"preferences.otg.enable.name": "启用 OTG",
"preferences.otg.enable.placeholder": "开启或关闭 OTG 功能",
- "preferences.otg.enable.tips": "开启后可以同时使用物理键盘和鼠标控制安卓设备",
+ "preferences.otg.enable.tips": "开启后可以同时使用物理键盘和鼠标控制安卓设备,注意:开启此功能后将会冻结 ADB 相关功能,无法和镜像以及录制功能同时使用,请知悉。",
"preferences.otg.only-keyboard.name": "仅键盘",
"preferences.otg.only-keyboard.placeholder": "开启仅键盘的 OTG 功能",
"preferences.otg.only-keyboard.tips": "注意:仅启用该选项将禁用鼠标的 OTG 功能",
"preferences.otg.only-mouse.name": "仅鼠标",
"preferences.otg.only-mouse.placeholder": "开启或关闭仅鼠标的 OTG 功能",
"preferences.otg.only-mouse.tips": "注意:仅启用该选项将禁用键盘的 OTG 功能",
+
+ "preferences.camera.name": "摄像控制",
+ "preferences.camera.enable.name": "启用摄像",
+ "preferences.camera.enable.placeholder": "开启或关闭摄像视频源",
+ "preferences.camera.enable.tips": "开启后镜像或录制时将以摄像作为视频源",
+ "preferences.camera.camera-facing.name": "摄像源",
+ "preferences.camera.camera-facing.placeholder": "默认为设备摄像源",
+ "preferences.camera.camera-facing.front": "前置摄像",
+ "preferences.camera.camera-facing.back": "后置摄像",
+ "preferences.camera.camera-facing.external": "外接摄像",
+ "preferences.camera.camera-size.name": "摄像尺寸",
+ "preferences.camera.camera-size.placeholder": "默认为设备摄像尺寸,值格式为:1920x1080",
+ "preferences.camera.camera-ar.name": "摄像比例",
+ "preferences.camera.camera-ar.placeholder": "默认为设备摄像比例,值格式为:4:3,sensor,1.6 等",
+ "preferences.camera.camera-fps.name": "摄像帧率",
+ "preferences.camera.camera-fps.placeholder": "默认为设备摄像帧率",
+
"about.name": "关于",
"about.description": "📱 使用图形化的 Scrcpy 显示和控制您的 Android 设备,由 Electron 驱动",
"about.update": "检查并更新",
diff --git a/src/store/preference/helpers/index.js b/src/store/preference/helpers/index.js
index bb56936..19a1018 100644
--- a/src/store/preference/helpers/index.js
+++ b/src/store/preference/helpers/index.js
@@ -74,7 +74,11 @@ export function setStoreData(data, scope) {
}, {})
Object.entries(data).forEach(([key, value]) => {
- const { parentField } = modelMap[key]
+ const { parentField } = modelMap?.[key] || {}
+
+ if (!parentField) {
+ return
+ }
storeModel[parentField][key] = value
})
diff --git a/src/store/preference/index.js b/src/store/preference/index.js
index b8603aa..a954c7d 100644
--- a/src/store/preference/index.js
+++ b/src/store/preference/index.js
@@ -26,16 +26,27 @@ export const usePreferenceStore = defineStore({
item => item.field,
)
+ const cameraKeys = Object.values(model?.camera?.children || {}).map(
+ item => item.field,
+ )
+
+ const otgKeys = Object.values(model?.otg?.children || {}).map(
+ item => item.field,
+ )
+
return {
model: cloneDeep(model),
data: { ...getDefaultData() },
deviceScope,
excludeKeys: [
+ '--camera',
'--video-code',
'--audio-code',
...getOtherFields('scrcpy'),
],
recordKeys,
+ cameraKeys,
+ otgKeys,
}
},
getters: {},
@@ -121,7 +132,7 @@ export const usePreferenceStore = defineStore({
getScrcpyArgs(scope = this.deviceScope, { isRecord = false } = {}) {
const data = this.getData(scope)
- // console.log('getScrcpyArgs.data', data)
+ console.log('getScrcpyArgs.data', data)
if (!data) {
return ''
@@ -137,12 +148,23 @@ export const usePreferenceStore = defineStore({
}
if (!isRecord) {
- console.log('isRecord')
if (this.recordKeys.includes(key)) {
return arr
}
}
+ if (!this.data['--camera']) {
+ if (this.cameraKeys.includes(key)) {
+ return arr
+ }
+ }
+
+ if (!this.data['--otg']) {
+ if (this.otgKeys.includes(key)) {
+ return arr
+ }
+ }
+
if (typeof value === 'boolean') {
arr.push(key)
}
@@ -153,6 +175,10 @@ export const usePreferenceStore = defineStore({
return arr
}, [])
+ if (this.data.scrcpyAppend) {
+ valueList.push(...this.data.scrcpyAppend.split(' '))
+ }
+
const value = valueList.join(' ')
console.log('getScrcpyArgs.value', value)
diff --git a/src/store/preference/model/audio/index.js b/src/store/preference/model/audio/index.js
index 2beee0a..596cd97 100644
--- a/src/store/preference/model/audio/index.js
+++ b/src/store/preference/model/audio/index.js
@@ -11,8 +11,8 @@ export default {
placeholder: 'preferences.audio.audio-source.placeholder',
tips: 'preferences.audio.audio-source.tips',
options: [
- { label: 'common.default', value: '' },
- { label: '麦克风', value: 'mic' },
+ { label: 'preferences.audio.audio-source.output', value: '' },
+ { label: 'preferences.audio.audio-source.mic', value: 'mic' },
],
},
audioCode: {
diff --git a/src/store/preference/model/camera/index.js b/src/store/preference/model/camera/index.js
new file mode 100644
index 0000000..119a698
--- /dev/null
+++ b/src/store/preference/model/camera/index.js
@@ -0,0 +1,51 @@
+export default {
+ label: 'preferences.camera.name',
+ field: 'scrcpy',
+ children: {
+ camera: {
+ label: 'preferences.camera.enable.name',
+ field: '--camera',
+ type: 'CameraSwitch',
+ value: null,
+ placeholder: 'preferences.camera.enable.placeholder',
+ tips: 'preferences.camera.enable.tips',
+ },
+ cameraFacing: {
+ label: 'preferences.camera.camera-facing.name',
+ field: '--camera-facing',
+ type: 'Select',
+ value: '',
+ placeholder: 'preferences.camera.camera-facing.placeholder',
+ options: [
+ { label: 'preferences.camera.camera-facing.front', value: 'front' },
+ { label: 'preferences.camera.camera-facing.back', value: 'back' },
+ {
+ label: 'preferences.camera.camera-facing.external',
+ value: 'external',
+ },
+ ],
+ },
+ cameraSize: {
+ label: 'preferences.camera.camera-size.name',
+ field: '--camera-size',
+ type: 'Input',
+ value: '',
+ placeholder: 'preferences.camera.camera-size.placeholder',
+ },
+ cameraAr: {
+ label: 'preferences.camera.camera-ar.name',
+ field: '--camera-ar',
+ type: 'Input',
+ value: '',
+ placeholder: 'preferences.camera.camera-ar.placeholder',
+ },
+ cameraFps: {
+ label: 'preferences.camera.camera-fps.name',
+ field: '--camera-fps',
+ type: 'Input.number',
+ value: '',
+ placeholder: 'preferences.camera.camera-fps.placeholder',
+ append: 'fps',
+ },
+ },
+}
diff --git a/src/store/preference/model/common/index.js b/src/store/preference/model/common/index.js
index 1129111..86b396f 100644
--- a/src/store/preference/model/common/index.js
+++ b/src/store/preference/model/common/index.js
@@ -89,6 +89,19 @@ export default {
{ name: 'preferences.common.gnirehtet.name', extensions: ['*'] },
],
},
+ scrcpyAppend: {
+ label: 'preferences.common.scrcpy.append.name',
+ field: 'scrcpyAppend',
+ value: '',
+ type: 'Input',
+ placeholder: 'preferences.common.scrcpy.append.placeholder',
+ tips: 'preferences.common.scrcpy.append.tips',
+ props: {
+ type: 'textarea',
+ rows: 4,
+ },
+ span: 24,
+ },
gnirehtetFix: {
label: 'preferences.common.gnirehtet.fix.name',
field: 'gnirehtetFix',
diff --git a/src/store/preference/model/index.js b/src/store/preference/model/index.js
index 76ef9a0..9e62fa7 100644
--- a/src/store/preference/model/index.js
+++ b/src/store/preference/model/index.js
@@ -5,5 +5,6 @@ import window from './window/index.js'
import audio from './audio/index.js'
import record from './record/index.js'
import otg from './otg/index.js'
+import camera from './camera/index.js'
-export default { common, video, device, window, audio, record, otg }
+export default { common, video, device, window, audio, record, otg, camera }
diff --git a/src/store/preference/model/video/index.js b/src/store/preference/model/video/index.js
index fd0e54e..300d267 100644
--- a/src/store/preference/model/video/index.js
+++ b/src/store/preference/model/video/index.js
@@ -3,6 +3,24 @@ export default {
field: 'scrcpy',
children: {
+ videoSource: {
+ hidden: true,
+ label: 'preferences.video.video-source.name',
+ field: '--video-source',
+ type: 'Select',
+ value: '',
+ placeholder: 'preferences.video.video-source.placeholder',
+ options: [
+ {
+ label: 'preferences.video.video-source.display',
+ value: 'display',
+ },
+ {
+ label: 'preferences.video.video-source.camera',
+ value: 'camera',
+ },
+ ],
+ },
maxSize: {
label: 'preferences.video.resolution.name',
field: '--max-size',
@@ -86,11 +104,11 @@ export default {
placeholder: 'preferences.video.screen-cropping.placeholder',
},
displayId: {
- label: 'preferences.video.multi-display.name',
+ label: 'preferences.video.display.name',
field: '--display-id',
type: 'DisplaySelect',
value: '',
- placeholder: 'preferences.video.multi-display.placeholder',
+ placeholder: 'preferences.video.display.placeholder',
options: [
{ label: '0', value: '0' },
{ label: '1', value: '1' },