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);
}
bool option2bool(String key, String value) {
bool option2bool(String option, String value) {
bool res;
if (key.startsWith("enable-")) {
if (option.startsWith("enable-")) {
res = value != "N";
} else if (key.startsWith("allow-") ||
key == "stop-service" ||
key == "direct-server" ||
key == "stop-rendezvous-service") {
} else if (option.startsWith("allow-") ||
option == "stop-service" ||
option == "direct-server" ||
option == "stop-rendezvous-service") {
res = value == "Y";
} else {
assert(false);
@ -544,18 +544,18 @@ bool option2bool(String key, String value) {
return res;
}
String bool2option(String key, bool option) {
String bool2option(String option, bool b) {
String res;
if (key.startsWith('enable-')) {
res = option ? '' : 'N';
} else if (key.startsWith('allow-') ||
key == "stop-service" ||
key == "direct-server" ||
key == "stop-rendezvous-service") {
res = option ? 'Y' : '';
if (option.startsWith('enable-')) {
res = b ? '' : 'N';
} else if (option.startsWith('allow-') ||
option == "stop-service" ||
option == "direct-server" ||
option == "stop-rendezvous-service") {
res = b ? 'Y' : '';
} else {
assert(false);
res = option ? 'Y' : 'N';
res = b ? 'Y' : 'N';
}
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(
vertical: 0, horizontal: 0),
isScrollable: true,
indicatorPadding: EdgeInsets.only(bottom: 2),
indicatorPadding: EdgeInsets.zero,
physics: BouncingScrollPhysics(),
controller: controller.value,
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,
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_version, has_rendezvous_service, post_request, set_local_option, set_option, set_options,
set_peer_option, set_permanent_password, set_socks, store_fav, test_if_valid_server,
update_temporary_password, using_public_server,
get_version, has_hwcodec, has_rendezvous_service, post_request, set_local_option, set_option,
set_options, set_peer_option, set_permanent_password, set_socks, store_fav,
test_if_valid_server, update_temporary_password, using_public_server,
};
fn initialize(app_dir: &str) {
@ -657,6 +657,10 @@ pub fn main_remove_peer(id: String) {
PeerConfig::remove(&id);
}
pub fn main_has_hwcodec() -> bool {
has_hwcodec()
}
// TODO
pub fn session_send_mouse(id: String, msg: String) {
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_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_software_update_url, get_uuid, get_version, goto_install, has_rendezvous_service,
install_me, install_path, is_can_screen_recording, is_installed, is_installed_daemon,
is_installed_lower_version, is_login_wayland, is_ok_change_id, is_process_trusted,
is_rdp_service_open, is_share_rdp, is_xfce, modify_default_login, new_remote, open_url,
peer_has_password, permanent_password, post_request, recent_sessions_updated, remove_peer,
run_without_install, set_local_option, set_option, set_options, set_peer_option,
set_permanent_password, set_remote_id, set_share_rdp, set_socks, show_run_without_install,
store_fav, t, temporary_password, test_if_valid_server, update_me, update_temporary_password,
using_public_server,
get_software_update_url, get_uuid, get_version, goto_install, has_hwcodec,
has_rendezvous_service, install_me, install_path, is_can_screen_recording, is_installed,
is_installed_daemon, is_installed_lower_version, is_login_wayland, is_ok_change_id,
is_process_trusted, is_rdp_service_open, is_share_rdp, is_xfce, modify_default_login,
new_remote, open_url, peer_has_password, permanent_password, post_request,
recent_sessions_updated, remove_peer, run_without_install, set_local_option, set_option,
set_options, set_peer_option, set_permanent_password, set_remote_id, set_share_rdp, set_socks,
show_run_without_install, store_fav, t, temporary_password, test_if_valid_server, update_me,
update_temporary_password, using_public_server,
};
mod cm;
@ -541,10 +541,7 @@ impl UI {
}
fn has_hwcodec(&self) -> bool {
#[cfg(not(feature = "hwcodec"))]
return false;
#[cfg(feature = "hwcodec")]
return true;
has_hwcodec()
}
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) {
let mut deads = Vec::new();
loop {