-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatformtheme.h
85 lines (70 loc) · 1.94 KB
/
platformtheme.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef PLATFORMTHEME_H
#define PLATFORMTHEME_H
#include "ts-qtplatform_global.h"
#include "messagedialoghelper.h"
#include "iconengine.h"
#include "platformmenu.h"
#include "filedialoghelper.h"
#include <qpa/qplatformtheme.h>
#include <QVariant>
#include <QSettings>
#include <QPalette>
#include <QFont>
#include <QDebug>
#include <QFontDatabase>
#include <QX11Info>
#include <QStyleFactory>
#include <QTimer>
#include <QtDBus/QDBusConnection>
#include <X11/Xcursor/Xcursor.h>
#include <signal.h>
#include <QThread>
class ThemeCheckThread : public QThread
{
Q_OBJECT
void run();
public:
explicit ThemeCheckThread(QObject* parent = NULL);
~ThemeCheckThread();
signals:
void UpdateTheme();
private:
QTimer* pollSettingsTimer;
QString currentStyle;
QString currentColor;
int currentAccent;
QSettings* settings;
};
class ThemeUpdate : public QObject
{
Q_OBJECT
public:
explicit ThemeUpdate(QObject* parent = NULL);
~ThemeUpdate();
public slots:
void UpdateTheme();
private:
QSettings* settings;
};
class TSQTPLATFORMSHARED_EXPORT PlatformTheme : public QPlatformTheme
{
public:
PlatformTheme();
~PlatformTheme();
QVariant themeHint(ThemeHint hint) const override;
const QPalette* palette(Palette type) const override;
const QFont* font(Font type) const override;
QIconEngine* createIconEngine(const QString &iconName) const override;
QPlatformMenu* createPlatformMenu() const override;
QPlatformMenuBar* createPlatformMenuBar() const override;
QPlatformMenuItem* createPlatformMenuItem() const override;
QPlatformDialogHelper* createPlatformDialogHelper(DialogType type) const override;
bool usePlatformNativeDialog(DialogType type) const override;
private:
QColor greyscale(int intensity) const;
QSettings* settings;
QMap<QString, IconEngine*> iconEngines;
ThemeUpdate themeUpdate;
ThemeCheckThread* themeThread;
};
#endif // PLATFORMTHEME_H