implemented "notCharging" Battery state

This commit is contained in:
Dorian Zedler 2020-12-28 16:17:12 +01:00
parent eb16d893e7
commit de22aa9a7b
Signed by: dorian
GPG Key ID: D3B255CB8BC7CD37
4 changed files with 59 additions and 2 deletions

View File

@ -8,6 +8,7 @@ Rectangle {
property color warningColor: "orange"
property color criticalColor: "red"
property color unknownColor: "grey"
property color notChargingColor: "red"
property color backgroundColor: "white"
property double indicatorSize: 1
@ -78,6 +79,25 @@ Rectangle {
}
}
Text {
id: questionMarkText
visible: false
anchors.centerIn: parent
height: parent.height * 0.7
width: parent.width * 0.7
color: outerRect.color
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.bold: true
font.pixelSize: height
text: "?"
}
ParallelAnimation {
id: chargingAnimation
@ -133,6 +153,24 @@ Rectangle {
}
},
State {
name: "notCharging"
PropertyChanges {
target: control
border.color: control.notChargingColor
}
PropertyChanges {
target: innerRect
amountFilled: 0
}
PropertyChanges {
target: questionMarkText
visible: true
}
},
State {
name: "fine"
PropertyChanges {
@ -170,6 +208,24 @@ Rectangle {
target: innerRect
amountFilled: 0.1
}
},
State {
name: "unknown"
PropertyChanges {
target: control
border.color: control.unknownColor
}
PropertyChanges {
target: innerRect
amountFilled: 0
}
PropertyChanges {
target: questionMarkText
visible: true
}
}
]

View File

@ -69,6 +69,7 @@ SmoothItemDelegate {
fineColor: appTheme.theme.colors.success
warningColor: appTheme.theme.colors.warning
criticalColor: appTheme.theme.colors.error
notChargingColor: warningColor
state: control.batteryState

View File

@ -93,7 +93,7 @@ ListView {
delegate: ConnectionDelegate {
property var thisExtension: speedBackend.scStwClient.extensions[laneContainerRect.thisLane][index]
property var stateTranslations: ["disconnected", "connecting", "connecting", "connected"]
property var batteryStateStrings: ["critical", "warning", "fine", "charging"]
property var batteryStateStrings: ["critical", "warning", "fine", "charging", "notCharging"]
color: control.backgroundColor
batteryState: thisExtension["batteryState"] === -1 ? "unknown":batteryStateStrings[thisExtension["batteryState"]]

@ -1 +1 @@
Subproject commit 35fb805849889295ed21b20f21423dba3253d622
Subproject commit 92fae096726f559cf36a87816ab97093db555d8b