Files
z-bar-qt/Modules/Lock/WeatherInfo.qml
T

55 lines
1.1 KiB
QML

import QtQuick
import qs.Modules.Lock.Weather
import ZShell.Config
import qs.Components
import qs.Helpers
import qs.Services
CustomRect {
id: root
required property int rootHeight
readonly property bool showForecast: rootHeight >= 700
color: Colors.tPalette.m3surfaceContainer
implicitHeight: {
const base = brief.implicitHeight + brief.anchors.topMargin;
if (showForecast)
return base + Tokens.spacing.large + forecast.implicitHeight + forecast.anchors.margins;
return base + brief.anchors.topMargin;
}
radius: Tokens.rounding.small
Timer {
interval: 900000 // 15 minutes
repeat: true
running: true
triggeredOnStart: true
onTriggered: Weather.reload()
}
BriefInfo {
id: brief
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Tokens.padding.extraLarge
rootHeight: root.rootHeight
}
Loader {
id: forecast
active: root.showForecast
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.margins: Tokens.padding.large
anchors.right: parent.right
asynchronous: true
sourceComponent: Forecast {
}
}
}