This commit is contained in:
parent
cd7b7cc555
commit
c4491b0248
@ -171,9 +171,6 @@ mod cpal_impl {
|
||||
}
|
||||
|
||||
fn get_audio_input(audio_input: &str) -> ResultType<(Device, SupportedStreamConfig)> {
|
||||
if audio_input == "Mute" {
|
||||
bail!("Mute");
|
||||
}
|
||||
let mut device = None;
|
||||
if !audio_input.is_empty() {
|
||||
for d in HOST
|
||||
|
@ -137,7 +137,7 @@ impl Connection {
|
||||
authorized: false,
|
||||
keyboard: Config::get_option("enable-keyboard").is_empty(),
|
||||
clipboard: Config::get_option("enable-clipboard").is_empty(),
|
||||
audio: Config::get_option("audio-input") != "Mute",
|
||||
audio: Config::get_option("enable-audio").is_empty(),
|
||||
file: Config::get_option("enable-file-transfer").is_empty(),
|
||||
last_test_delay: 0,
|
||||
image_quality: ImageQuality::Balanced.value(),
|
||||
|
@ -191,14 +191,14 @@ impl ConnectionManager {
|
||||
}
|
||||
}
|
||||
},
|
||||
#[cfg(windows)]
|
||||
Data::ClipbaordFile(_clip) => {
|
||||
#[cfg(windows)]
|
||||
_tx_clip_file
|
||||
.send(ClipboardFileData::Clip((id, _clip)))
|
||||
.ok();
|
||||
}
|
||||
#[cfg(windows)]
|
||||
Data::ClipboardFileEnabled(enabled) => {
|
||||
#[cfg(windows)]
|
||||
_tx_clip_file
|
||||
.send(ClipboardFileData::Enable((id, enabled)))
|
||||
.ok();
|
||||
@ -342,6 +342,7 @@ impl sciter::EventHandler for ConnectionManager {
|
||||
}
|
||||
|
||||
enum ClipboardFileData {
|
||||
#[cfg(windows)]
|
||||
Clip((i32, ipc::ClipbaordFile)),
|
||||
Enable((i32, bool)),
|
||||
}
|
||||
@ -436,10 +437,6 @@ async fn start_pa() {
|
||||
{
|
||||
device = x;
|
||||
}
|
||||
if device == "Mute" {
|
||||
log::info!("Switch mute mode, skip sample audio.");
|
||||
continue;
|
||||
}
|
||||
if !device.is_empty() {
|
||||
device = crate::platform::linux::get_pa_source_name(&device);
|
||||
}
|
||||
|
@ -97,11 +97,12 @@ class AudioInputs: Reactor.Component {
|
||||
var inputs = handler.get_sound_inputs();
|
||||
if (is_win) inputs = ["System Sound"].concat(inputs);
|
||||
if (!inputs.length) return <li style="display:hidden" />;
|
||||
inputs = ["Mute"].concat(inputs);
|
||||
var me = this;
|
||||
self.timer(1ms, function() { me.toggleMenuState() });
|
||||
return <li>{translate('Audio Input')}
|
||||
<menu #audio-input key={inputs.length}>
|
||||
<li #enable-audio><span>{svg_checkmark}</span>{translate("Mute")}</li>
|
||||
<div .separator />
|
||||
{inputs.map(function(name) {
|
||||
return <li id={name}><span>{svg_checkmark}</span>{translate(name)}</li>;
|
||||
})}
|
||||
@ -119,8 +120,12 @@ class AudioInputs: Reactor.Component {
|
||||
}
|
||||
|
||||
function toggleMenuState() {
|
||||
var el = this.$(li#enable-audio);
|
||||
var enabled = handler.get_option(el.id) != "N";
|
||||
el.attributes.toggleClass("selected", !enabled);
|
||||
var v = this.get_value();
|
||||
for (var el in $$(menu#audio-input>li)) {
|
||||
for (var el in this.$$(menu#audio-input>li)) {
|
||||
if (el.id == 'enable-audio') continue;
|
||||
var selected = el.id == v;
|
||||
el.attributes.toggleClass("selected", selected);
|
||||
}
|
||||
@ -128,9 +133,13 @@ class AudioInputs: Reactor.Component {
|
||||
|
||||
event click $(menu#audio-input>li) (_, me) {
|
||||
var v = me.id;
|
||||
if (v == this.get_value()) return;
|
||||
if (v == this.get_default()) v = "";
|
||||
handler.set_option("audio-input", v);
|
||||
if (v == 'enable-audio') {
|
||||
handler.set_option(v, handler.get_option(v) != 'N' ? 'N' : '');
|
||||
} else {
|
||||
if (v == this.get_value()) return;
|
||||
if (v == this.get_default()) v = "";
|
||||
handler.set_option("audio-input", v);
|
||||
}
|
||||
this.toggleMenuState();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user