From 3d7f9b82ea1e6a9927f907a06d4cea0705553133 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Wed, 22 Dec 2021 16:50:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A3=B0=E5=8D=A1=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=90=8E=E7=9A=84=E9=87=8D=E5=90=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?,=E9=9A=90=E8=97=8F=E7=B3=BB=E7=BB=9F=E5=A3=B0=E9=9F=B3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SystemSettingDialog.vue | 100 ++++++++++++++++--------- src/i18n/zh-CN/index.ts | 2 + 2 files changed, 68 insertions(+), 34 deletions(-) diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index 5e44853..8830438 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -312,7 +312,7 @@ /> - + {{ $t("muted") + ":" }} @@ -325,7 +325,7 @@ /> - + {{ $t("volume") + ":" }} @@ -791,6 +791,7 @@ export default defineComponent({ { label: "3.5mm", value: "3.5mm" }, { label: "HDMI1", value: "HDMI1" }, ]); + let old_output_audio_card = ""; let output_audio_card = ref(output_audio_card_options.value[0].value); let use_ntp = ref($t.t("enable")); let ntp_server = ref(""); @@ -894,6 +895,7 @@ export default defineComponent({ const config = GlobalData.getInstance()?.applicationConfig; if (config) { output_audio_card.value = config.output_audio_card; + old_output_audio_card = output_audio_card.value; let muted = parseInt(config.system_muted.toString()); if (isNaN(muted)) { muted = 0; @@ -1014,6 +1016,38 @@ export default defineComponent({ ?.setSystemGraphics(request); await wait_for(1000 * 3); 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 {} $q.notify({ color: success ? "positive" : "negative", @@ -1025,38 +1059,6 @@ export default defineComponent({ position: "top", 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_rotate = device_rotate.value; loading.value = false; @@ -1088,6 +1090,35 @@ export default defineComponent({ .getCurrentClient() ?.setSystemOther(request); 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 {} $q.notify({ color: success ? "positive" : "negative", @@ -1099,6 +1130,7 @@ export default defineComponent({ position: "top", timeout: 2500, }); + old_output_audio_card = request.output_audio_card; loading.value = false; }; diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 0c50024..d9f6beb 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -268,4 +268,6 @@ export default { "the system will reboot after the setup is complete": "系统将在设置完成后重启", "restart command send": "重启指令发送", + "the sound card takes effect only after it is restarted. Restart the system": + "声卡修改后重启才会生效,是否重启", };