Merge PR #687: Fix layout issues in smart meter views

This commit is contained in:
Jenkins nymea 2021-10-01 12:54:48 +02:00
commit 2b59a118b7
2 changed files with 10 additions and 8 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 {
@ -235,8 +235,7 @@ ThingPageBase {
LogsModel {
id: periodConsumptionModel
objectName: "Root meter model"
engine: root.isEnergyMeter ? _engine : null
engine: root.isEnergyMeter || root.isConsumer ? _engine : null
thingId: root.thing.id
typeIds: isEnergyMeter ? [root.totalEnergyConsumedStateType.id] : []
viewStartTime: root.startTime
@ -260,7 +259,7 @@ ThingPageBase {
LogsModel {
id: periodProductionModel
engine: root.isEnergyMeter ? _engine : null
engine: root.isEnergyMeter || root.isProducer ? _engine : null
thingId: root.thing.id
typeIds: isEnergyMeter ? [root.totalEnergyProducedStateType.id] : []
viewStartTime: root.startTime