move closing-tabs to local config, and add glgetstring to stack check

This commit is contained in:
rustdesk
2023-07-30 12:16:00 +08:00
parent 69f1969e60
commit dd4f52b63d
8 changed files with 35 additions and 20 deletions

View File

@@ -314,19 +314,16 @@ class _GeneralState extends State<_General> {
Widget other() {
final children = [
_OptionCheckBox(context, 'Confirm before closing multiple tabs',
'enable-confirm-closing-tabs'),
'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive Bitrate', 'enable-abr')
];
if (Platform.isLinux) {
children.add(Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(
context,
"Always use software rendering",
'allow-always-software-render',
),
));
}
// though this is related to GUI, but opengl problem affects all users, so put in config rather than local
children.add(Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(context, "Always use software rendering",
'allow-always-software-render'),
));
if (bind.mainShowOption(key: 'allow-linux-headless')) {
children.add(_OptionCheckBox(
context, 'Allow linux headless', 'allow-linux-headless'));
@@ -1666,15 +1663,22 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
bool reverse = false,
bool enabled = true,
Icon? checkedIcon,
bool? fakeValue}) {
bool value = mainGetBoolOptionSync(key);
bool? fakeValue,
bool isServer = true}) {
bool value =
isServer ? mainGetBoolOptionSync(key) : mainGetLocalBoolOptionSync(key);
if (reverse) value = !value;
var ref = value.obs;
onChanged(option) async {
if (option != null) {
if (reverse) option = !option;
await mainSetBoolOption(key, option);
ref.value = mainGetBoolOptionSync(key);
isServer
? await mainSetBoolOption(key, option)
: await mainSetLocalBoolOption(key, option);
ref.value = isServer
? mainGetBoolOptionSync(key)
: mainGetLocalBoolOptionSync(key);
;
update?.call();
}
}