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

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) { public focusIn(window_id: number) {
this.ws?.send( this.ws?.send(
JSON.stringify( 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-section> {{ $t("close all windwos") }} </q-item-section>
</q-item> </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"> <div v-if="!is_clock_window">
<q-item <q-item
clickable clickable
@ -363,7 +383,8 @@ export default defineComponent({
"close_this_window", "close_this_window",
"close_other_windows", "close_other_windows",
"close_all_windows", "close_all_windows",
"window_fouse_in", "top_window",
"lower_window",
"edit_volume", "edit_volume",
"mute_unmute", "mute_unmute",
"stop_polling", "stop_polling",
@ -458,7 +479,6 @@ export default defineComponent({
if (selected.value != true) { if (selected.value != true) {
EventBus.getInstance().emit(EventNamesDefine.UnSelectAllWindows); EventBus.getInstance().emit(EventNamesDefine.UnSelectAllWindows);
selected.value = true; selected.value = true;
emit("window_fouse_in", props.window.window_id);
$store.commit("setSelectedWindow", props.window.uuid); $store.commit("setSelectedWindow", props.window.uuid);
} }
} }
@ -562,10 +582,6 @@ export default defineComponent({
} }
cleanMouseDownFlag(); cleanMouseDownFlag();
} }
// if (!focused) {
// emit("window_fouse_in", props.window.window_id);
// }
}, },
getItemIcon(item_type: string) { getItemIcon(item_type: string) {

View File

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

View File

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

View File

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

View File

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