2026-01-15 23:09:32 +01:00
|
|
|
import Quickshell
|
|
|
|
|
import QtQuick
|
2026-01-19 18:57:19 +01:00
|
|
|
import QtQuick.Controls
|
2026-01-19 12:45:35 +01:00
|
|
|
import qs
|
|
|
|
|
import qs.settings
|
|
|
|
|
import qs.reusables
|
2026-01-15 23:09:32 +01:00
|
|
|
|
2026-01-18 18:26:49 +01:00
|
|
|
Rectangle {
|
|
|
|
|
id: container
|
|
|
|
|
radius: implicitHeight / 2
|
2026-01-20 12:46:38 +01:00
|
|
|
color: formatSwitch.containsMouse ? Colors.color5 : Colors.color6
|
2026-01-18 18:26:49 +01:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
implicitHeight: Settings.config.barHeight - 10
|
|
|
|
|
implicitWidth: root.implicitWidth + 20
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
2026-01-15 23:09:32 +01:00
|
|
|
anchors.centerIn: parent
|
2026-01-18 18:26:49 +01:00
|
|
|
implicitWidth: clockText.implicitWidth
|
|
|
|
|
implicitHeight: Settings.config.barHeight
|
|
|
|
|
SystemClock {
|
|
|
|
|
id: clock
|
|
|
|
|
precision: SystemClock.Minutes
|
|
|
|
|
}
|
|
|
|
|
CustomText {
|
|
|
|
|
id: clockText
|
2026-01-19 18:57:19 +01:00
|
|
|
property bool showFull
|
2026-01-18 18:26:49 +01:00
|
|
|
anchors.centerIn: parent
|
2026-01-19 18:57:19 +01:00
|
|
|
text: showFull ? Qt.formatDateTime(clock.date, "hh:mm / dd.mm.yy") : Qt.formatDateTime(clock.date, "hh:mm")
|
2026-01-18 18:26:49 +01:00
|
|
|
}
|
2026-01-15 23:09:32 +01:00
|
|
|
}
|
2026-01-19 18:57:19 +01:00
|
|
|
MouseArea {
|
|
|
|
|
id: formatSwitch
|
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onClicked: clockText.showFull = !clockText.showFull
|
|
|
|
|
}
|
2026-01-15 23:09:32 +01:00
|
|
|
}
|