nosignal-shell/modules/lock/WeatherInfo.qml
2 * r + 2 * t 318d20fec2 feat: add hourly forecast to lock weather
Shows if screen is large
2026-06-02 18:24:08 +10:00

51 lines
1.2 KiB
QML

import "weather"
import QtQuick
import Caelestia.Config
import qs.components
import qs.services
StyledRect {
id: root
required property int rootHeight
readonly property bool showForecast: rootHeight >= Tokens.sizes.lock.showForecastHeight
implicitHeight: {
const base = brief.implicitHeight + brief.anchors.topMargin;
if (showForecast)
return base + Tokens.spacing.largeIncreased + forecast.implicitHeight + forecast.anchors.margins;
return base + brief.anchors.topMargin;
}
radius: Tokens.rounding.extraExtraLarge
color: Colours.tPalette.m3surfaceContainer
Timer {
running: true
triggeredOnStart: true
repeat: true
interval: 900000 // 15 minutes
onTriggered: Weather.reload()
}
BriefInfo {
id: brief
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Tokens.padding.extraLarge
}
Loader {
id: forecast
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Tokens.padding.large
active: root.showForecast
asynchronous: true
sourceComponent: Forecast {}
}
}