Merge pull request #1294 from 21pages/setting

optimize settings ui
This commit is contained in:
RustDesk 2022-08-17 15:37:30 +08:00 committed by GitHub
commit fc061d2b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 651 additions and 308 deletions

View File

@ -528,14 +528,14 @@ String translate(String name) {
return platformFFI.translate(name, localeName); return platformFFI.translate(name, localeName);
} }
bool option2bool(String key, String value) { bool option2bool(String option, String value) {
bool res; bool res;
if (key.startsWith("enable-")) { if (option.startsWith("enable-")) {
res = value != "N"; res = value != "N";
} else if (key.startsWith("allow-") || } else if (option.startsWith("allow-") ||
key == "stop-service" || option == "stop-service" ||
key == "direct-server" || option == "direct-server" ||
key == "stop-rendezvous-service") { option == "stop-rendezvous-service") {
res = value == "Y"; res = value == "Y";
} else { } else {
assert(false); assert(false);
@ -544,18 +544,18 @@ bool option2bool(String key, String value) {
return res; return res;
} }
String bool2option(String key, bool option) { String bool2option(String option, bool b) {
String res; String res;
if (key.startsWith('enable-')) { if (option.startsWith('enable-')) {
res = option ? '' : 'N'; res = b ? '' : 'N';
} else if (key.startsWith('allow-') || } else if (option.startsWith('allow-') ||
key == "stop-service" || option == "stop-service" ||
key == "direct-server" || option == "direct-server" ||
key == "stop-rendezvous-service") { option == "stop-rendezvous-service") {
res = option ? 'Y' : ''; res = b ? 'Y' : '';
} else { } else {
assert(false); assert(false);
res = option ? 'Y' : 'N'; res = b ? 'Y' : 'N';
} }
return res; return res;
} }

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,7 @@ class DesktopTabBar extends StatelessWidget {
labelPadding: const EdgeInsets.symmetric( labelPadding: const EdgeInsets.symmetric(
vertical: 0, horizontal: 0), vertical: 0, horizontal: 0),
isScrollable: true, isScrollable: true,
indicatorPadding: EdgeInsets.only(bottom: 2), indicatorPadding: EdgeInsets.zero,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: controller.value, controller: controller.value,
tabs: tabs.asMap().entries.map((e) { tabs: tabs.asMap().entries.map((e) {

View File

@ -25,9 +25,9 @@ use crate::ui_interface::{
discover, forget_password, get_api_server, get_app_name, get_async_job_status, discover, forget_password, get_api_server, get_app_name, get_async_job_status,
get_connect_status, get_fav, get_id, get_lan_peers, get_langs, get_license, get_local_option, get_connect_status, get_fav, get_id, get_lan_peers, get_langs, get_license, get_local_option,
get_option, get_options, get_peer, get_peer_option, get_socks, get_sound_inputs, get_uuid, get_option, get_options, get_peer, get_peer_option, get_socks, get_sound_inputs, get_uuid,
get_version, has_rendezvous_service, post_request, set_local_option, set_option, set_options, get_version, has_hwcodec, has_rendezvous_service, post_request, set_local_option, set_option,
set_peer_option, set_permanent_password, set_socks, store_fav, test_if_valid_server, set_options, set_peer_option, set_permanent_password, set_socks, store_fav,
update_temporary_password, using_public_server, test_if_valid_server, update_temporary_password, using_public_server,
}; };
fn initialize(app_dir: &str) { fn initialize(app_dir: &str) {
@ -657,6 +657,10 @@ pub fn main_remove_peer(id: String) {
PeerConfig::remove(&id); PeerConfig::remove(&id);
} }
pub fn main_has_hwcodec() -> bool {
has_hwcodec()
}
// TODO // TODO
pub fn session_send_mouse(id: String, msg: String) { pub fn session_send_mouse(id: String, msg: String) {
if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(&msg) { if let Ok(m) = serde_json::from_str::<HashMap<String, String>>(&msg) {

View File

@ -27,15 +27,15 @@ use crate::ui_interface::{
get_icon, get_lan_peers, get_langs, get_license, get_local_option, get_mouse_time, get_icon, get_lan_peers, get_langs, get_license, get_local_option, get_mouse_time,
get_new_version, get_option, get_options, get_peer, get_peer_option, get_recent_sessions, get_new_version, get_option, get_options, get_peer, get_peer_option, get_recent_sessions,
get_remote_id, get_size, get_socks, get_software_ext, get_software_store_path, get_remote_id, get_size, get_socks, get_software_ext, get_software_store_path,
get_software_update_url, get_uuid, get_version, goto_install, has_rendezvous_service, get_software_update_url, get_uuid, get_version, goto_install, has_hwcodec,
install_me, install_path, is_can_screen_recording, is_installed, is_installed_daemon, has_rendezvous_service, install_me, install_path, is_can_screen_recording, is_installed,
is_installed_lower_version, is_login_wayland, is_ok_change_id, is_process_trusted, is_installed_daemon, is_installed_lower_version, is_login_wayland, is_ok_change_id,
is_rdp_service_open, is_share_rdp, is_xfce, modify_default_login, new_remote, open_url, is_process_trusted, is_rdp_service_open, is_share_rdp, is_xfce, modify_default_login,
peer_has_password, permanent_password, post_request, recent_sessions_updated, remove_peer, new_remote, open_url, peer_has_password, permanent_password, post_request,
run_without_install, set_local_option, set_option, set_options, set_peer_option, recent_sessions_updated, remove_peer, run_without_install, set_local_option, set_option,
set_permanent_password, set_remote_id, set_share_rdp, set_socks, show_run_without_install, set_options, set_peer_option, set_permanent_password, set_remote_id, set_share_rdp, set_socks,
store_fav, t, temporary_password, test_if_valid_server, update_me, update_temporary_password, show_run_without_install, store_fav, t, temporary_password, test_if_valid_server, update_me,
using_public_server, update_temporary_password, using_public_server,
}; };
mod cm; mod cm;
@ -541,10 +541,7 @@ impl UI {
} }
fn has_hwcodec(&self) -> bool { fn has_hwcodec(&self) -> bool {
#[cfg(not(feature = "hwcodec"))] has_hwcodec()
return false;
#[cfg(feature = "hwcodec")]
return true;
} }
fn get_langs(&self) -> String { fn get_langs(&self) -> String {

View File

@ -669,6 +669,13 @@ pub fn get_api_server() -> String {
) )
} }
pub fn has_hwcodec() -> bool {
#[cfg(not(feature = "hwcodec"))]
return false;
#[cfg(feature = "hwcodec")]
return true;
}
pub fn check_zombie(childs: Childs) { pub fn check_zombie(childs: Childs) {
let mut deads = Vec::new(); let mut deads = Vec::new();
loop { loop {