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