54 lines
1.1 KiB
QML
54 lines
1.1 KiB
QML
import QtQuick
|
|
import qs.Modules.Lock.Weather
|
|
import qs.Config
|
|
import qs.Components
|
|
import qs.Helpers
|
|
|
|
CustomRect {
|
|
id: root
|
|
|
|
required property int rootHeight
|
|
readonly property bool showForecast: rootHeight >= 700
|
|
|
|
color: DynamicColors.tPalette.m3surfaceContainer
|
|
implicitHeight: {
|
|
const base = brief.implicitHeight + brief.anchors.topMargin;
|
|
if (showForecast)
|
|
return base + Appearance.spacing.large + forecast.implicitHeight + forecast.anchors.margins;
|
|
return base + brief.anchors.topMargin;
|
|
}
|
|
radius: Appearance.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: Appearance.padding.extraLarge
|
|
rootHeight: root.rootHeight
|
|
}
|
|
|
|
Loader {
|
|
id: forecast
|
|
|
|
active: root.showForecast
|
|
anchors.bottom: parent.bottom
|
|
anchors.left: parent.left
|
|
anchors.margins: Appearance.padding.large
|
|
anchors.right: parent.right
|
|
asynchronous: true
|
|
|
|
sourceComponent: Forecast {
|
|
}
|
|
}
|
|
}
|