mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
enable rust default option
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -974,6 +974,8 @@ impl LoginConfigHandler {
|
||||
self.save_config(config);
|
||||
}
|
||||
|
||||
//to-do: too many dup code below.
|
||||
|
||||
/// Save view style to the current config.
|
||||
///
|
||||
/// # Arguments
|
||||
@@ -985,13 +987,24 @@ impl LoginConfigHandler {
|
||||
self.save_config(config);
|
||||
}
|
||||
|
||||
/// Save scroll style to the current config.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `value` - The view style to be saved.
|
||||
pub fn save_scroll_style(&mut self, value: String) {
|
||||
let mut config = self.load_config();
|
||||
config.scroll_style = value;
|
||||
self.save_config(config);
|
||||
}
|
||||
|
||||
/// Set a ui config of flutter for handler's [`PeerConfig`].
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `k` - key of option
|
||||
/// * `v` - value of option
|
||||
pub fn set_ui_flutter(&mut self, k: String, v: String) {
|
||||
pub fn save_ui_flutter(&mut self, k: String, v: String) {
|
||||
let mut config = self.load_config();
|
||||
config.ui_flutter.insert(k, v);
|
||||
self.save_config(config);
|
||||
|
||||
@@ -170,7 +170,7 @@ pub fn session_get_flutter_config(id: String, k: String) -> Option<String> {
|
||||
|
||||
pub fn session_set_flutter_config(id: String, k: String, v: String) {
|
||||
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
|
||||
session.set_flutter_config(k, v);
|
||||
session.save_flutter_config(k, v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,34 @@ pub fn set_local_flutter_config(k: String, v: String) {
|
||||
ui_interface::set_local_flutter_config(k, v);
|
||||
}
|
||||
|
||||
pub fn session_get_view_style(id: String) -> Option<String> {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
Some(session.get_view_style())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_set_view_style(id: String, value: String) {
|
||||
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
|
||||
session.save_view_style(value);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_get_scroll_style(id: String) -> Option<String> {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
Some(session.get_scroll_style())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_set_scroll_style(id: String, value: String) {
|
||||
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
|
||||
session.save_scroll_style(value);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_get_image_quality(id: String) -> Option<String> {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
Some(session.get_image_quality())
|
||||
|
||||
@@ -25,12 +25,16 @@ use hbb_common::tokio::sync::{
|
||||
mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender},
|
||||
Mutex as TokioMutex,
|
||||
};
|
||||
#[cfg(not(windows))]
|
||||
use scrap::Capturer;
|
||||
use scrap::{
|
||||
codec::{Encoder, EncoderCfg, HwEncoderConfig},
|
||||
record::{Recorder, RecorderContext},
|
||||
vpxcodec::{VpxEncoderConfig, VpxVideoCodecId},
|
||||
Capturer, Display, TraitCapturer,
|
||||
Display, TraitCapturer,
|
||||
};
|
||||
#[cfg(windows)]
|
||||
use std::sync::Once;
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
io::ErrorKind::WouldBlock,
|
||||
@@ -38,8 +42,6 @@ use std::{
|
||||
time::{self, Duration, Instant},
|
||||
};
|
||||
#[cfg(windows)]
|
||||
use std::sync::Once;
|
||||
#[cfg(windows)]
|
||||
use virtual_display;
|
||||
|
||||
pub const SCRAP_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version.";
|
||||
|
||||
@@ -79,6 +79,10 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
self.lc.read().unwrap().view_style.clone()
|
||||
}
|
||||
|
||||
pub fn get_scroll_style(&self) -> String {
|
||||
self.lc.read().unwrap().scroll_style.clone()
|
||||
}
|
||||
|
||||
pub fn get_image_quality(&self) -> String {
|
||||
self.lc.read().unwrap().image_quality.clone()
|
||||
}
|
||||
@@ -99,8 +103,12 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
self.lc.write().unwrap().save_view_style(value);
|
||||
}
|
||||
|
||||
pub fn set_flutter_config(&mut self, k: String, v: String) {
|
||||
self.lc.write().unwrap().set_ui_flutter(k, v);
|
||||
pub fn save_scroll_style(&mut self, value: String) {
|
||||
self.lc.write().unwrap().save_scroll_style(value);
|
||||
}
|
||||
|
||||
pub fn save_flutter_config(&mut self, k: String, v: String) {
|
||||
self.lc.write().unwrap().save_ui_flutter(k, v);
|
||||
}
|
||||
|
||||
pub fn get_flutter_config(&self, k: String) -> String {
|
||||
|
||||
Reference in New Issue
Block a user