Some improvements in the evcharger view

This commit is contained in:
Michael Zanetti 2021-10-01 12:11:37 +02:00
parent abe3a26c91
commit 5eb8c50865
2 changed files with 8 additions and 5 deletions

View File

@ -42,6 +42,7 @@ ThingPageBase {
readonly property State maxChargingCurrentState: thing.stateByName("maxChargingCurrent")
readonly property StateType maxChargingCurrentStateType: thing.thingClass.stateTypes.findByName("maxChargingCurrent")
readonly property State currentPowerState: thing.stateByName("currentPower")
readonly property State pluggedInState: thing.stateByName("pluggedIn")
ActionQueue {
id: actionQueue
@ -110,10 +111,12 @@ ThingPageBase {
property double currentPower: root.currentPowerState.value / (root.currentPowerState.value > 1000 ? 1000 : 1)
property string unit: root.currentPowerState.value > 1000 ? "kW" : "W"
font: Style.smallFont
text: qsTr("Currently charging at %1.")
.arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">'
+ (currentPower.toFixed(1))
+ '</span>' + ' ' + unit)
text: root.pluggedInState.value === false
? qsTr("The car is not plugged in.")
: root.powerState.value === true
? qsTr("Currently charging at %1.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + (currentPower.toFixed(1)) + '</span>' + ' ' + unit)
: ""
textFormat: Text.RichText
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap

View File

@ -218,7 +218,7 @@ ThingPageBase {
text: isCharging ? qsTr("At the current rate, the battery will be fully charged at %1.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + endTime.toLocaleTimeString(Locale.ShortFormat) + "</span>")
: isDischarging ? qsTr("At the current rate, the battery will last until %1.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + endTime.toLocaleTimeString(Locale.ShortFormat) + "</span>")
: qsTr("The battery is fully charged")
: ""
}
BlurredLabel {