other bool default display settings

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-02-02 09:39:14 +08:00
parent 359f19af02
commit 92145eeb71
36 changed files with 159 additions and 41 deletions

View File

@@ -956,7 +956,7 @@ impl LoginConfigHandler {
/// Check if the client should auto login.
/// Return password if the client should auto login, otherwise return empty string.
pub fn should_auto_login(&self) -> String {
let l = self.lock_after_session_end;
let l = self.lock_after_session_end.v;
let a = !self.get_option("auto-login").is_empty();
let p = self.get_option("os-password");
if !p.is_empty() && l && a {
@@ -1063,32 +1063,32 @@ impl LoginConfigHandler {
let mut option = OptionMessage::default();
let mut config = self.load_config();
if name == "show-remote-cursor" {
config.show_remote_cursor = !config.show_remote_cursor;
option.show_remote_cursor = (if config.show_remote_cursor {
config.show_remote_cursor.v = !config.show_remote_cursor.v;
option.show_remote_cursor = (if config.show_remote_cursor.v {
BoolOption::Yes
} else {
BoolOption::No
})
.into();
} else if name == "disable-audio" {
config.disable_audio = !config.disable_audio;
option.disable_audio = (if config.disable_audio {
config.disable_audio.v = !config.disable_audio.v;
option.disable_audio = (if config.disable_audio.v {
BoolOption::Yes
} else {
BoolOption::No
})
.into();
} else if name == "disable-clipboard" {
config.disable_clipboard = !config.disable_clipboard;
option.disable_clipboard = (if config.disable_clipboard {
config.disable_clipboard.v = !config.disable_clipboard.v;
option.disable_clipboard = (if config.disable_clipboard.v {
BoolOption::Yes
} else {
BoolOption::No
})
.into();
} else if name == "lock-after-session-end" {
config.lock_after_session_end = !config.lock_after_session_end;
option.lock_after_session_end = (if config.lock_after_session_end {
config.lock_after_session_end.v = !config.lock_after_session_end.v;
option.lock_after_session_end = (if config.lock_after_session_end.v {
BoolOption::Yes
} else {
BoolOption::No
@@ -1096,15 +1096,15 @@ impl LoginConfigHandler {
.into();
} else if name == "privacy-mode" {
// try toggle privacy mode
option.privacy_mode = (if config.privacy_mode {
option.privacy_mode = (if config.privacy_mode.v {
BoolOption::No
} else {
BoolOption::Yes
})
.into();
} else if name == "enable-file-transfer" {
config.enable_file_transfer = !config.enable_file_transfer;
option.enable_file_transfer = (if config.enable_file_transfer {
config.enable_file_transfer.v = !config.enable_file_transfer.v;
option.enable_file_transfer = (if config.enable_file_transfer.v {
BoolOption::Yes
} else {
BoolOption::No
@@ -1115,7 +1115,7 @@ impl LoginConfigHandler {
} else if name == "unblock-input" {
option.block_input = BoolOption::No.into();
} else if name == "show-quality-monitor" {
config.show_quality_monitor = !config.show_quality_monitor;
config.show_quality_monitor.v = !config.show_quality_monitor.v;
} else {
let v = self.options.get(&name).is_some();
if v {
@@ -1252,19 +1252,19 @@ impl LoginConfigHandler {
/// * `name` - The name of the toggle option.
pub fn get_toggle_option(&self, name: &str) -> bool {
if name == "show-remote-cursor" {
self.config.show_remote_cursor
self.config.show_remote_cursor.v
} else if name == "lock-after-session-end" {
self.config.lock_after_session_end
self.config.lock_after_session_end.v
} else if name == "privacy-mode" {
self.config.privacy_mode
self.config.privacy_mode.v
} else if name == "enable-file-transfer" {
self.config.enable_file_transfer
self.config.enable_file_transfer.v
} else if name == "disable-audio" {
self.config.disable_audio
self.config.disable_audio.v
} else if name == "disable-clipboard" {
self.config.disable_clipboard
self.config.disable_clipboard.v
} else if name == "show-quality-monitor" {
self.config.show_quality_monitor
self.config.show_quality_monitor.v
} else {
!self.get_option(name).is_empty()
}

View File

@@ -277,7 +277,7 @@ impl<T: InvokeUiSession> Remote<T> {
}
if !SERVER_CLIPBOARD_ENABLED.load(Ordering::SeqCst)
|| !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst)
|| lc.read().unwrap().disable_clipboard
|| lc.read().unwrap().disable_clipboard.v
{
continue;
}
@@ -778,7 +778,7 @@ impl<T: InvokeUiSession> Remote<T> {
|| self.handler.is_port_forward()
|| !SERVER_CLIPBOARD_ENABLED.load(Ordering::SeqCst)
|| !SERVER_KEYBOARD_ENABLED.load(Ordering::SeqCst)
|| self.handler.lc.read().unwrap().disable_clipboard)
|| self.handler.lc.read().unwrap().disable_clipboard.v)
{
let txt = self.old_clipboard.lock().unwrap().clone();
if !txt.is_empty() {
@@ -808,7 +808,7 @@ impl<T: InvokeUiSession> Remote<T> {
self.handler.set_cursor_position(cp);
}
Some(message::Union::Clipboard(cb)) => {
if !self.handler.lc.read().unwrap().disable_clipboard {
if !self.handler.lc.read().unwrap().disable_clipboard.v {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
update_clipboard(cb, Some(&self.old_clipboard));
#[cfg(any(target_os = "android", target_os = "ios"))]
@@ -1121,7 +1121,7 @@ impl<T: InvokeUiSession> Remote<T> {
self.handler.handle_test_delay(t, peer).await;
}
Some(message::Union::AudioFrame(frame)) => {
if !self.handler.lc.read().unwrap().disable_audio {
if !self.handler.lc.read().unwrap().disable_audio.v {
self.audio_sender.send(MediaData::AudioFrame(frame)).ok();
}
}
@@ -1204,7 +1204,7 @@ impl<T: InvokeUiSession> Remote<T> {
#[inline(always)]
fn update_privacy_mode(&mut self, on: bool) {
let mut config = self.handler.load_config();
config.privacy_mode = on;
config.privacy_mode.v = on;
self.handler.save_config(config);
self.handler.update_privacy_mode();
@@ -1278,14 +1278,14 @@ impl<T: InvokeUiSession> Remote<T> {
#[cfg(windows)]
{
let enabled = SERVER_FILE_TRANSFER_ENABLED.load(Ordering::SeqCst)
&& self.handler.lc.read().unwrap().enable_file_transfer;
&& self.handler.lc.read().unwrap().enable_file_transfer.v;
ContextSend::enable(enabled);
}
}
#[cfg(windows)]
fn handle_cliprdr_msg(&self, clip: hbb_common::message_proto::Cliprdr) {
if !self.handler.lc.read().unwrap().disable_clipboard {
if !self.handler.lc.read().unwrap().disable_clipboard.v {
#[cfg(feature = "flutter")]
if let Some(hbb_common::message_proto::cliprdr::Union::FormatList(_)) = &clip.union {
if self.client_conn_id

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", "波特率"),
("FPS", "帧率"),
("Auto", "自动"),
("Other Default Options", "其它默认选项"),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", "波特率"),
("FPS", "幀率"),
("Auto", "自動"),
("Other Default Options", "其它默認選項"),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}

View File

@@ -444,5 +444,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Bitrate", ""),
("FPS", ""),
("Auto", ""),
("Other Default Options", ""),
].iter().cloned().collect();
}