From 18af8ab4ac6b44c4713d1c3e99aecc6f5dec4d98 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 1 Jun 2026 22:37:12 +1000 Subject: [PATCH] refactor: lock weather into new file --- modules/lock/WeatherInfo.qml | 55 +--------------------------- modules/lock/weather/BriefInfo.qml | 59 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 modules/lock/weather/BriefInfo.qml diff --git a/modules/lock/WeatherInfo.qml b/modules/lock/WeatherInfo.qml index dce8acc8..85a3113f 100644 --- a/modules/lock/WeatherInfo.qml +++ b/modules/lock/WeatherInfo.qml @@ -1,7 +1,5 @@ -pragma ComponentBehavior: Bound - +import "weather" import QtQuick -import QtQuick.Layouts import Caelestia.Config import qs.components import qs.services @@ -23,58 +21,9 @@ StyledRect { onTriggered: Weather.reload() } - ColumnLayout { + BriefInfo { id: layout anchors.centerIn: parent - spacing: Tokens.spacing.extraSmall - - StyledText { - Layout.alignment: Qt.AlignHCenter - animate: true - text: Weather.description - color: Colours.palette.m3onSurfaceVariant - font: Tokens.font.body.large - } - - RowLayout { - Layout.alignment: Qt.AlignHCenter - spacing: Tokens.spacing.medium - - StyledText { - id: temp - - animate: true - text: Weather.temp - color: Colours.palette.m3primary - font: Tokens.font.headline.builders.large.scale(1.5).weight(Font.DemiBold).width(80).build() - } - - MaterialIcon { - animate: true - text: Weather.icon - color: Colours.palette.m3tertiary - fontStyle: Tokens.font.headline.builders.large.scale(1.5).build() - } - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - animate: true - text: qsTr("Feels like %1").arg(Weather.temp) - color: Colours.palette.m3onSurfaceVariant - font: Tokens.font.body.large - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - animate: true - text: { - const today = Weather.forecast[0]; - return qsTr("High %1 • Low %2").arg(Weather.formatTemp(today?.maxTempC)).arg(Weather.formatTemp(today?.minTempC)); - } - color: Colours.palette.m3onSurfaceVariant - font: Tokens.font.body.medium - } } } diff --git a/modules/lock/weather/BriefInfo.qml b/modules/lock/weather/BriefInfo.qml new file mode 100644 index 00000000..3a90a094 --- /dev/null +++ b/modules/lock/weather/BriefInfo.qml @@ -0,0 +1,59 @@ +import QtQuick +import QtQuick.Layouts +import Caelestia.Config +import qs.components +import qs.services + +ColumnLayout { + id: root + + spacing: Tokens.spacing.extraSmall + + StyledText { + Layout.alignment: Qt.AlignHCenter + animate: true + text: Weather.description + color: Colours.palette.m3onSurfaceVariant + font: Tokens.font.body.large + } + + RowLayout { + Layout.alignment: Qt.AlignHCenter + spacing: Tokens.spacing.medium + + StyledText { + id: temp + + animate: true + text: Weather.temp + color: Colours.palette.m3primary + font: Tokens.font.headline.builders.large.scale(1.5).weight(Font.DemiBold).width(80).build() + } + + MaterialIcon { + animate: true + text: Weather.icon + color: Colours.palette.m3secondary + fontStyle: Tokens.font.headline.builders.large.scale(1.5).build() + } + } + + StyledText { + Layout.alignment: Qt.AlignHCenter + animate: true + text: qsTr("Feels like %1").arg(Weather.temp) + color: Colours.palette.m3onSurfaceVariant + font: Tokens.font.body.large + } + + StyledText { + Layout.alignment: Qt.AlignHCenter + animate: true + text: { + const today = Weather.forecast[0]; + return qsTr("High %1 • Low %2").arg(Weather.formatTemp(today?.maxTempC)).arg(Weather.formatTemp(today?.minTempC)); + } + color: Colours.palette.m3onSurfaceVariant + font: Tokens.font.body.medium + } +}