Changeset View
Changeset View
Standalone View
Standalone View
src/settings.h
Show All 14 Lines | |||||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | #ifndef SETTINGS_H | 19 | #ifndef SETTINGS_H | ||
20 | #define SETTINGS_H | 20 | #define SETTINGS_H | ||
21 | 21 | | |||
22 | #include <QObject> | 22 | #include <QObject> | ||
23 | #include <QVariant> | ||||
23 | 24 | | |||
24 | /** | 25 | /** | ||
25 | * This class contains global kirigami settings about the current device setup | 26 | * This class contains global kirigami settings about the current device setup | ||
26 | * It is exposed to QML as the singleton "Settings" | 27 | * It is exposed to QML as the singleton "Settings" | ||
27 | */ | 28 | */ | ||
28 | class Settings : public QObject | 29 | class Settings : public QObject | ||
29 | { | 30 | { | ||
30 | Q_OBJECT | 31 | Q_OBJECT | ||
Show All 35 Lines | |||||
66 | /** | 67 | /** | ||
67 | * @returns runtime information about the libraries in use | 68 | * @returns runtime information about the libraries in use | ||
68 | * | 69 | * | ||
69 | * @since 5.52 | 70 | * @since 5.52 | ||
70 | * @since org.kde.kirigami 2.6 | 71 | * @since org.kde.kirigami 2.6 | ||
71 | */ | 72 | */ | ||
72 | Q_PROPERTY(QStringList information READ information CONSTANT) | 73 | Q_PROPERTY(QStringList information READ information CONSTANT) | ||
73 | 74 | | |||
75 | /** | ||||
76 | * @returns application window icon, basically \QApplication::windowIcon() | ||||
77 | * | ||||
78 | * @since 5.62 | ||||
79 | * @since org.kde.kirigami 2.10 | ||||
ngraham: 2.10 actually (this is super confusing, I know) | |||||
80 | */ | ||||
81 | Q_PROPERTY(QVariant applicationWindowIcon READ applicationWindowIcon CONSTANT) | ||||
It could make sense to include the REVISION part: apol: It could make sense to include the REVISION part:
https://doc.qt.io/qt-5/properties.html | |||||
I have no idea what the value would be for that and Kirigami doesn't have any example. caspermeijn: I have no idea what the value would be for that and Kirigami doesn't have any example. | |||||
https://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html#type-revisions-and-versions tldr:
I am not sure how that would work for a singletontype though, one always needs all properties since any revision may be used at any time. sitter: https://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html#type-revisions-and-versions
tldr… | |||||
82 | | ||||
74 | public: | 83 | public: | ||
75 | Settings(QObject *parent = nullptr); | 84 | Settings(QObject *parent = nullptr); | ||
76 | ~Settings(); | 85 | ~Settings(); | ||
77 | 86 | | |||
78 | void setTabletModeAvailable(bool mobile); | 87 | void setTabletModeAvailable(bool mobile); | ||
79 | bool isTabletModeAvailable() const; | 88 | bool isTabletModeAvailable() const; | ||
80 | 89 | | |||
81 | void setIsMobile(bool mobile); | 90 | void setIsMobile(bool mobile); | ||
82 | bool isMobile() const; | 91 | bool isMobile() const; | ||
83 | 92 | | |||
84 | void setTabletMode(bool tablet); | 93 | void setTabletMode(bool tablet); | ||
85 | bool tabletMode() const; | 94 | bool tabletMode() const; | ||
86 | 95 | | |||
87 | QString style() const; | 96 | QString style() const; | ||
88 | void setStyle(const QString &style); | 97 | void setStyle(const QString &style); | ||
89 | 98 | | |||
90 | int mouseWheelScrollLines() const; | 99 | int mouseWheelScrollLines() const; | ||
91 | 100 | | |||
92 | QStringList information() const; | 101 | QStringList information() const; | ||
93 | 102 | | |||
103 | QVariant applicationWindowIcon() const; | ||||
104 | | ||||
94 | static Settings *self(); | 105 | static Settings *self(); | ||
95 | 106 | | |||
96 | Q_SIGNALS: | 107 | Q_SIGNALS: | ||
97 | void tabletModeAvailableChanged(); | 108 | void tabletModeAvailableChanged(); | ||
98 | void tabletModeChanged(); | 109 | void tabletModeChanged(); | ||
99 | void isMobileChanged(); | 110 | void isMobileChanged(); | ||
100 | 111 | | |||
101 | private: | 112 | private: | ||
102 | QString m_style; | 113 | QString m_style; | ||
103 | int m_scrollLines = 0; | 114 | int m_scrollLines = 0; | ||
104 | bool m_tabletModeAvailable : 1; | 115 | bool m_tabletModeAvailable : 1; | ||
105 | bool m_mobile : 1; | 116 | bool m_mobile : 1; | ||
106 | bool m_tabletMode : 1; | 117 | bool m_tabletMode : 1; | ||
107 | }; | 118 | }; | ||
108 | 119 | | |||
109 | #endif | 120 | #endif |
2.10 actually (this is super confusing, I know)