Merge pull request #6031 from 21pages/wallpaper_remove_unsupported

not show remove wallpaper option if unsupported
This commit is contained in:
RustDesk
2023-10-14 22:22:37 +08:00
committed by GitHub
8 changed files with 68 additions and 20 deletions

View File

@@ -323,24 +323,7 @@ class _GeneralState extends State<_General> {
'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive bitrate', 'enable-abr'),
if (Platform.isWindows || Platform.isLinux)
Row(
children: [
Flexible(
child: _OptionCheckBox(
context,
'Remove wallpaper during incoming sessions',
'allow-remove-wallpaper'),
),
_CountDownButton(
text: 'Test',
second: 5,
onPressed: () {
bind.mainTestWallpaper(second: 5);
},
)
],
),
wallpaper(),
_OptionCheckBox(
context,
'Open connection in new tab',
@@ -367,6 +350,42 @@ class _GeneralState extends State<_General> {
return _Card(title: 'Other', children: children);
}
Widget wallpaper() {
return futureBuilder(future: () async {
final support = await bind.mainSupportRemoveWallpaper();
return support;
}(), hasData: (data) {
if (data is bool && data == true) {
final option = 'allow-remove-wallpaper';
bool value = mainGetBoolOptionSync(option);
return Row(
children: [
Flexible(
child: _OptionCheckBox(
context,
'Remove wallpaper during incoming sessions',
option,
update: () {
setState(() {});
},
),
),
if (value)
_CountDownButton(
text: 'Test',
second: 5,
onPressed: () {
bind.mainTestWallpaper(second: 5);
},
)
],
);
}
return Offstage();
});
}
Widget hwcodec() {
return Offstage(
offstage: !bind.mainHasHwcodec(),