From ab531a83b700788440d02ca0c3026bb05612515e Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 12 Aug 2025 17:24:39 +1000 Subject: lock: better scaling --- modules/lock/Center.qml | 15 ++++++++------- modules/lock/Fetch.qml | 24 +++++++++++++++++++----- modules/lock/WeatherInfo.qml | 19 +++++++++++++------ 3 files changed, 40 insertions(+), 18 deletions(-) (limited to 'modules') diff --git a/modules/lock/Center.qml b/modules/lock/Center.qml index 45c14e0..005a13c 100644 --- a/modules/lock/Center.qml +++ b/modules/lock/Center.qml @@ -13,7 +13,8 @@ ColumnLayout { required property var lock readonly property list 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 { diff --git a/modules/lock/Fetch.qml b/modules/lock/Fetch.qml index 755e7f8..815807b 100644 --- a/modules/lock/Fetch.qml +++ b/modules/lock/Fetch.qml @@ -87,12 +87,26 @@ ColumnLayout { Layout.leftMargin: iconLoader.active ? 0 : width * 0.1 spacing: Appearance.spacing.normal - FetchText { - text: `OS : ${SysInfo.osPrettyName || SysInfo.osName}` + Loader { + Layout.fillWidth: true + asynchronous: true + active: root.height > 200 + visible: active + + sourceComponent: FetchText { + text: `OS : ${SysInfo.osPrettyName || SysInfo.osName}` + } } - FetchText { - text: `WM : ${SysInfo.wm}` + Loader { + Layout.fillWidth: true + asynchronous: true + active: root.height > 110 + visible: active + + sourceComponent: FetchText { + text: `WM : ${SysInfo.wm}` + } } FetchText { @@ -109,7 +123,7 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter asynchronous: true - active: root.height > 220 + active: root.height > 180 visible: active sourceComponent: RowLayout { diff --git a/modules/lock/WeatherInfo.qml b/modules/lock/WeatherInfo.qml index 3695061..9da0b9b 100644 --- a/modules/lock/WeatherInfo.qml +++ b/modules/lock/WeatherInfo.qml @@ -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 - text: qsTr("Weather") - color: Colours.palette.m3primary - font.pointSize: Appearance.font.size.extraLarge - font.weight: 500 + + 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 -- cgit v1.2.3-freya