Use cppgir compatible XDP utilities API

This commit is contained in:
Ilya Fedin 2024-03-14 21:50:18 +04:00 committed by John Preston
parent 59e53c1edf
commit 3689e7dfbc
2 changed files with 4 additions and 4 deletions

View File

@ -197,12 +197,12 @@ LinuxIntegration::LinuxIntegration()
, _darkModeWatcher( , _darkModeWatcher(
"org.freedesktop.appearance", "org.freedesktop.appearance",
"color-scheme", "color-scheme",
[](uint value) { [](GLib::Variant value) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
QWindowSystemInterface::handleThemeChange(); QWindowSystemInterface::handleThemeChange();
#else // Qt >= 6.5.0 #else // Qt >= 6.5.0
Core::Sandbox::Instance().customEnterFromEventLoop([&] { Core::Sandbox::Instance().customEnterFromEventLoop([&] {
Core::App().settings().setSystemDarkMode(value == 1); Core::App().settings().setSystemDarkMode(value.get_uint32() == 1);
}); });
#endif // Qt < 6.5.0 #endif // Qt < 6.5.0
}) { }) {

View File

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