diff --git a/src/common/Initializer.ts b/src/common/Initializer.ts index 5567bbd..bf7a1e7 100644 --- a/src/common/Initializer.ts +++ b/src/common/Initializer.ts @@ -91,14 +91,6 @@ export default class Initializer { if (global_data.applicationConfig && $store) { $store.commit("setWallCol", global_data.applicationConfig.wall_col); $store.commit("setWallRow", global_data.applicationConfig.wall_row); - $store.commit( - "setDeviceScreenWidth", - global_data.applicationConfig.screen_width - ); - $store.commit( - "setDeviceScreenHeight", - global_data.applicationConfig.screen_height - ); $store.commit( "setPowerOnPlan", global_data.applicationConfig.power_on_plan diff --git a/src/common/RemoteDataExangeProcesser.ts b/src/common/RemoteDataExangeProcesser.ts index 9b2e247..7d44923 100644 --- a/src/common/RemoteDataExangeProcesser.ts +++ b/src/common/RemoteDataExangeProcesser.ts @@ -58,14 +58,6 @@ export default class RemoteDataExangeProcesser { "setWallRow", global_data.applicationConfig.wall_row ); - $store.commit( - "setDeviceScreenWidth", - global_data.applicationConfig.screen_width - ); - $store.commit( - "setDeviceScreenHeight", - global_data.applicationConfig.screen_height - ); $store.commit( "setPowerOnPlan", global_data.applicationConfig.power_on_plan @@ -387,6 +379,32 @@ export default class RemoteDataExangeProcesser { } } break; + case Protocol.Commands.kDesktopResolutionChangedNotify: + { + const temp = JSON.parse( + notify.data + ) as Protocol.DesktopResolutionChangedNotifyEntity; + if (temp) { + $store.commit("setDeviceScreenWidth", temp.width); + $store.commit("setDeviceScreenHeight", temp.height); + $store.commit("setDeviceScreenRefreshRate", temp.refresh_rate); + $store.commit("setDeviceScreenConnectState", true); + } + } + break; + case Protocol.Commands.kDesktopResolutionChangedNotify: + { + const temp = JSON.parse( + notify.data + ) as Protocol.DesktopDisconnectNotifyEntity; + if (temp) { + $store.commit("setDeviceScreenConnectState", false); + } + } + break; + default: + console.log(notify.data); + break; } } catch {} } diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index 66d66ad..e2712f1 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -758,7 +758,7 @@ export default defineComponent({ let old_resolution: string = ""; let old_rotate: number = 0; let device_resolution = ref(""); - let device_resolution_options = ref(["11", "22", "33"]); + let device_resolution_options: Ref = ref([]); let device_rotate = ref(0); let device_rotate_options = ref([ { @@ -882,7 +882,17 @@ export default defineComponent({ } { - const val = device_resolution_options.value.find( + let val = device_resolution_options.value.find( + (element) => + element && + element == support_resolutions.current_device_resolution + ); + if (!val) { + device_resolution_options.value.push( + support_resolutions.current_device_resolution + ); + } + val = device_resolution_options.value.find( (element) => element && element == support_resolutions.current_device_resolution diff --git a/src/entities/ApplicationConfigEntity.ts b/src/entities/ApplicationConfigEntity.ts index 5785257..7f87bac 100644 --- a/src/entities/ApplicationConfigEntity.ts +++ b/src/entities/ApplicationConfigEntity.ts @@ -9,8 +9,6 @@ export default class ApplicationConfigEntity { time_zone: number = 21; wall_row: number = 1; wall_col: number = 1; - screen_width: number = 1; - screen_height: number = 1; tcp_port: string = ""; udp_port: string = ""; websocket_port: string = ""; diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index c069c8b..e321c89 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -281,6 +281,14 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "PollingStateChanged"; } + public static get kDesktopResolutionChangedNotify() { + return Commands.PROTOCOL_PREFIX + "DesktopResolutionChangedNotify"; + } + + public static get kDesktopDisconnectNotify() { + return Commands.PROTOCOL_PREFIX + "DesktopDisconnectNotify"; + } + static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -349,6 +357,8 @@ export namespace Protocol { Commands.kStopPolling, Commands.kStartPolling, Commands.kPollingStateChanged, + Commands.kDesktopResolutionChangedNotify, + Commands.kDesktopDisconnectNotify, ]); public static get AllCommands() { @@ -1647,4 +1657,24 @@ export namespace Protocol { this.command = Commands.kLowerWindow; } } + + export class DesktopResolutionChangedNotifyEntity extends PacketEntity { + width: number = 0; + height: number = 0; + refresh_rate: number = 0; + + constructor() { + super(); + this.command = Commands.kDesktopResolutionChangedNotify; + } + } + + export class DesktopDisconnectNotifyEntity extends PacketEntity { + timestamp: number = 0; + + constructor() { + super(); + this.command = Commands.kDesktopDisconnectNotify; + } + } } diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index df3b78a..dd57db4 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -321,4 +321,6 @@ export default { "the list of previously saved window list is about to be overwritten": "之前保存的窗口列表将被覆盖", "are you sure about the update": "确定更新吗", + "device info": "设备信息", + resolution: "分辨率", }; diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index 1dfc154..399816b 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -193,6 +193,14 @@ {{ $t("upgrade") }} + + + + + + {{ $t("device info") }} + + 0) { + state.device_screen_refresh_rate = num; + } + }, + setDeviceScreenConnectState(state: StateInterface, playload?: any) { + try { + state.device_screen_connect_state = JSON.parse(playload); + } catch {} + }, // signal source setSignalSourceTree( state: StateInterface,