fix: support 24h lock clock
This commit is contained in:
parent
5b68e921aa
commit
d741ca28d7
1 changed files with 29 additions and 22 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Caelestia.Config
|
import Caelestia.Config
|
||||||
import qs.components
|
import qs.components
|
||||||
|
|
@ -39,7 +41,7 @@ Item {
|
||||||
|
|
||||||
text: Time.minuteStr
|
text: Time.minuteStr
|
||||||
color: Colours.palette.m3secondary
|
color: Colours.palette.m3secondary
|
||||||
font: Tokens.font.headline.builders.large.scale(3.8 * root.centerScale).width(30).build()
|
font: Tokens.font.headline.builders.large.scale((GlobalConfig.services.useTwelveHourClock ? 3.8 : 7) * root.centerScale).width(30).build()
|
||||||
|
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: minuteMetrics
|
id: minuteMetrics
|
||||||
|
|
@ -49,37 +51,42 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledRect {
|
Loader {
|
||||||
anchors.left: minutes.left
|
anchors.left: minutes.left
|
||||||
anchors.leftMargin: minuteMetrics.tightBoundingRect.x
|
anchors.leftMargin: minuteMetrics.tightBoundingRect.x
|
||||||
y: hourMetrics.tightBoundingRect.height - implicitHeight
|
y: hourMetrics.tightBoundingRect.height - implicitHeight
|
||||||
|
|
||||||
color: Colours.tPalette.m3surfaceContainerHigh
|
active: GlobalConfig.services.useTwelveHourClock
|
||||||
radius: Tokens.rounding.large
|
asynchronous: true
|
||||||
|
|
||||||
implicitWidth: minuteMetrics.tightBoundingRect.width
|
sourceComponent: StyledRect {
|
||||||
implicitHeight: amPmMetrics.tightBoundingRect.height + Tokens.padding.large * 2
|
color: Colours.tPalette.m3surfaceContainerHigh
|
||||||
|
radius: Tokens.rounding.large
|
||||||
|
|
||||||
StyledText {
|
implicitWidth: minuteMetrics.tightBoundingRect.width
|
||||||
id: amPm
|
implicitHeight: amPmMetrics.tightBoundingRect.height + Tokens.padding.large * 2
|
||||||
|
|
||||||
anchors.centerIn: parent
|
StyledText {
|
||||||
width: amPmMetrics.tightBoundingRect.width
|
id: amPm
|
||||||
height: amPmMetrics.tightBoundingRect.height
|
|
||||||
transform: Translate {
|
|
||||||
x: -amPmMetrics.tightBoundingRect.x
|
|
||||||
y: -root.calcTopOff(amPmMetrics)
|
|
||||||
}
|
|
||||||
|
|
||||||
text: Time.amPmStr
|
anchors.centerIn: parent
|
||||||
color: Colours.palette.m3onSurface
|
width: amPmMetrics.tightBoundingRect.width
|
||||||
font: Tokens.font.headline.builders.small.scale(2 * root.centerScale).width(30).build()
|
height: amPmMetrics.tightBoundingRect.height
|
||||||
|
transform: Translate {
|
||||||
|
x: -amPmMetrics.tightBoundingRect.x
|
||||||
|
y: -root.calcTopOff(amPmMetrics)
|
||||||
|
}
|
||||||
|
|
||||||
TextMetrics {
|
text: Time.amPmStr
|
||||||
id: amPmMetrics
|
color: Colours.palette.m3onSurface
|
||||||
|
font: Tokens.font.headline.builders.small.scale(2 * root.centerScale).width(30).build()
|
||||||
|
|
||||||
text: amPm.text
|
TextMetrics {
|
||||||
font: amPm.font
|
id: amPmMetrics
|
||||||
|
|
||||||
|
text: amPm.text
|
||||||
|
font: amPm.font
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue