2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Make use of templated XDP::ReadSetting

This commit is contained in:
Ilya Fedin
2023-09-18 15:55:11 +04:00
committed by John Preston
parent fd00450f44
commit ea41aab713
3 changed files with 8 additions and 13 deletions

View File

@@ -465,18 +465,13 @@ QString SingleInstanceLocalServerName(const QString &hash) {
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
std::optional<bool> IsDarkMode() {
try {
const auto result = base::Platform::XDP::ReadSetting(
"org.freedesktop.appearance",
"color-scheme");
const auto result = base::Platform::XDP::ReadSetting<uint>(
"org.freedesktop.appearance",
"color-scheme");
if (result.has_value()) {
return result->get_dynamic<uint>() == 1;
}
} catch (...) {
}
return std::nullopt;
return result.has_value()
? std::make_optional(*result == 1)
: std::nullopt;
}
#endif // Qt < 6.5.0