feat: add audio mode in sciter

This commit is contained in:
Kingtous 2023-01-30 23:42:38 +08:00
parent 05822991bf
commit cab1fc719a
2 changed files with 11 additions and 1 deletions

View File

@ -183,6 +183,9 @@ class Header: Reactor.Component {
<li #balanced type="image-quality"><span>{svg_checkmark}</span>{translate('Balanced')}</li> <li #balanced type="image-quality"><span>{svg_checkmark}</span>{translate('Balanced')}</li>
<li #low type="image-quality"><span>{svg_checkmark}</span>{translate('Optimize reaction time')}</li> <li #low type="image-quality"><span>{svg_checkmark}</span>{translate('Optimize reaction time')}</li>
<li #custom type="image-quality"><span>{svg_checkmark}</span>{translate('Custom')}</li> <li #custom type="image-quality"><span>{svg_checkmark}</span>{translate('Custom')}</li>
<div .separator />
<li #guest-to-host type="audio-mode"><span>{svg_checkmark}</span>{translate('Guest to Host')}</li>
<li #dual-way type="audio-mode"><span>{svg_checkmark}</span>{translate('Dual way')}</li>
{show_codec ? <div> {show_codec ? <div>
<div .separator /> <div .separator />
<li #auto type="codec-preference"><span>{svg_checkmark}</span>Auto</li> <li #auto type="codec-preference"><span>{svg_checkmark}</span>Auto</li>
@ -391,6 +394,8 @@ class Header: Reactor.Component {
} else if (type == "codec-preference") { } else if (type == "codec-preference") {
handler.set_option("codec-preference", me.id); handler.set_option("codec-preference", me.id);
handler.change_prefer_codec(); handler.change_prefer_codec();
} else if (type == "audio-mode") {
handler.save_audio_mode(me.id);
} }
toggleMenuState(); toggleMenuState();
} }
@ -434,6 +439,9 @@ function toggleMenuState() {
var c = handler.get_option("codec-preference"); var c = handler.get_option("codec-preference");
if (!c) c = "auto"; if (!c) c = "auto";
values.push(c); values.push(c);
var a = handler.get_audio_mode();
if (!a) a = "guest-to-host";
values.push(a);
for (var el in $$(menu#display-options li)) { for (var el in $$(menu#display-options li)) {
el.attributes.toggleClass("selected", values.indexOf(el.id) >= 0); el.attributes.toggleClass("selected", values.indexOf(el.id) >= 0);
} }

View File

@ -420,6 +420,8 @@ impl sciter::EventHandler for SciterSession {
fn supported_hwcodec(); fn supported_hwcodec();
fn change_prefer_codec(); fn change_prefer_codec();
fn restart_remote_device(); fn restart_remote_device();
fn save_audio_mode(String);
fn get_audio_mode();
} }
} }