增加输出板拼接索引修改功能

This commit is contained in:
fangxiang 2022-11-18 09:09:22 +08:00
parent 84c541dd76
commit ec365027e9
3 changed files with 152 additions and 12 deletions

View File

@ -895,6 +895,23 @@ export default class ClientConnection {
console.error(e);
}
}
public async setOutputBoardSpliceIndex(
device_index: number,
splice_index: number
) {
try {
return await this.doRpc<Protocol.RpcOutputBoardSpliceIndexResponseEntity>(
new Protocol.RpcOutputBoardSpliceIndexRequestEntity(
device_index,
splice_index
)
);
} catch (e) {
console.error(e);
}
}
public async setWindowVolume(window_id: number, volume: number) {
this.ws?.send(
JSON.stringify(

View File

@ -101,7 +101,7 @@
<q-card-section style="width: 55vw">
<div
style="max-height: 50vh"
:style="{ height: screen_mode == 0 ? '20vh' : '40vh' }"
:style="{ height: screen_mode == 0 ? '28vh' : '48vh' }"
class="row items-center justify-center"
>
<div
@ -121,17 +121,50 @@
class="preview_grid_item col row items-center justify-center"
:key="(row - 1) * preview_cols + col"
>
<span>
{{ (row - 1) * preview_cols + col }}
</span>
<span
v-if="
(preview_rotation == 1 || preview_rotation == 180) &&
row == 1
"
>
(180°)
</span>
<div class="fit row items-center justify-center">
<div class="preview_wall_item">
<span>
&nbsp;&nbsp;OI:{{ (row - 1) * preview_cols + col }}
</span>
<br />
<span
v-if="
outputs.length > (row - 1) * preview_cols + col - 1
"
>
&nbsp;&nbsp;NI:{{
(outputs[(row - 1) * preview_cols + col - 1]
.output_index ?? (row - 1) * preview_cols + col) + 1
}}</span
>
<br />
<span
v-if="
(preview_rotation == 1 || preview_rotation == 180) &&
row == 1
"
>
(180°)
</span>
</div>
<q-popup-proxy context-menu>
<q-item
clickable
v-close-popup
@click="
setSpliceIndex(
(row - 1) * preview_cols + col - 1,
outputs[(row - 1) * preview_cols + col - 1]
.output_index ?? (row - 1) * preview_cols + col
)
"
>
<q-item-section>{{
$t("set splice index")
}}</q-item-section>
</q-item>
</q-popup-proxy>
</div>
</div>
</div>
</div>
@ -236,6 +269,9 @@ export default defineComponent({
const preview_cols = ref(3);
const preview_rotation = ref(0);
const previce_grid_height = ref(100);
const outputs: Ref<OutputBoardItemConfigEntity[]> = ref(
<OutputBoardItemConfigEntity[]>[]
);
class parseSpliceModeResult {
rotation = 0;
@ -326,6 +362,7 @@ export default defineComponent({
preview_cols,
preview_rotation,
previce_grid_height,
outputs,
async showDialog() {
{
@ -345,6 +382,7 @@ export default defineComponent({
const video_wall_config = await GlobalData.getInstance()
.getCurrentClient()
?.customConnection.getVideoWallConfig();
outputs.value = video_wall_config?.outputs ?? [];
if (video_wall_config) {
if (screen_mode.value == 0) {
splice_mode.value =
@ -436,6 +474,64 @@ export default defineComponent({
});
loading.value = false;
},
setSpliceIndex(device_index: number, splice_index: number) {
let items = [];
for (let i = 0; i < 25; ++i) {
items.push({
label: (i + 1).toString(),
value: i.toString(),
});
}
$q.dialog({
title: $t.t("set splice index"),
message: $t.t("please select new index") + "!",
options: {
type: "radio",
model: splice_index.toString(),
items: items,
isValid: (v) => v != splice_index.toString(),
},
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
}).onOk(async (data) => {
const temp = parseInt(data);
let success = false;
if (!isNaN(temp)) {
const response = await GlobalData.getInstance()
.getCurrentClient()
?.setOutputBoardSpliceIndex(device_index, temp);
if (response) {
success = response.success;
if (success) {
const item = outputs.value.find(
(e) => e && e.index == response.device_index
);
if (item) {
item.output_index = response.splice_index;
}
}
}
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
message:
$t.t("set splice index") +
$t.t(success ? "success" : "failed") +
"!",
position: "top",
timeout: 2500,
});
});
},
};
},
});

View File

@ -295,6 +295,10 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "SwitchOutputBoardSplitState";
}
public static get kRpcOutputBoardSpliceIndex() {
return Commands.PROTOCOL_PREFIX + "RpcOutputBoardSpliceIndex";
}
public static get kSetWindowVolume() {
return Commands.PROTOCOL_PREFIX + "SetWindowVolume";
}
@ -537,6 +541,7 @@ export namespace Protocol {
Commands.kOutputBoardSettingNotify,
Commands.kRpcSetOutputBoardSetting,
Commands.kRpcGetOutputBoardSetting,
Commands.kRpcOutputBoardSpliceIndex,
Commands.kSetWindowVolume,
Commands.kMuteWidow,
Commands.kUnMuteWidow,
@ -1957,6 +1962,28 @@ export namespace Protocol {
}
}
export class RpcOutputBoardSpliceIndexRequestEntity extends Protocol.PacketEntity {
device_index = 0;
splice_index = 0;
constructor(device_index: number, splice_index: number, rcp_id?: number) {
super();
this.rpc_id = rcp_id ?? 0;
this.command = Protocol.Commands.kRpcOutputBoardSpliceIndex;
this.device_index = device_index;
this.splice_index = splice_index;
}
}
export class RpcOutputBoardSpliceIndexResponseEntity extends Protocol.PacketEntity {
success = false;
device_index = 0;
splice_index = 0;
constructor() {
super();
this.command = Protocol.Commands.kRpcOutputBoardSpliceIndex;
}
}
export class OutputBoardSettingNotify extends Protocol.PacketEntity {
splicing = false;
wall_rows = 2;