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
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;
}