Make use of the new XDP::SettingWatcher constructor

This commit is contained in:
Ilya Fedin 2023-09-17 16:04:08 +04:00 committed by John Preston
parent 3c931b11d6
commit cb838e6e52

View file

@ -207,24 +207,17 @@ LinuxIntegration::LinuxIntegration()
base::Platform::XDP::kService, base::Platform::XDP::kService,
base::Platform::XDP::kObjectPath, base::Platform::XDP::kObjectPath,
nullptr)) nullptr))
, _darkModeWatcher([]( , _darkModeWatcher(
const Glib::ustring &group, "org.freedesktop.appearance",
const Glib::ustring &key, "color-scheme",
const Glib::VariantBase &value) { [](uint value) {
if (group == "org.freedesktop.appearance"
&& key == "color-scheme") {
#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([&] {
try { Core::App().settings().setSystemDarkMode(value == 1);
Core::App().settings().setSystemDarkMode(
value.get_dynamic<uint>() == 1);
} catch (...) {
}
}); });
#endif // Qt < 6.5.0 #endif // Qt < 6.5.0
}
}) { }) {
LOG(("Icon theme: %1").arg(QIcon::themeName())); LOG(("Icon theme: %1").arg(QIcon::themeName()));
LOG(("Fallback icon theme: %1").arg(QIcon::fallbackThemeName())); LOG(("Fallback icon theme: %1").arg(QIcon::fallbackThemeName()));