diff --git a/qml/main.qml b/qml/main.qml
index abff149..0c6862f 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -37,6 +37,8 @@ Item {
property bool darkMode: FishUI.Theme.darkMode
property color textColor: rootItem.darkMode ? "#FFFFFF" : "#000000";
+ property var timeFormat: StatusBar.twentyFourTime ? "HH:mm" : "h:mm ap"
+
Rectangle {
id: background
anchors.fill: parent
@@ -453,7 +455,7 @@ Item {
running: true
triggeredOnStart: true
onTriggered: {
- timeLabel.text = new Date().toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
+ timeLabel.text = new Date().toLocaleTimeString(Qt.locale(), rootItem.timeFormat)
}
}
}
diff --git a/src/com.cutefish.Statusbar.xml b/src/com.cutefish.Statusbar.xml
index 110542e..b1e0b86 100644
--- a/src/com.cutefish.Statusbar.xml
+++ b/src/com.cutefish.Statusbar.xml
@@ -4,5 +4,8 @@
+
+
+
diff --git a/src/statusbar.cpp b/src/statusbar.cpp
index b9edd9b..dbec2bd 100644
--- a/src/statusbar.cpp
+++ b/src/statusbar.cpp
@@ -28,6 +28,7 @@
#include
#include
+#include
#include
#include
@@ -38,6 +39,9 @@ StatusBar::StatusBar(QQuickView *parent)
: QQuickView(parent)
, m_acticity(new Activity)
{
+ QSettings settings("cutefish", "locale");
+ m_twentyFourTime = settings.value("twentyFour", false).toBool();
+
setFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
setColor(Qt::transparent);
@@ -73,11 +77,24 @@ QRect StatusBar::screenRect()
return m_screenRect;
}
+bool StatusBar::twentyFourTime()
+{
+ return m_twentyFourTime;
+}
+
void StatusBar::setBatteryPercentage(bool enabled)
{
Battery::self()->setShowPercentage(enabled);
}
+void StatusBar::setTwentyFourTime(bool t)
+{
+ if (m_twentyFourTime != t) {
+ m_twentyFourTime = t;
+ emit twentyFourTimeChanged();
+ }
+}
+
void StatusBar::updateGeometry()
{
const QRect rect = screen()->geometry();
diff --git a/src/statusbar.h b/src/statusbar.h
index 153ace9..df6e854 100644
--- a/src/statusbar.h
+++ b/src/statusbar.h
@@ -27,13 +27,16 @@ class StatusBar : public QQuickView
{
Q_OBJECT
Q_PROPERTY(QRect screenRect READ screenRect NOTIFY screenRectChanged)
+ Q_PROPERTY(bool twentyFourTime READ twentyFourTime NOTIFY twentyFourTimeChanged)
public:
explicit StatusBar(QQuickView *parent = nullptr);
QRect screenRect();
+ bool twentyFourTime();
void setBatteryPercentage(bool enabled);
+ void setTwentyFourTime(bool t);
void updateGeometry();
void updateViewStruts();
@@ -41,6 +44,7 @@ public:
signals:
void screenRectChanged();
void launchPadChanged();
+ void twentyFourTimeChanged();
private slots:
void initState();
@@ -49,6 +53,7 @@ private slots:
private:
QRect m_screenRect;
Activity *m_acticity;
+ bool m_twentyFourTime;
};
#endif // STATUSBAR_H