添加声卡切换后的重启提示,隐藏系统声音修改

This commit is contained in:
fangxiang 2021-12-22 16:50:30 +08:00
parent 6e29a5350c
commit 3d7f9b82ea
2 changed files with 68 additions and 34 deletions

View File

@ -312,7 +312,7 @@
/> />
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item> <q-item v-if="false">
<q-item-section avatar class="width_5_3">{{ <q-item-section avatar class="width_5_3">{{
$t("muted") + ":" $t("muted") + ":"
}}</q-item-section> }}</q-item-section>
@ -325,7 +325,7 @@
/> />
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item v-if="system_muted == $t('off')"> <q-item v-if="false && system_muted == $t('off')">
<q-item-section avatar class="width_5_3">{{ <q-item-section avatar class="width_5_3">{{
$t("volume") + ":" $t("volume") + ":"
}}</q-item-section> }}</q-item-section>
@ -791,6 +791,7 @@ export default defineComponent({
{ label: "3.5mm", value: "3.5mm" }, { label: "3.5mm", value: "3.5mm" },
{ label: "HDMI1", value: "HDMI1" }, { label: "HDMI1", value: "HDMI1" },
]); ]);
let old_output_audio_card = "";
let output_audio_card = ref(output_audio_card_options.value[0].value); let output_audio_card = ref(output_audio_card_options.value[0].value);
let use_ntp = ref($t.t("enable")); let use_ntp = ref($t.t("enable"));
let ntp_server = ref(""); let ntp_server = ref("");
@ -894,6 +895,7 @@ export default defineComponent({
const config = GlobalData.getInstance()?.applicationConfig; const config = GlobalData.getInstance()?.applicationConfig;
if (config) { if (config) {
output_audio_card.value = config.output_audio_card; output_audio_card.value = config.output_audio_card;
old_output_audio_card = output_audio_card.value;
let muted = parseInt(config.system_muted.toString()); let muted = parseInt(config.system_muted.toString());
if (isNaN(muted)) { if (isNaN(muted)) {
muted = 0; muted = 0;
@ -1014,6 +1016,38 @@ export default defineComponent({
?.setSystemGraphics(request); ?.setSystemGraphics(request);
await wait_for(1000 * 3); await wait_for(1000 * 3);
success = true; success = true;
if (
old_resolution != device_resolution.value ||
old_rotate != device_rotate.value
) {
try {
$q.dialog({
title: "Confirm",
message:
$t.t(
"major graphics parameters have been changed and need to be restarted to take effect. Restart the system"
) + "?",
cancel: true,
persistent: true,
}).onOk(async () => {
await GlobalData.getInstance()
.getCurrentClient()
?.restartDevice(1000 * 3);
$q.notify({
color: "positive",
icon: "done",
message:
$t.t("restart command send") +
$t.t("success") +
"!" +
$t.t("the system will reboot after the setup is complete") +
"!",
position: "top",
timeout: 2500,
});
});
} catch {}
}
} catch {} } catch {}
$q.notify({ $q.notify({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
@ -1025,38 +1059,6 @@ export default defineComponent({
position: "top", position: "top",
timeout: 2500, timeout: 2500,
}); });
if (
old_resolution != device_resolution.value ||
old_rotate != device_rotate.value
) {
try {
$q.dialog({
title: "Confirm",
message:
$t.t(
"major graphics parameters have been changed and need to be restarted to take effect. Restart the system"
) + "?",
cancel: true,
persistent: true,
}).onOk(async () => {
await GlobalData.getInstance()
.getCurrentClient()
?.restartDevice(1000 * 3);
$q.notify({
color: "positive",
icon: "done",
message:
$t.t("restart command send") +
$t.t("success") +
"!" +
$t.t("the system will reboot after the setup is complete") +
"!",
position: "top",
timeout: 2500,
});
});
} catch {}
}
old_resolution = device_resolution.value; old_resolution = device_resolution.value;
old_rotate = device_rotate.value; old_rotate = device_rotate.value;
loading.value = false; loading.value = false;
@ -1088,6 +1090,35 @@ export default defineComponent({
.getCurrentClient() .getCurrentClient()
?.setSystemOther(request); ?.setSystemOther(request);
success = true; success = true;
if (old_output_audio_card != request.output_audio_card) {
try {
$q.dialog({
title: "Confirm",
message:
$t.t(
"the sound card takes effect only after it is restarted. Restart the system"
) + "?",
cancel: true,
persistent: true,
}).onOk(async () => {
await GlobalData.getInstance()
.getCurrentClient()
?.restartDevice(1000 * 3);
$q.notify({
color: "positive",
icon: "done",
message:
$t.t("restart command send") +
$t.t("success") +
"!" +
$t.t("the system will reboot after the setup is complete") +
"!",
position: "top",
timeout: 2500,
});
});
} catch {}
}
} catch {} } catch {}
$q.notify({ $q.notify({
color: success ? "positive" : "negative", color: success ? "positive" : "negative",
@ -1099,6 +1130,7 @@ export default defineComponent({
position: "top", position: "top",
timeout: 2500, timeout: 2500,
}); });
old_output_audio_card = request.output_audio_card;
loading.value = false; loading.value = false;
}; };

View File

@ -268,4 +268,6 @@ export default {
"the system will reboot after the setup is complete": "the system will reboot after the setup is complete":
"系统将在设置完成后重启", "系统将在设置完成后重启",
"restart command send": "重启指令发送", "restart command send": "重启指令发送",
"the sound card takes effect only after it is restarted. Restart the system":
"声卡修改后重启才会生效,是否重启",
}; };