add second precision option to settings, make cookie clock use DateTime.clock

This commit is contained in:
end-4
2025-10-05 21:02:01 +02:00
parent 7b13ddcbfc
commit fda70b0aef
2 changed files with 14 additions and 17 deletions
@@ -42,23 +42,8 @@ Item {
property color colSeconds: Appearance.colors.colTertiary
readonly property list<string> clockNumbers: DateTime.time.split(/[: ]/)
readonly property int clockHour: parseInt(clockNumbers[0]) % 12
readonly property int clockMinute: parseInt(clockNumbers[1])
property int clockSecond: 0
// Loader to set root.clockSecond
Loader{
active: Config.option.background.clock.cookie.secondDot
sourceComponent: Timer {
interval: 1000
running: true;repeat: true
onTriggered: {
var now = new Date()
clockSecond = now.getSeconds()
}
}
}
readonly property int clockMinute: DateTime.clock.minutes
readonly property int clockSecond: DateTime.clock.seconds
implicitWidth: implicitSize
@@ -210,6 +210,18 @@ ContentPage {
icon: "nest_clock_farsight_analog"
title: Translation.tr("Time")
ConfigSwitch {
buttonIcon: "pace"
text: Translation.tr("Second precision")
checked: Config.options.time.secondPrecision
onCheckedChanged: {
Config.options.time.secondPrecision = checked;
}
StyledToolTip {
text: Translation.tr("Enable if you want clocks to show seconds accurately")
}
}
ContentSubsection {
title: Translation.tr("Format")
tooltip: ""