Merge pull request #2772 from 21pages/fix

adjust server setting ui
This commit is contained in:
RustDesk 2023-01-09 19:39:28 +08:00 committed by GitHub
commit 3e9ab2278d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 41 deletions

View File

@ -1460,6 +1460,8 @@ _LabeledTextField(
enabled: enabled, enabled: enabled,
obscureText: secure, obscureText: secure,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 15),
errorText: errorText.isNotEmpty ? errorText : null), errorText: errorText.isNotEmpty ? errorText : null),
style: TextStyle( style: TextStyle(
color: _disabledTextColor(context, enabled), color: _disabledTextColor(context, enabled),

View File

@ -4,6 +4,7 @@ use hbb_common::{allow_err, bail, log};
use libc::{c_char, c_int, c_void}; use libc::{c_char, c_int, c_void};
use std::{ use std::{
cell::RefCell, cell::RefCell,
collections::HashMap,
path::PathBuf, path::PathBuf,
sync::{ sync::{
atomic::{AtomicBool, Ordering}, atomic::{AtomicBool, Ordering},
@ -719,47 +720,38 @@ pub fn get_double_click_time() -> u32 {
/// forever: may not work /// forever: may not work
pub fn system_message(title: &str, msg: &str, forever: bool) -> ResultType<()> { pub fn system_message(title: &str, msg: &str, forever: bool) -> ResultType<()> {
if std::process::Command::new("notify-send") let cmds: HashMap<&str, Vec<&str>> = HashMap::from([
.arg(title) ("notify-send", [title, msg].to_vec()),
.arg(msg) (
.spawn() "zenity",
.is_ok() [
{ "--info",
"--timeout",
if forever { "0" } else { "3" },
"--title",
title,
"--text",
msg,
]
.to_vec(),
),
("kdialog", ["--title", title, "--msgbox", msg].to_vec()),
(
"xmessage",
[
"-center",
"-timeout",
if forever { "0" } else { "3" },
title,
msg,
]
.to_vec(),
),
]);
for (k, v) in cmds {
if std::process::Command::new(k).args(v).spawn().is_ok() {
return Ok(()); return Ok(());
} }
if std::process::Command::new("zenity")
.arg("--info")
.arg("--timeout")
.arg(if forever { "0" } else { "3" })
.arg("--title")
.arg(title)
.arg("--text")
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
}
if std::process::Command::new("kdialog")
.arg("--title")
.arg(title)
.arg("--msgbox")
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
}
if std::process::Command::new("xmessage")
.arg("-center")
.arg("-timeout")
.arg(if forever { "0" } else { "3" })
.arg(title)
.arg(msg)
.spawn()
.is_ok()
{
return Ok(());
} }
bail!("failed to post system message"); bail!("failed to post system message");
} }