| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QGENERICUNIXTHEME_H |
| 5 | #define QGENERICUNIXTHEME_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <qpa/qplatformtheme.h> |
| 19 | #include <qpa/qplatformtheme_p.h> |
| 20 | #include <QtCore/QString> |
| 21 | #include <QtCore/QStringList> |
| 22 | #include <QtGui/QFont> |
| 23 | #include <QtCore/private/qglobal_p.h> |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QGenericUnixTheme; |
| 28 | class QGenericUnixThemePrivate : public QPlatformThemePrivate |
| 29 | { |
| 30 | public: |
| 31 | QGenericUnixThemePrivate(); |
| 32 | const QFont systemFont; |
| 33 | QFont fixedFont; |
| 34 | }; |
| 35 | |
| 36 | class Q_GUI_EXPORT QGenericUnixTheme : public QPlatformTheme |
| 37 | { |
| 38 | Q_DECLARE_PRIVATE(QGenericUnixTheme) |
| 39 | |
| 40 | protected: |
| 41 | QGenericUnixTheme(QGenericUnixThemePrivate *p); |
| 42 | |
| 43 | public: |
| 44 | QGenericUnixTheme(); |
| 45 | |
| 46 | const QFont *font(Font type) const override; |
| 47 | QVariant themeHint(ThemeHint hint) const override; |
| 48 | |
| 49 | #if QT_CONFIG(dbus) |
| 50 | QPlatformMenuBar *() const override; |
| 51 | #endif |
| 52 | #if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon) |
| 53 | QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; |
| 54 | #endif |
| 55 | |
| 56 | static const char *name; |
| 57 | |
| 58 | // Default system font, corresponding to the value returned by 4.8 for |
| 59 | // XRender/FontConfig which we can now assume as default. |
| 60 | static constexpr char defaultSystemFontNameC[] = "Sans Serif" ; |
| 61 | static constexpr char defaultFixedFontNameC[] = "monospace" ; |
| 62 | enum { defaultSystemFontSize = 9 }; |
| 63 | |
| 64 | // Helpers |
| 65 | static QStringList xdgIconThemePaths(); |
| 66 | static QPlatformTheme *createUnixTheme(const QString &name); |
| 67 | static QStringList themeNames(); |
| 68 | protected: |
| 69 | static QStringList iconFallbackPaths(); |
| 70 | static bool (); |
| 71 | static QString mouseCursorTheme(); |
| 72 | static QSize mouseCursorSize(); |
| 73 | static QList<QSize> availableXdgFileIconSizes(); |
| 74 | |
| 75 | #if QT_CONFIG(dbus) && QT_CONFIG(systemtrayicon) |
| 76 | static bool shouldUseDBusTray(); |
| 77 | #endif |
| 78 | #if QT_CONFIG(mimetype) |
| 79 | static QIcon xdgFileIcon(const QFileInfo &fileInfo); |
| 80 | #endif |
| 81 | }; |
| 82 | |
| 83 | QT_END_NAMESPACE |
| 84 | |
| 85 | #endif // QGENERICUNIXTHEME_H |
| 86 | |