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": + "声卡修改后重启才会生效,是否重启", };