Now statuses have different colors. Various minor fixes

This commit is contained in:
Yury Shuvakin
2025-08-15 18:53:38 +09:00
parent 978f6ee04d
commit b861ce003c
11 changed files with 124 additions and 109 deletions

View File

@@ -62,14 +62,14 @@ Rectangle {
}
CustomControls.TextField {
text: battery ? convertDoubleToString(battery.controlCurrent) : "—"
text: battery ? convertIntToString(battery.controlCurrent) : "—"
indicatorText: "А"
Layout.fillWidth: true
Layout.preferredWidth: 1
}
CustomControls.TextField {
text: battery ? convertDoubleToString(battery.measuredCurrent) : "—"
text: battery ? convertIntToString(battery.measuredCurrent) : "—"
indicatorText: "А"
Layout.fillWidth: true
Layout.preferredWidth: 1
@@ -90,14 +90,14 @@ Rectangle {
}
CustomControls.TextField {
text: battery ? convertDoubleToString(battery.controlTemperature) : "—"
text: battery ? convertIntToString(battery.controlTemperature) : "—"
indicatorText: "°C"
Layout.fillWidth: true
Layout.preferredWidth: 1
}
CustomControls.TextField {
text: battery ? convertDoubleToString(battery.measuredTemperature) : "—"
text: battery ? convertIntToString(battery.measuredTemperature) : "—"
indicatorText: "°C"
implicitWidth: 1
Layout.fillWidth: true
@@ -130,7 +130,7 @@ Rectangle {
delegate: CustomControls.ColoredLabel {
text: modelData.description
backgroundColor: Palette.neutralColor
backgroundColor: statusSeverityToColor(modelData.severity)
font.pixelSize: 12
width: parent.width
}
@@ -183,4 +183,18 @@ Rectangle {
return Palette.blueButtonColor
}
}
function statusSeverityToColor(severity) {
switch (severity) {
case BatteryController.Good:
return Palette.goodColor
case BatteryController.Warning:
return Palette.warningColor
case BatteryController.Error:
return Palette.errorColor
case BatteryController.Info:
default:
return Palette.infoColor
}
}
}