From: Claudio Cambra Date: Mon, 25 Nov 2024 08:39:20 +0000 (+0800) Subject: Make connectToPaletteSignal const X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~5^2~1^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b0dc04a624819b51d4c1a6d4a706d63802802f25;p=nextcloud-desktop.git Make connectToPaletteSignal const We don't really need to have the check fo paletteSignalsConnected Signed-off-by: Claudio Cambra --- diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index cb672c717..2db9e708c 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -964,13 +964,10 @@ QColor Theme::defaultColor() return QColor{NEXTCLOUD_BACKGROUND_COLOR}; } -void Theme::connectToPaletteSignal() +void Theme::connectToPaletteSignal() const { - if (!_paletteSignalsConnected) { - if (const auto ptr = qobject_cast(qApp)) { - connect(ptr->styleHints(), &QStyleHints::colorSchemeChanged, this, &Theme::darkModeChanged); - _paletteSignalsConnected = true; - } + if (const auto ptr = qobject_cast(qApp)) { + connect(ptr->styleHints(), &QStyleHints::colorSchemeChanged, this, &Theme::darkModeChanged, Qt::UniqueConnection); } } diff --git a/src/libsync/theme.h b/src/libsync/theme.h index a7e817de1..9e12ba709 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -639,14 +639,13 @@ private: Theme &operator=(Theme const &); void updateMultipleOverrideServers(); - void connectToPaletteSignal(); + void connectToPaletteSignal() const; #if defined(Q_OS_WIN) QPalette reserveDarkPalette; // Windows 11 button and window dark colours #endif static Theme *_instance; bool _mono = false; - bool _paletteSignalsConnected = false; QString _overrideServerUrl; bool _forceOverrideServerUrl = false;