添加窗口全屏功能

This commit is contained in:
fangxiang 2022-04-24 15:22:43 +08:00
parent 9b33a7783b
commit 4ff3d25fed
6 changed files with 67 additions and 22 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "media_player_client", "name": "media_player_client",
"version": "1.4.0", "version": "1.4.1",
"description": "A Quasar Framework app", "description": "A Quasar Framework app",
"productName": "MediaPlayerClient", "productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>", "author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -644,6 +644,12 @@ export default class ClientConnection {
); );
} }
public windowFullScreen(window_id: number, full_screen: boolean) {
this.ws?.send(
JSON.stringify(new Protocol.WindowFullScreen(window_id, full_screen))
);
}
public async getSubtitle() { public async getSubtitle() {
try { try {
return await this.doRpc<Protocol.GetSubtitleResponseEntity>( return await this.doRpc<Protocol.GetSubtitleResponseEntity>(

View File

@ -385,6 +385,9 @@ export namespace Protocol {
public static get kRpcSetConnectionItem() { public static get kRpcSetConnectionItem() {
return Commands.PROTOCOL_PREFIX + "RpcSetConnectionItem"; return Commands.PROTOCOL_PREFIX + "RpcSetConnectionItem";
} }
public static get kWindowFullScreen() {
return Commands.PROTOCOL_PREFIX + "WindowFullScreen";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
@ -482,8 +485,8 @@ export namespace Protocol {
Commands.kRpcSetExternalControlSerialPortConfig, Commands.kRpcSetExternalControlSerialPortConfig,
Commands.kRpcGetConnectionList, Commands.kRpcGetConnectionList,
Commands.kRpcSetConnectionItem, Commands.kRpcSetConnectionItem,
Commands.kWindowFullScreen,
]); ]);
public static get AllCommands() { public static get AllCommands() {
return this._all_commands; return this._all_commands;
} }
@ -2447,4 +2450,17 @@ export namespace Protocol {
success = false; success = false;
} }
export class WindowFullScreen extends PacketEntity {
constructor(window_id: number, full_screen: boolean, rpc_id = 0) {
super();
super.command = Commands.kWindowFullScreen;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.window_id = window_id;
this.full_screen = full_screen;
}
window_id: number;
full_screen: boolean;
}
} }

View File

@ -22,7 +22,8 @@ export default {
"Please type something": "请输入内容", "Please type something": "请输入内容",
"grid setting": "宫格设置", "grid setting": "宫格设置",
"background image": "底图设置", "background image": "底图",
"background image setting": "底图设置",
"data import": "数据导入", "data import": "数据导入",
"data export": "数据导出", "data export": "数据导出",
"database import": "数据恢复", "database import": "数据恢复",
@ -477,4 +478,6 @@ export default {
_SOFT_PAD_LOGIN_TITLE_: "软件管理平台", _SOFT_PAD_LOGIN_TITLE_: "软件管理平台",
welcome: "欢迎", welcome: "欢迎",
"plan running! can't open window!": "预案正在运行!不能开窗!", "plan running! can't open window!": "预案正在运行!不能开窗!",
"full screen window": "全屏",
"restore window size": "恢复",
}; };

View File

@ -4,7 +4,7 @@
style="flex-wrap: wrap" style="flex-wrap: wrap"
> >
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -15,7 +15,7 @@
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -26,38 +26,49 @@
/> />
<q-btn <q-btn
class="col-auto" class="col"
v-if="true || $q.fullscreen.isCapable"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
flat flat
icon="img:pad/toolbar/full_screen_icon.png" icon="img:pad/toolbar/full_screen_icon.png"
:label="$t('full screen')" :label="$t('full screen window')"
@click="fullscreenWindow" @click="fullscreenWindow"
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch
stack
flat
icon="img:pad/toolbar/exit_full_screen_icon.png"
:label="$t('restore window size')"
@click="exitFullscreenWindow"
/>
<q-btn
class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
flat flat
icon="img:pad/toolbar/top_window_icon.png" icon="img:pad/toolbar/top_window_icon.png"
:label="$t('top window')" :label="$t('win top')"
@click="topWindow" @click="topWindow"
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
flat flat
icon="img:pad/toolbar/lower_window_icon.png" icon="img:pad/toolbar/lower_window_icon.png"
:label="$t('lower window')" :label="$t('win lower')"
@click="lowerWindow" @click="lowerWindow"
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -67,7 +78,7 @@
@click="$refs.center_control_dialog.showDialog()" @click="$refs.center_control_dialog.showDialog()"
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -77,7 +88,7 @@
@click="powerOn" @click="powerOn"
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -109,7 +120,7 @@
@click="$refs.file_manage_dialog.showDialog()" @click="$refs.file_manage_dialog.showDialog()"
/> />
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -118,9 +129,9 @@
:label="$t('background image')" :label="$t('background image')"
@click="$refs.background_image_dialog.showDialog()" @click="$refs.background_image_dialog.showDialog()"
/> />
<q-space /> <div class="col"></div>
<q-btn <q-btn
class="col-auto" class="col"
:class="$store.state.landspace ? 'q-mx-sm' : ''" :class="$store.state.landspace ? 'q-mx-sm' : ''"
stretch stretch
stack stack
@ -145,7 +156,6 @@ import BackgroundImageDialog from "src/components/BackgroundImageDialog.vue";
import FileManageDialog from "src/components/FileManageDialog.vue"; import FileManageDialog from "src/components/FileManageDialog.vue";
import CenterControlDialog from "src/components/CenterControlDialog.vue"; import CenterControlDialog from "src/components/CenterControlDialog.vue";
import { AppFullscreen } from "quasar";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
export default defineComponent({ export default defineComponent({
@ -191,7 +201,7 @@ export default defineComponent({
if ($q.fullscreen.isActive) { if ($q.fullscreen.isActive) {
$q.fullscreen.exit(); $q.fullscreen.exit();
} else { } else {
AppFullscreen.request().catch((e: any) => { $q.fullscreen.request().catch((e: any) => {
console.log(e); console.log(e);
}); });
} }
@ -226,7 +236,17 @@ export default defineComponent({
if (window) { if (window) {
GlobalData.getInstance() GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.setWindowGeometry(window.window_id, 0, 0, 1, 1); ?.windowFullScreen(window.window_id, true);
}
},
exitFullscreenWindow() {
const window = $store.state.windows.find(
(element) => element && element.uuid == $store.state.selected_window
);
if (window) {
GlobalData.getInstance()
.getCurrentClient()
?.windowFullScreen(window.window_id, false);
} }
}, },
closeCurrentWindow() { closeCurrentWindow() {

View File

@ -225,7 +225,7 @@
<q-icon name="img:new_icon/background_image.png" /> <q-icon name="img:new_icon/background_image.png" />
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
{{ $t("background image") }} {{ $t("background image setting") }}
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item <q-item