lock: better scaling

This commit is contained in:
2 * r + 2 * t 2025-08-12 17:24:39 +10:00
parent 68bb5dd7f9
commit ab531a83b7
3 changed files with 40 additions and 18 deletions

View file

@ -13,7 +13,8 @@ ColumnLayout {
required property var lock
readonly property list<string> timeComponents: Time.format(Config.services.useTwelveHourClock ? "hh:mm:A" : "hh:mm").split(":")
readonly property int centerWidth: Config.lock.sizes.centerWidth * Math.min(1, lock.screen.height / 1440)
readonly property real centerScale: Math.min(1, (lock.screen?.height ?? 1440) / 1440)
readonly property int centerWidth: Config.lock.sizes.centerWidth * centerScale
Layout.preferredWidth: centerWidth
Layout.fillHeight: true
@ -28,7 +29,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignVCenter
text: root.timeComponents[0]
color: Colours.palette.m3secondary
font.pointSize: Appearance.font.size.extraLarge * 3
font.pointSize: Appearance.font.size.extraLarge * 3 * root.centerScale
font.bold: true
}
@ -36,7 +37,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignVCenter
text: ":"
color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.extraLarge * 3
font.pointSize: Appearance.font.size.extraLarge * 3 * root.centerScale
font.bold: true
}
@ -44,7 +45,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignVCenter
text: root.timeComponents[1]
color: Colours.palette.m3secondary
font.pointSize: Appearance.font.size.extraLarge * 3
font.pointSize: Appearance.font.size.extraLarge * 3 * root.centerScale
font.bold: true
}
@ -59,7 +60,7 @@ ColumnLayout {
sourceComponent: StyledText {
text: root.timeComponents[2] ?? ""
color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.extraLarge * 2
font.pointSize: Appearance.font.size.extraLarge * 2 * root.centerScale
font.bold: true
}
}
@ -71,7 +72,7 @@ ColumnLayout {
text: Time.format("dddd, d MMMM yyyy")
color: Colours.palette.m3tertiary
font.pointSize: Appearance.font.size.extraLarge
font.pointSize: Appearance.font.size.extraLarge * root.centerScale
font.family: Appearance.font.family.mono
font.bold: true
}
@ -92,7 +93,7 @@ ColumnLayout {
text: "person"
fill: 1
grade: 200
font.pointSize: Math.floor(root.centerWidth / 4) || 1
font.pointSize: Math.floor(root.centerWidth / 4)
}
CachingImage {

View file

@ -87,13 +87,27 @@ ColumnLayout {
Layout.leftMargin: iconLoader.active ? 0 : width * 0.1
spacing: Appearance.spacing.normal
FetchText {
Loader {
Layout.fillWidth: true
asynchronous: true
active: root.height > 200
visible: active
sourceComponent: FetchText {
text: `OS : ${SysInfo.osPrettyName || SysInfo.osName}`
}
}
FetchText {
Loader {
Layout.fillWidth: true
asynchronous: true
active: root.height > 110
visible: active
sourceComponent: FetchText {
text: `WM : ${SysInfo.wm}`
}
}
FetchText {
text: `USER: ${SysInfo.user}`
@ -109,7 +123,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter
asynchronous: true
active: root.height > 220
active: root.height > 180
visible: active
sourceComponent: RowLayout {

View file

@ -18,17 +18,24 @@ ColumnLayout {
spacing: Appearance.spacing.small
StyledText {
Loader {
Layout.topMargin: Appearance.padding.large * 2
Layout.bottomMargin: -Appearance.padding.large
Layout.alignment: Qt.AlignHCenter
asynchronous: true
active: root.rootHeight > 610
visible: active
sourceComponent: StyledText {
text: qsTr("Weather")
color: Colours.palette.m3primary
font.pointSize: Appearance.font.size.extraLarge
font.weight: 500
}
}
RowLayout {
Layout.bottomMargin: forecastLoader.active ? 0 : Appearance.padding.large
Layout.fillWidth: true
spacing: Appearance.spacing.large