Files
harbour-aira/qml/cover/CoverPage.qml
T
kaneda a281a7e112 0.6.2: pallino rosso solo per un allarme che ferma la macchina (avviso = ambra)
Il pallino era rosso per qualunque voce nell'elenco errori: un semplice avviso
(compressore limitato dalla temperatura esterna, caso reale del 10/10) sembrava
un guasto. Ora il ponte espone in /summary anche error_severity e
alarm_stopping, e il livello 3 (rosso) e' riservato agli allarmi che fermano la
macchina o di severita' CRITICAL/ERROR; avviso = ambra. Copertina allineata.

6 verifiche nuove nell'harness del nucleo (avviso/stop/critical/error/
precedenza sul modo attivo/gravita' ignota = ambra).
2026-10-10 18:16:04 +02:00

101 lines
3.3 KiB
QML

import QtQuick 2.0
import Sailfish.Silica 1.0
// Copertina: legge api.summary (context property C++), quindi non dipende
// dallo scope delle property della pagina principale.
CoverBackground {
id: cover
function t(key) {
var v = api.summary[key]
return api.formatValue(v)
}
// Colore del pallino: gli stessi criteri della Home (vedi MainPage.qml).
// Un dato vecchio e' ambra come un modo attivo: un dato vecchio non e' un
// dato buono, e la copertina e' il posto dove si guarda di sfuggita.
// Rosso solo per un allarme che ferma la macchina (livello 3): un avviso
// (livello 2) e' ambra.
function statusColor() {
if (!api.hasData || api.stale)
return "orange"
var livello = api.statusLevel()
if (livello === 3)
return Theme.errorColor
if (livello === 2)
return "#ffb300"
if (livello === 1)
return Theme.highlightColor
return "#4caf50"
}
Row {
id: intestazione
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Theme.paddingLarge
spacing: Theme.paddingSmall
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: Theme.paddingSmall
height: width
radius: width / 2
color: cover.statusColor()
}
Label {
text: "Aira"
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeLarge
}
}
Column {
anchors.centerIn: parent
width: parent.width - 2 * Theme.paddingLarge
spacing: Theme.paddingSmall
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
// Spenta quando i numeri sono vecchi: non deve sembrare fresca.
color: api.stale ? Theme.secondaryColor : Theme.primaryColor
text: cover.t("zone1_temperature") + " °C"
font.pixelSize: Theme.fontSizeHuge
}
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: qsTr("house · target %1 °C").arg(cover.t("zone1_setpoint"))
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
truncationMode: TruncationMode.Fade
}
Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: qsTr("DHW %1 °C · target %2 °C").arg(cover.t("dhw_current")).arg(cover.t("dhw_target"))
color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
truncationMode: TruncationMode.Fade
}
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingMedium
// Qui c'e' posto per dire che i numeri non sono freschi.
text: api.stale
? qsTr("Not updated · last %1").arg(api.lastUpdate)
: qsTr("outside %1 °C").arg(cover.t("outdoor_temperature"))
color: api.stale ? "orange" : Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
truncationMode: TruncationMode.Fade
width: parent.width - 2 * Theme.paddingMedium
}
}