添加分辨率更改通知以及桌面输出通知

This commit is contained in:
fangxiang 2022-02-12 17:09:26 +08:00
parent 0bf2dd23ca
commit 9d77cf2351
8 changed files with 106 additions and 20 deletions

View File

@ -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

View File

@ -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 {}
}

View File

@ -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<string[]> = 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

View File

@ -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 = "";

View File

@ -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;
}
}
}

View File

@ -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: "分辨率",
};

View File

@ -193,6 +193,14 @@
{{ $t("upgrade") }}
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="showDeviceInfo">
<q-item-section avatar>
<q-icon name="devices" />
</q-item-section>
<q-item-section>
{{ $t("device info") }}
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@ -355,6 +363,19 @@ export default defineComponent({
SessionStorage.clear();
window.location.reload();
},
showDeviceInfo() {
$q.dialog({
title: $t.t("device info"),
message:
$t.t("resolution") +
": " +
$store.state.device_screen_width +
"X" +
$store.state.device_screen_height +
"@" +
$store.state.device_screen_refresh_rate,
});
},
};
},
});

View File

@ -37,6 +37,8 @@ export interface StateInterface {
wall_col: number;
device_screen_width: number;
device_screen_height: number;
device_screen_refresh_rate: number;
device_screen_connect_state: boolean;
windows: WindowOpenNotifyEntity[];
windows_sort: string[];
device_ip_address: string;
@ -270,6 +272,8 @@ export default store(function (/* { ssrContext } */) {
wall_row: 1,
device_screen_width: 1920,
device_screen_height: 1080,
device_screen_refresh_rate: 60,
device_screen_connect_state: true,
windows: [],
windows_sort: [],
device_ip_address: "localhost",
@ -437,6 +441,17 @@ export default store(function (/* { ssrContext } */) {
state.device_screen_height = num;
}
},
setDeviceScreenRefreshRate(state: StateInterface, playload?: any) {
const num = parseInt(playload);
if (num != NaN && num > 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,