feat: 🎉 Update to scrcpy v2.4

This commit is contained in:
viarotel 2024-03-04 11:38:17 +08:00
parent a0bf2047e9
commit 02a4d39820
17 changed files with 258 additions and 13 deletions

View File

@ -8,7 +8,7 @@
@open="onOpen"
>
<el-icon
class="cursor-pointer absolute top-2 right-2 w-8 h-8 flex items-center justify-center hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700 !active:bg-red-600 !active:text-gray-200 rounded-md"
class="cursor-pointer absolute top-3 right-3 w-8 h-8 flex items-center justify-center hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700 !active:bg-red-600 !active:text-gray-200 rounded-md"
@click="hide"
>
<CloseBold />
@ -148,3 +148,12 @@ export default {
},
}
</script>
<style lang="postcss" scoped>
:deep() {
.vue-command__history,
.vue-command__history--invert {
@apply !bg-transparent !p-0;
}
}
</style>

View File

@ -0,0 +1,64 @@
<template>
<el-select
v-bind="data.props || {}"
v-model="selectValue"
class="!w-full"
clearable
:title="$t(data.placeholder)"
:placeholder="$t(data.placeholder)"
>
<el-option
v-for="(item, index) in options"
:key="index"
:label="$t(item.label)"
:value="item.value"
:title="$t(item.placeholder || item.label)"
>
</el-option>
</el-select>
</template>
<script>
export default {
props: {
modelValue: {
type: String,
value: '',
},
data: {
type: Object,
default: () => ({}),
},
preferenceData: {
type: Object,
default: () => ({}),
},
},
emits: ['update:model-value'],
data() {
return {}
},
computed: {
options() {
return this.data.options || []
},
selectValue: {
get() {
return this.modelValue
},
set(value) {
this.$emit('update:model-value', value)
this.options.forEach((item) => {
if (item.value) {
this.preferenceData[item.value] = item.value === value
}
})
},
},
},
methods: {},
}
</script>
<style></style>

View File

@ -11,6 +11,7 @@
:key="index"
:label="$t(item.label)"
:value="item.value"
:title="$t(item.placeholder || item.label)"
>
</el-option>
</el-select>

View File

@ -21,13 +21,13 @@
<template #content>
<div class="space-y-1">
<div class="pb-1">
{{ $t("preferences.scope.details[0]") }}
{{ $t('preferences.scope.details[0]') }}
</div>
<div class="">
{{ $t("preferences.scope.details[1]") }}
{{ $t('preferences.scope.details[1]') }}
</div>
<div class="">
{{ $t("preferences.scope.details[2]") }}
{{ $t('preferences.scope.details[2]') }}
</div>
</div>
</template>
@ -44,16 +44,16 @@
</div>
<div class="">
<el-button type="" icon="Upload" plain @click="handleImport">
{{ $t("preferences.config.import.name") }}
{{ $t('preferences.config.import.name') }}
</el-button>
<el-button type="" icon="Download" plain @click="handleExport">
{{ $t("preferences.config.export.name") }}
{{ $t('preferences.config.export.name') }}
</el-button>
<el-button type="" icon="Edit" plain @click="handleEdit">
{{ $t("preferences.config.edit.name") }}
{{ $t('preferences.config.edit.name') }}
</el-button>
<el-button type="" icon="RefreshRight" plain @click="handleResetAll">
{{ $t("preferences.config.reset.name") }}
{{ $t('preferences.config.reset.name') }}
</el-button>
</div>
</div>
@ -78,7 +78,7 @@
</div>
<div class="flex-none pl-4 pr-12" @click.stop>
<el-button type="primary" text @click="handleReset(name)">
{{ $t("preferences.reset") }}
{{ $t('preferences.reset') }}
</el-button>
</div>
</div>
@ -170,6 +170,7 @@
:key="index_2"
:label="$t(item_2.label)"
:value="item_2.value"
:title="$t(item_2.placeholder || item_2.label)"
>
</el-option>
</el-select>
@ -196,15 +197,19 @@
<script>
import { debounce } from 'lodash-es'
import { ref } from 'vue'
import { useOtg } from './composables/otg/index.js'
import LanguageSelect from './components/LanguageSelect/index.vue'
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 KeyboardInjectSelect from './components/KeyboardInjectSelect/index.vue'
import { usePreferenceStore } from '@/store/index.js'
import LoadingIcon from '@/components/Device/components/LoadingIcon/index.vue'
export default {
components: {
@ -214,6 +219,7 @@ export default {
AudioCodecSelect,
DisplaySelect,
CameraSwitch,
KeyboardInjectSelect,
},
setup() {
const preferenceStore = usePreferenceStore()

View File

@ -163,7 +163,7 @@
"preferences.common.adb.tips": "adb path to connect device",
"preferences.common.scrcpy.name": "Scrcpy Path",
"preferences.common.scrcpy.placeholder": "Custom scrcpy path",
"preferences.common.scrcpy.tips": "scrcpy path to connect device",
"preferences.common.scrcpy.tips": "scrcpy path to control 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.",
@ -276,6 +276,27 @@
"preferences.audio.audio-output-buffer.name": "Audio Output Buffer",
"preferences.audio.audio-output-buffer.placeholder": "5",
"preferences.input.name": "Input",
"preferences.input.mouse.name": "Mouse Mode",
"preferences.input.mouse.placeholder": "sdk",
"preferences.input.mouse.tips": "Set mouse input mode",
"preferences.input.mouse.options[0].placeholder": "Default",
"preferences.input.mouse.options[1].placeholder": "Simulates a physical HID mouse using the UHID kernel module on the device",
"preferences.input.mouse.options[2].placeholder": "Simulates a physical HID mouse using the AOAv2 protocol",
"preferences.input.mouse.options[3].placeholder": "Disable mouse input",
"preferences.input.keyboard.name": "Keyboard Mode",
"preferences.input.keyboard.placeholder": "sdk",
"preferences.input.keyboard.tips": "Set keyboard input mode",
"preferences.input.keyboard.options[0].placeholder": "Default",
"preferences.input.keyboard.options[1].placeholder": "Simulates a physical HID keyboard using the UHID kernel module on the device",
"preferences.input.keyboard.options[2].placeholder": "Simulates a physical HID keyboard using the AOAv2 protocol",
"preferences.input.keyboard.options[3].placeholder": "Disable keyboard input",
"preferences.input.keyboard.inject.name": "Keyboard Inject",
"preferences.input.keyboard.inject.placeholder": "default",
"preferences.input.keyboard.inject.tips": "Set keyboard text injection first option",
"preferences.input.keyboard.inject.options[0].placeholder": "Inject letters as text",
"preferences.input.keyboard.inject.options[1].placeholder": "Force always inject the original button event",
"preferences.otg.name": "OTG",
"preferences.otg.enable.name": "Enable OTG",
"preferences.otg.enable.placeholder": "Enable or disable OTG",

View File

@ -161,7 +161,7 @@
"preferences.common.adb.tips": "用于连接设备的 adb 地址。",
"preferences.common.scrcpy.name": "scrcpy 路径",
"preferences.common.scrcpy.placeholder": "自定义 scrcpy 路径",
"preferences.common.scrcpy.tips": "用于连接设备的 scrcpy 地址。",
"preferences.common.scrcpy.tips": "用于控制设备的 scrcpy 地址。",
"preferences.common.scrcpy.append.name": "scrcpy 参数",
"preferences.common.scrcpy.append.placeholder": "为 scrcpy 命令追加额外的参数",
"preferences.common.scrcpy.append.tips": "注意:录入参数将会直接附加到 scrcpy 命令中,如果存在重复的参数,并不会自动进行过滤。",
@ -274,6 +274,27 @@
"preferences.audio.audio-output-buffer.name": "音频输出缓冲",
"preferences.audio.audio-output-buffer.placeholder": "5",
"preferences.input.name": "输入控制",
"preferences.input.mouse.name": "鼠标模式",
"preferences.input.mouse.tips": "设置鼠标输入模式",
"preferences.input.mouse.placeholder": "sdk",
"preferences.input.mouse.options[0].placeholder": "默认",
"preferences.input.mouse.options[1].placeholder": "使用设备上的 UHID 内核模块模拟物理 HID 鼠标",
"preferences.input.mouse.options[2].placeholder": "使用 AOAv2 协议模拟物理 HID 鼠标",
"preferences.input.mouse.options[3].placeholder": "禁用鼠标输入",
"preferences.input.keyboard.name": "键盘模式",
"preferences.input.keyboard.tips": "设置键盘输入模式",
"preferences.input.keyboard.placeholder": "sdk",
"preferences.input.keyboard.options[0].placeholder": "默认",
"preferences.input.keyboard.options[1].placeholder": "使用设备上的 UHID 内核模块模拟物理 HID 键盘",
"preferences.input.keyboard.options[2].placeholder": "使用 AOAv2 协议模拟物理 HID 键盘",
"preferences.input.keyboard.options[3].placeholder": "禁用键盘输入",
"preferences.input.keyboard.inject.name": "键盘注入方式",
"preferences.input.keyboard.inject.placeholder": "默认",
"preferences.input.keyboard.inject.tips": "设置键盘文本注入首选项",
"preferences.input.keyboard.inject.options[0].placeholder": "将字母作为文本注入",
"preferences.input.keyboard.inject.options[1].placeholder": "强制始终注入原始按键事件",
"preferences.otg.name": "OTG 控制",
"preferences.otg.enable.name": "启用 OTG",
"preferences.otg.enable.placeholder": "开启或关闭 OTG 功能",

View File

@ -43,6 +43,7 @@ export const usePreferenceStore = defineStore({
'--camera',
'--video-code',
'--audio-code',
'--keyboard-inject',
...getOtherFields('scrcpy'),
],
recordKeys,

View File

@ -4,7 +4,18 @@ 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 input from './input/index.js'
import otg from './otg/index.js'
import camera from './camera/index.js'
export default { common, video, device, window, audio, record, otg, camera }
export default {
common,
video,
device,
window,
audio,
record,
input,
otg,
camera,
}

View File

@ -0,0 +1,111 @@
export default {
label: 'preferences.input.name',
field: 'scrcpy',
children: {
mouse: {
label: 'preferences.input.mouse.name',
field: '--mouse',
type: 'Select',
props: {
clearable: true,
},
value: undefined,
placeholder: 'preferences.input.mouse.placeholder',
tips: 'preferences.input.mouse.tips',
options: [
{
label: 'sdk',
value: 'sdk',
placeholder: 'preferences.input.mouse.options[0].placeholder',
},
{
label: 'uhid',
value: 'uhid',
placeholder: 'preferences.input.mouse.options[1].placeholder',
},
{
label: 'aoa',
value: 'aoa',
placeholder: 'preferences.input.mouse.options[2].placeholder',
},
{
label: 'disabled',
value: 'disabled',
placeholder: 'preferences.input.mouse.options[3].placeholder',
},
],
},
keyboard: {
label: 'preferences.input.keyboard.name',
field: '--keyboard',
type: 'Select',
props: {
clearable: true,
},
value: undefined,
placeholder: 'preferences.input.keyboard.placeholder',
tips: 'preferences.input.keyboard.tips',
options: [
{
label: 'sdk',
value: 'sdk',
placeholder: 'preferences.input.keyboard.options[0].placeholder',
},
{
label: 'uhid',
value: 'uhid',
placeholder: 'preferences.input.keyboard.options[1].placeholder',
},
{
label: 'aoa',
value: 'aoa',
placeholder: 'preferences.input.keyboard.options[2].placeholder',
},
{
label: 'disabled',
value: 'disabled',
placeholder: 'preferences.input.keyboard.options[3].placeholder',
},
],
},
keyboardInject: {
label: 'preferences.input.keyboard.inject.name',
field: '--keyboard-inject',
type: 'KeyboardInjectSelect',
value: undefined,
placeholder: 'preferences.input.keyboard.inject.placeholder',
tips: 'preferences.input.keyboard.inject.tips',
options: [
{
label: 'default',
value: '',
placeholder:
'preferences.input.keyboard.inject.options[0].placeholder',
},
{
label: 'prefer-text',
value: '--prefer-text',
placeholder:
'preferences.input.keyboard.inject.options[0].placeholder',
},
{
label: 'raw-key-events',
value: '--raw-key-events',
placeholder:
'preferences.input.keyboard.inject.options[1].placeholder',
},
],
},
videoCodec: {
hidden: true,
field: '--prefer-text',
value: undefined,
},
videoEncoder: {
hidden: true,
field: '--raw-key-events',
value: undefined,
},
},
}