添加置底协议,添加置顶置底菜单

This commit is contained in:
fangxiang 2022-02-10 17:16:27 +08:00
parent 0b44aec804
commit 7cfee35383
6 changed files with 93 additions and 37 deletions

View File

@ -506,7 +506,15 @@ export default class ClientConnection {
public focusIn(window_id: number) {
this.ws?.send(
JSON.stringify(
new NormalWindowRequestEntity(Protocol.Commands.kFocusWindow, window_id)
new NormalWindowRequestEntity(Protocol.Commands.kTopWindow, window_id)
)
);
}
public lowerWindow(window_id: number) {
this.ws?.send(
JSON.stringify(
new NormalWindowRequestEntity(Protocol.Commands.kLowerWindow, window_id)
)
);
}

View File

@ -59,6 +59,26 @@
>
<q-item-section> {{ $t("close all windwos") }} </q-item-section>
</q-item>
<q-item
clickable
v-close-popup
:disable="$props.disable"
@click="$emit('top_window', $props.window.window_id)"
>
<q-item-section>
{{ $t("top window") }}
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
:disable="$props.disable"
@click="$emit('lower_window', $props.window.window_id)"
>
<q-item-section>
{{ $t("lower window") }}
</q-item-section>
</q-item>
<div v-if="!is_clock_window">
<q-item
clickable
@ -363,7 +383,8 @@ export default defineComponent({
"close_this_window",
"close_other_windows",
"close_all_windows",
"window_fouse_in",
"top_window",
"lower_window",
"edit_volume",
"mute_unmute",
"stop_polling",
@ -458,7 +479,6 @@ export default defineComponent({
if (selected.value != true) {
EventBus.getInstance().emit(EventNamesDefine.UnSelectAllWindows);
selected.value = true;
emit("window_fouse_in", props.window.window_id);
$store.commit("setSelectedWindow", props.window.uuid);
}
}
@ -562,10 +582,6 @@ export default defineComponent({
}
cleanMouseDownFlag();
}
// if (!focused) {
// emit("window_fouse_in", props.window.window_id);
// }
},
getItemIcon(item_type: string) {

View File

@ -72,8 +72,8 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "WindowOtherStateChanged";
}
public static get kFocusWindow() {
return Commands.PROTOCOL_PREFIX + "FocusWindow";
public static get kTopWindow() {
return Commands.PROTOCOL_PREFIX + "TopWindow";
}
public static get kLowerWindow() {
@ -291,7 +291,7 @@ export namespace Protocol {
Commands.kResizeWindow,
Commands.kOpenWindow,
Commands.kCloseWindow,
Commands.kFocusWindow,
Commands.kTopWindow,
Commands.kLowerWindow,
Commands.kWindowOtherStateChanged,
Commands.kRpcAddSignalSourceGroup,
@ -1579,12 +1579,12 @@ export namespace Protocol {
}
}
export class FocusWindowNotifyEntity extends PacketEntity {
export class TopWindowNotifyEntity extends PacketEntity {
new_window_id: number = 0;
old_window_id: number = 0;
constructor() {
super();
this.command = Commands.kFocusWindow;
this.command = Commands.kTopWindow;
}
}

View File

@ -314,4 +314,6 @@ export default {
"font name": "字体",
"font color": "字体颜色",
"new signal source": "新建信号源",
"lower window": "窗口置底",
"top window": "窗口置顶",
};

View File

@ -30,6 +30,7 @@
<q-btn
stretch
flat
stack
icon="settings"
:label="$t('system setting')"
class="q-mr-sm"
@ -39,6 +40,7 @@
<q-btn
stretch
flat
stack
icon="description"
:label="$t('file manage')"
class="q-mr-sm"
@ -47,6 +49,7 @@
<q-btn
stretch
flat
stack
icon="grid_on"
:label="$t('grid setting')"
class="q-mr-sm"
@ -56,6 +59,7 @@
<q-btn
stretch
flat
stack
icon="art_track"
:label="$t('subtitle')"
class="q-mr-sm"
@ -65,6 +69,27 @@
<q-btn
stretch
flat
stack
icon="vertical_align_top"
:label="$t('top window')"
class="q-mr-sm"
@click="topWindow"
/>
<q-btn
stretch
flat
stack
icon="vertical_align_bottom"
:label="$t('lower window')"
class="q-mr-sm"
@click="lowerWindow"
/>
<q-btn
stretch
flat
stack
icon="stop"
:label="$t('stop plan')"
class="q-mr-sm"
@ -72,6 +97,7 @@
@click="stopPlan"
/>
<q-space />
<q-btn-dropdown
stretch
flat
@ -127,14 +153,13 @@
</q-list>
</q-btn-dropdown>
<q-space />
<q-separator vertical inset />
<q-item>
<q-item-section avatar style="margin-right: 0px; padding-right: 0px"
><q-icon class="text-white" name="img:svgs/fan.svg"
/></q-item-section>
<q-item-section>
<q-item-section style="margin-left: -25px">
{{ $store.state.fan_temp.toFixed(1) }}
</q-item-section>
</q-item>
@ -265,17 +290,26 @@ export default defineComponent({
},
stopPlan() {
GlobalData.getInstance().getCurrentClient()?.stopCurrentRunningPlan();
// $q.notify({
// color: "positive",
// icon: "done",
// message:
// $t.t("send") +
// $t.t("stop plan") +
// $t.t("directives") +
// $t.t("success"),
// position: "top",
// timeout: 1000,
// });
},
topWindow() {
const window = $store.state.windows.find(
(element) => element && element.uuid == $store.state.selected_window
);
if (window) {
GlobalData.getInstance()
.getCurrentClient()
?.focusIn(window.window_id);
}
},
lowerWindow() {
const window = $store.state.windows.find(
(element) => element && element.uuid == $store.state.selected_window
);
if (window) {
GlobalData.getInstance()
.getCurrentClient()
?.lowerWindow(window.window_id);
}
},
logout() {
SessionStorage.clear();

View File

@ -15,7 +15,8 @@
@close_this_window="closeWindow"
@close_other_windows="closeOtherWindows"
@close_all_windows="closeAllWindows"
@window_fouse_in="windowFocusIn"
@top_window="topWindow"
@lower_window="lowerWindow"
@dblclick="(evt) => windowDBClick(item.window_id)"
@edit_volume="edit_volume"
@mute_unmute="mute_unmute"
@ -494,11 +495,11 @@ export default defineComponent({
}
}
break;
case Protocol.Commands.kFocusWindow:
case Protocol.Commands.kTopWindow:
{
const temp = JSON.parse(
notify.data
) as Protocol.FocusWindowNotifyEntity;
) as Protocol.TopWindowNotifyEntity;
if (temp) {
for (const window of $store.state.windows) {
if (window && window.window_id != temp.new_window_id) {
@ -594,14 +595,6 @@ export default defineComponent({
if (wall.value && dom) {
if (dom.classList.contains("wall_item_flag")) {
//
console.log(dom.offsetWidth);
console.log(dom.offsetHeight);
console.log(wall.value.clientWidth);
console.log(wall.value.clientHeight);
console.log(dom.offsetLeft / wall.value.clientWidth);
console.log(dom.offsetWidth / wall.value.clientWidth);
console.log(dom.offsetTop / wall.value.clientHeight);
console.log(dom.offsetHeight / wall.value.clientHeight);
GlobalData.getInstance()
.getCurrentClient()
?.openWindow(
@ -747,9 +740,12 @@ export default defineComponent({
}
}
},
windowFocusIn(window_id: number) {
topWindow(window_id: number) {
GlobalData.getInstance().getCurrentClient()?.focusIn(window_id);
},
lowerWindow(window_id: number) {
GlobalData.getInstance().getCurrentClient()?.lowerWindow(window_id);
},
closeOtherWindows(window_id: number) {
for (const window of $store.state.windows) {
if (window && window.window_id != window_id) {