forked from KikoPlayProject/KikoPlay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstylemanager.h
More file actions
46 lines (39 loc) · 1.2 KB
/
stylemanager.h
File metadata and controls
46 lines (39 loc) · 1.2 KB
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
#ifndef STYLEMANAGER_H
#define STYLEMANAGER_H
#include <QtCore>
#include <QColor>
class StyleManager : public QObject
{
Q_OBJECT
public:
enum StyleMode
{
NO_BG,
DEFAULT_BG,
BG_COLOR,
UNKNOWN
};
static StyleManager *getStyleManager();
void setQSS(StyleMode mode, const QColor &color=QColor());
QString setQSS(const QString &qss, const QVariantMap *extraVal = nullptr);
void setCondVariable(const QString &name, bool val, bool refresh=true);
bool getCondVariable(const QString &name) const {return condHash.value(name, false);}
StyleMode currentMode() const {return mode;}
signals:
void styleModelChanged(StyleMode newMode);
void condVariableChanged(const QString &name, bool val);
private:
StyleManager();
StyleManager(const StyleManager &)=delete;
QString normalQSS, bgQSS, defaultBgQSS;
QString loadQSS(const QString &fn);
QColor themeColor;
StyleMode mode;
QHash<QString, QString> colorHash;
QHash<QString, bool> condHash;
void setColorHash();
QColor getColorPalette(const QColor &color, int index);
inline QString toString(const QColor &color);
void pushEvent();
};
#endif // STYLEMANAGER_H