Changeset View
Changeset View
Standalone View
Standalone View
kirigami-plasmadesktop-integration/plasmadesktoptheme.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2017 by Marco Martin <mart@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU Library General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef KIRIGAMIPLASMATHEME_H | ||||
21 | #define KIRIGAMIPLASMATHEME_H | ||||
22 | | ||||
23 | #include <Kirigami2/PlatformTheme> | ||||
24 | #include <QObject> | ||||
25 | #include <QQuickItem> | ||||
26 | #include <QColor> | ||||
27 | #include <QPointer> | ||||
28 | | ||||
29 | class PlasmaDesktopTheme; | ||||
30 | | ||||
31 | class PlasmaDesktopTheme : public Kirigami::PlatformTheme | ||||
32 | { | ||||
33 | Q_OBJECT | ||||
34 | | ||||
35 | // colors | ||||
36 | Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY colorsChanged) | ||||
37 | Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY colorsChanged) | ||||
38 | Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY colorsChanged) | ||||
39 | Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY colorsChanged) | ||||
40 | | ||||
41 | Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY colorsChanged) | ||||
42 | Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY colorsChanged) | ||||
43 | Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY colorsChanged) | ||||
44 | Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY colorsChanged) | ||||
45 | | ||||
46 | //FIXME: this is due https://bugreports.qt.io/browse/QTBUG-63089 | ||||
47 | Q_PROPERTY(QStringList keys READ keys CONSTANT) | ||||
48 | | ||||
49 | public: | ||||
50 | explicit PlasmaDesktopTheme(QObject *parent = 0); | ||||
51 | ~PlasmaDesktopTheme(); | ||||
52 | | ||||
53 | Q_INVOKABLE QIcon iconFromTheme(const QString &name, const QColor &customColor = Qt::transparent) Q_DECL_OVERRIDE; | ||||
54 | | ||||
55 | void syncColors(); | ||||
56 | | ||||
57 | QColor buttonTextColor() const; | ||||
58 | QColor buttonBackgroundColor() const; | ||||
59 | QColor buttonHoverColor() const; | ||||
60 | QColor buttonFocusColor() const; | ||||
61 | | ||||
62 | QColor viewTextColor() const; | ||||
63 | QColor viewBackgroundColor() const; | ||||
64 | QColor viewHoverColor() const; | ||||
65 | QColor viewFocusColor() const; | ||||
66 | | ||||
67 | QStringList keys() const; | ||||
68 | | ||||
69 | Q_SIGNALS: | ||||
70 | void colorsChanged(); | ||||
71 | | ||||
72 | private: | ||||
73 | QPointer<QQuickItem> m_parentItem; | ||||
74 | //legacy colors | ||||
75 | QColor m_buttonTextColor; | ||||
76 | QColor m_buttonBackgroundColor; | ||||
77 | QColor m_buttonHoverColor; | ||||
78 | QColor m_buttonFocusColor; | ||||
79 | QColor m_viewTextColor; | ||||
80 | QColor m_viewBackgroundColor; | ||||
81 | QColor m_viewHoverColor; | ||||
82 | QColor m_viewFocusColor; | ||||
83 | }; | ||||
84 | | ||||
85 | | ||||
86 | #endif // KIRIGAMIPLASMATHEME_H |