Remove double negation ifdefs in QGnometheme
Replace ifndef QT_NO_DBUS antipattern by if QT_CONFIG(dbus). Change-Id: I7dd44a6f5496e6f12c16ee1ecef3a004e5580d17 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
This commit is contained in:
parent
f86a0ccdfb
commit
fa42c281ee
@ -4,7 +4,7 @@
|
|||||||
#include "qgnometheme_p.h"
|
#include "qgnometheme_p.h"
|
||||||
#include <qpa/qplatformdialoghelper.h>
|
#include <qpa/qplatformdialoghelper.h>
|
||||||
#include <qpa/qplatformfontdatabase.h>
|
#include <qpa/qplatformfontdatabase.h>
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
#include "qdbuslistener_p.h"
|
#include "qdbuslistener_p.h"
|
||||||
#include <private/qdbustrayicon_p.h>
|
#include <private/qdbustrayicon_p.h>
|
||||||
#include <private/qdbustrayicon_p.h>
|
#include <private/qdbustrayicon_p.h>
|
||||||
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
Q_STATIC_LOGGING_CATEGORY(lcQpaThemeGnome, "qt.qpa.theme.gnome")
|
Q_STATIC_LOGGING_CATEGORY(lcQpaThemeGnome, "qt.qpa.theme.gnome")
|
||||||
#endif // QT_NO_DBUS
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QGnomeTheme
|
\class QGnomeTheme
|
||||||
@ -33,7 +33,7 @@ const char *QGnomeTheme::name = "gnome";
|
|||||||
|
|
||||||
QGnomeThemePrivate::QGnomeThemePrivate()
|
QGnomeThemePrivate::QGnomeThemePrivate()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
static constexpr QLatin1String appearanceNamespace("org.freedesktop.appearance");
|
static constexpr QLatin1String appearanceNamespace("org.freedesktop.appearance");
|
||||||
static constexpr QLatin1String colorSchemeKey("color-scheme");
|
static constexpr QLatin1String colorSchemeKey("color-scheme");
|
||||||
static constexpr QLatin1String contrastKey("contrast");
|
static constexpr QLatin1String contrastKey("contrast");
|
||||||
@ -79,7 +79,7 @@ QGnomeThemePrivate::QGnomeThemePrivate()
|
|||||||
} else {
|
} else {
|
||||||
qCWarning(lcQpaThemeGnome) << "dbus connection failed. Last error: " << dbus.lastError();
|
qCWarning(lcQpaThemeGnome) << "dbus connection failed. Last error: " << dbus.lastError();
|
||||||
}
|
}
|
||||||
#endif // QT_NO_DBUS
|
#endif // QT_CONFIG(dbus)
|
||||||
}
|
}
|
||||||
QGnomeThemePrivate::~QGnomeThemePrivate()
|
QGnomeThemePrivate::~QGnomeThemePrivate()
|
||||||
{
|
{
|
||||||
@ -102,7 +102,7 @@ void QGnomeThemePrivate::configureFonts(const QString >kFontName) const
|
|||||||
qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
|
qCDebug(lcQpaFonts) << "default fonts: system" << systemFont << "fixed" << fixedFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
bool QGnomeThemePrivate::initDbus()
|
bool QGnomeThemePrivate::initDbus()
|
||||||
{
|
{
|
||||||
dbus.reset(new QDBusListener());
|
dbus.reset(new QDBusListener());
|
||||||
@ -155,7 +155,7 @@ void QGnomeThemePrivate::updateHighContrast(Qt::ContrastPreference contrast)
|
|||||||
QWindowSystemInterface::handleThemeChange();
|
QWindowSystemInterface::handleThemeChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_DBUS
|
#endif // QT_CONFIG(dbus)
|
||||||
|
|
||||||
QGnomeTheme::QGnomeTheme()
|
QGnomeTheme::QGnomeTheme()
|
||||||
: QGenericUnixTheme(new QGnomeThemePrivate())
|
: QGenericUnixTheme(new QGnomeThemePrivate())
|
||||||
@ -236,7 +236,7 @@ QString QGnomeTheme::gtkFontName() const
|
|||||||
.arg(defaultSystemFontSize);
|
.arg(defaultSystemFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
QPlatformMenuBar *QGnomeTheme::createPlatformMenuBar() const
|
QPlatformMenuBar *QGnomeTheme::createPlatformMenuBar() const
|
||||||
{
|
{
|
||||||
if (isDBusGlobalMenuAvailable())
|
if (isDBusGlobalMenuAvailable())
|
||||||
@ -256,7 +256,7 @@ Qt::ContrastPreference QGnomeTheme::contrastPreference() const
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
|
#if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon)
|
||||||
QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const
|
QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const
|
||||||
{
|
{
|
||||||
if (shouldUseDBusTray())
|
if (shouldUseDBusTray())
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QGnomeThemePrivate;
|
class QGnomeThemePrivate;
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
class QDBusListener;
|
class QDBusListener;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -38,12 +38,12 @@ public:
|
|||||||
QString standardButtonText(int button) const override;
|
QString standardButtonText(int button) const override;
|
||||||
|
|
||||||
virtual QString gtkFontName() const;
|
virtual QString gtkFontName() const;
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
QPlatformMenuBar *createPlatformMenuBar() const override;
|
QPlatformMenuBar *createPlatformMenuBar() const override;
|
||||||
Qt::ColorScheme colorScheme() const override;
|
Qt::ColorScheme colorScheme() const override;
|
||||||
Qt::ContrastPreference contrastPreference() const override;
|
Qt::ContrastPreference contrastPreference() const override;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
|
#if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon)
|
||||||
QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
|
QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
mutable QFont *systemFont = nullptr;
|
mutable QFont *systemFont = nullptr;
|
||||||
mutable QFont *fixedFont = nullptr;
|
mutable QFont *fixedFont = nullptr;
|
||||||
|
|
||||||
#ifndef QT_NO_DBUS
|
#if QT_CONFIG(dbus)
|
||||||
Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
|
Qt::ColorScheme m_colorScheme = Qt::ColorScheme::Unknown;
|
||||||
Qt::ContrastPreference m_contrast = Qt::ContrastPreference::NoPreference;
|
Qt::ContrastPreference m_contrast = Qt::ContrastPreference::NoPreference;
|
||||||
private:
|
private:
|
||||||
@ -69,7 +69,7 @@ private:
|
|||||||
bool initDbus();
|
bool initDbus();
|
||||||
void updateColorScheme(const QString &themeName);
|
void updateColorScheme(const QString &themeName);
|
||||||
void updateHighContrast(Qt::ContrastPreference contrast);
|
void updateHighContrast(Qt::ContrastPreference contrast);
|
||||||
#endif // QT_NO_DBUS
|
#endif // QT_CONFIG(dbus)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user