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
}
}
}

View File

@@ -11,6 +11,10 @@ Controls.Button {
topPadding: 8
bottomPadding: 8
font.family: "Roboto"
font.pixelSize: 14
font.weight: Font.Normal
property color backgroundColor: Palette.blueButtonColor
contentItem: Text {

View File

@@ -7,7 +7,6 @@ Controls.TextField {
id: control
readOnly: true
selectByMouse: true
implicitHeight: 34
horizontalAlignment: Text.AlignRight

View File

@@ -49,7 +49,7 @@ ApplicationWindow {
CustomControls.ColoredLabel {
text: CanController.isConnected ? "Штатный режим" : "Отсутствует связь с БМФ2"
backgroundColor: CanController.isConnected ? Palette.goodColor : Palette.invalidColor
backgroundColor: CanController.isConnected ? Palette.goodColor : Palette.errorColor
}
Item {

View File

@@ -16,8 +16,8 @@ QtObject {
property color redButtonColor: "#E74245"
property color yellowButtonColor: "#F4BB44"
property color informationColor: "#E2EAFF"
property color invalidColor: "#FFEDE3"
property color infoColor: "#E2EAFF"
property color goodColor: "#C4FFCA"
property color neutralColor: "#FEFBC6"
property color warningColor: "#FEFBC6"
property color errorColor: "#FFEDE3"
}