diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell-plugins/Chrono.hpp')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell-plugins/Chrono.hpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.hpp b/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.hpp index 788fa88e..4d06007d 100644 --- a/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.hpp +++ b/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.hpp | |||
@@ -1,5 +1,6 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | #include <QDateTime> | ||
3 | #include <QObject> | 4 | #include <QObject> |
4 | #include <QTimer> | 5 | #include <QTimer> |
5 | 6 | ||
@@ -10,8 +11,7 @@ class Chrono : public QObject { | |||
10 | Q_OBJECT; | 11 | Q_OBJECT; |
11 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged); | 12 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged); |
12 | Q_PROPERTY(Chrono::Precision precision READ precision WRITE setPrecision NOTIFY precisionChanged); | 13 | Q_PROPERTY(Chrono::Precision precision READ precision WRITE setPrecision NOTIFY precisionChanged); |
13 | Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged); | 14 | Q_PROPERTY(QDateTime date READ date NOTIFY dateChanged) |
14 | Q_PROPERTY(QString date READ date NOTIFY dateChanged); | ||
15 | QML_ELEMENT; | 15 | QML_ELEMENT; |
16 | 16 | ||
17 | public: | 17 | public: |
@@ -30,15 +30,13 @@ public: | |||
30 | Chrono::Precision precision() const; | 30 | Chrono::Precision precision() const; |
31 | void setPrecision(Chrono::Precision precision); | 31 | void setPrecision(Chrono::Precision precision); |
32 | 32 | ||
33 | QString format() const; | 33 | Q_INVOKABLE QString format(const QString& fmt) const; |
34 | void setFormat (QString format); | ||
35 | 34 | ||
36 | QString date() const; | 35 | QDateTime date() const; |
37 | 36 | ||
38 | signals: | 37 | signals: |
39 | void enabledChanged(); | 38 | void enabledChanged(); |
40 | void precisionChanged(); | 39 | void precisionChanged(); |
41 | void formatChanged(); | ||
42 | void dateChanged(); | 40 | void dateChanged(); |
43 | 41 | ||
44 | private slots: | 42 | private slots: |
@@ -47,7 +45,6 @@ private slots: | |||
47 | private: | 45 | private: |
48 | bool mEnabled = true; | 46 | bool mEnabled = true; |
49 | Chrono::Precision mPrecision = Chrono::Seconds; | 47 | Chrono::Precision mPrecision = Chrono::Seconds; |
50 | QString mFormat = "{:%c}"; | ||
51 | QTimer timer; | 48 | QTimer timer; |
52 | std::chrono::time_point<std::chrono::system_clock> currentTime, targetTime; | 49 | std::chrono::time_point<std::chrono::system_clock> currentTime, targetTime; |
53 | 50 | ||