From fa42c281ee671f517c48390cc8e91f98b0e84d56 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Fri, 4 Apr 2025 09:19:50 +0200 Subject: [PATCH] Remove double negation ifdefs in QGnometheme Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: I7dd44a6f5496e6f12c16ee1ecef3a004e5580d17 Reviewed-by: Samuli Piippo --- src/gui/platform/unix/qgnometheme.cpp | 18 +++++++++--------- src/gui/platform/unix/qgnometheme_p.h | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/platform/unix/qgnometheme.cpp b/src/gui/platform/unix/qgnometheme.cpp index f448bf53ba3..c70c3580185 100644 --- a/src/gui/platform/unix/qgnometheme.cpp +++ b/src/gui/platform/unix/qgnometheme.cpp @@ -4,7 +4,7 @@ #include "qgnometheme_p.h" #include #include -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) #include "qdbuslistener_p.h" #include #include @@ -18,9 +18,9 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) Q_STATIC_LOGGING_CATEGORY(lcQpaThemeGnome, "qt.qpa.theme.gnome") -#endif // QT_NO_DBUS +#endif /*! \class QGnomeTheme @@ -33,7 +33,7 @@ const char *QGnomeTheme::name = "gnome"; QGnomeThemePrivate::QGnomeThemePrivate() { -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) static constexpr QLatin1String appearanceNamespace("org.freedesktop.appearance"); static constexpr QLatin1String colorSchemeKey("color-scheme"); static constexpr QLatin1String contrastKey("contrast"); @@ -79,7 +79,7 @@ QGnomeThemePrivate::QGnomeThemePrivate() } else { qCWarning(lcQpaThemeGnome) << "dbus connection failed. Last error: " << dbus.lastError(); } -#endif // QT_NO_DBUS +#endif // QT_CONFIG(dbus) } QGnomeThemePrivate::~QGnomeThemePrivate() { @@ -102,7 +102,7 @@ void QGnomeThemePrivate::configureFonts(const QString >kFontName) const qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont; } -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) bool QGnomeThemePrivate::initDbus() { dbus.reset(new QDBusListener()); @@ -155,7 +155,7 @@ void QGnomeThemePrivate::updateHighContrast(Qt::ContrastPreference contrast) QWindowSystemInterface::handleThemeChange(); } -#endif // QT_NO_DBUS +#endif // QT_CONFIG(dbus) QGnomeTheme::QGnomeTheme() : QGenericUnixTheme(new QGnomeThemePrivate()) @@ -236,7 +236,7 @@ QString QGnomeTheme::gtkFontName() const .arg(defaultSystemFontSize); } -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) QPlatformMenuBar *QGnomeTheme::createPlatformMenuBar() const { if (isDBusGlobalMenuAvailable()) @@ -256,7 +256,7 @@ Qt::ContrastPreference QGnomeTheme::contrastPreference() const #endif -#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) +#if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon) QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const { if (shouldUseDBusTray()) diff --git a/src/gui/platform/unix/qgnometheme_p.h b/src/gui/platform/unix/qgnometheme_p.h index 490aa2a4b16..08bba609875 100644 --- a/src/gui/platform/unix/qgnometheme_p.h +++ b/src/gui/platform/unix/qgnometheme_p.h @@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE class QGnomeThemePrivate; -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) class QDBusListener; #endif @@ -38,12 +38,12 @@ public: QString standardButtonText(int button) const override; virtual QString gtkFontName() const; -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) QPlatformMenuBar *createPlatformMenuBar() const override; Qt::ColorScheme colorScheme() const override; Qt::ContrastPreference contrastPreference() const override; #endif -#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) +#if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon) QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; #endif @@ -61,7 +61,7 @@ public: mutable QFont *systemFont = nullptr; mutable QFont *fixedFont = nullptr; -#ifndef QT_NO_DBUS +#if QT_CONFIG(dbus) Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown; Qt::ContrastPreference m_contrast = Qt::ContrastPreference::NoPreference; private: @@ -69,7 +69,7 @@ private: bool initDbus(); void updateColorScheme(const QString &themeName); void updateHighContrast(Qt::ContrastPreference contrast); -#endif // QT_NO_DBUS +#endif // QT_CONFIG(dbus) };