blob: 1fb0c818697bbb4199cb281c26bfd2fbe5e5760b (
plain) (
blame)
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
86
87
88
89
90
91
92
93
|
// SPDX-License-Identifier: GPL-2.0
#ifndef THEMEINTERFACE_H
#define THEMEINTERFACE_H
#include <QObject>
#include <QColor>
#include <QSettings>
#include <QQmlContext>
class ThemeInterface : public QObject {
Q_OBJECT
// Color themes
Q_PROPERTY(QColor backgroundColor MEMBER m_backgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(QColor contrastAccentColor MEMBER m_contrastAccentColor NOTIFY contrastAccentColorChanged)
Q_PROPERTY(QColor darkerPrimaryColor MEMBER m_darkerPrimaryColor NOTIFY darkerPrimaryColorChanged)
Q_PROPERTY(QColor darkerPrimaryTextColor MEMBER m_darkerPrimaryTextColor NOTIFY darkerPrimaryTextColorChanged)
Q_PROPERTY(QColor drawerColor MEMBER m_drawerColor NOTIFY drawerColorChanged)
Q_PROPERTY(QColor lightDrawerColor MEMBER m_lightDrawerColor NOTIFY lightDrawerColorChanged)
Q_PROPERTY(QColor lightPrimaryColor MEMBER m_lightPrimaryColor NOTIFY lightPrimaryColorChanged)
Q_PROPERTY(QColor lightPrimaryTextColor MEMBER m_lightPrimaryTextColor NOTIFY lightPrimaryTextColorChanged)
Q_PROPERTY(QColor primaryColor MEMBER m_primaryColor NOTIFY primaryColorChanged)
Q_PROPERTY(QColor primaryTextColor MEMBER m_primaryTextColor NOTIFY primaryTextColorChanged)
Q_PROPERTY(QColor secondaryTextColor MEMBER m_secondaryTextColor NOTIFY secondaryTextColorChanged)
Q_PROPERTY(QColor textColor MEMBER m_textColor NOTIFY textColorChanged)
// Font
Q_PROPERTY(double basePointSize MEMBER m_basePointSize CONSTANT)
Q_PROPERTY(double headingPointSize MEMBER m_headingPointSize NOTIFY headingPointSizeChanged)
Q_PROPERTY(double regularPointSize MEMBER m_regularPointSize NOTIFY regularPointSizeChanged)
Q_PROPERTY(double smallPointSize MEMBER m_smallPointSize NOTIFY smallPointSizeChanged)
Q_PROPERTY(double titlePointSize MEMBER m_titlePointSize NOTIFY titlePointSizeChanged)
Q_PROPERTY(double currentScale READ currentScale WRITE set_currentScale NOTIFY currentScaleChanged)
// Support
Q_PROPERTY(QString currentTheme MEMBER m_currentTheme WRITE set_currentTheme NOTIFY currentThemeChanged)
public:
static ThemeInterface *instance();
void setup(QQmlContext *ct);
double currentScale();
public slots:
void set_currentTheme(const QString &theme);
void set_currentScale(double);
signals:
void backgroundColorChanged(QColor);
void contrastAccentColorChanged(QColor);
void darkerPrimaryColorChanged(QColor);
void darkerPrimaryTextColorChanged(QColor);
void drawerColorChanged(QColor);
void lightDrawerColorChanged(QColor);
void lightPrimaryColorChanged(QColor);
void lightPrimaryTextColorChanged(QColor);
void primaryColorChanged(QColor);
void primaryTextColorChanged(QColor);
void secondaryTextColorChanged(QColor);
void textColorChanged(QColor);
void headingPointSizeChanged(double);
void regularPointSizeChanged(double);
void smallPointSizeChanged(double);
void titlePointSizeChanged(double);
void currentScaleChanged(double);
void currentThemeChanged(const QString &);
private:
ThemeInterface() {}
void update_theme();
QColor m_backgroundColor;
QColor m_contrastAccentColor;
QColor m_darkerPrimaryColor;
QColor m_darkerPrimaryTextColor;
QColor m_drawerColor;
QColor m_lightDrawerColor;
QColor m_lightPrimaryColor;
QColor m_lightPrimaryTextColor;
QColor m_primaryColor;
QColor m_primaryTextColor;
QColor m_secondaryTextColor;
QColor m_textColor;
double m_basePointSize;
double m_headingPointSize;
double m_regularPointSize;
double m_smallPointSize;
double m_titlePointSize;
QString m_currentTheme;
};
#endif
|