Drop the non working totals label in energy thing pages

This commit is contained in:
Michael Zanetti 2021-12-16 01:32:19 +01:00
parent d8302cf86d
commit 13c341afd5
4 changed files with 5 additions and 87 deletions

View File

@ -257,7 +257,6 @@
<file>ui/components/CircleBackground.qml</file>
<file>ui/devicepages/CoolingThingPage.qml</file>
<file>ui/devicepages/EvChargerThingPage.qml</file>
<file>ui/components/BlurredLabel.qml</file>
<file>ui/components/NymeaSpinBox.qml</file>
<file>ui/mainviews/EnergyPieChartDelegate.qml</file>
<file>ui/mainviews/energy/PowerConsumptionBalanceHistory.qml</file>

View File

@ -1,38 +0,0 @@
import QtQuick 2.5
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
import Nymea 1.0
Item {
id: root
implicitWidth: label.implicitWidth + Style.margins * 2
implicitHeight: label.implicitHeight + Style.margins * 2
property alias text: label.text
property alias font: label.font
property alias wrapMode: label.wrapMode
property alias horizontalAlignment: label.horizontalAlignment
property alias textFormat: label.textFormat
property bool blurred: false
Label {
id: label
anchors.fill: parent
}
ShaderEffectSource {
id: effectSource
anchors.fill: parent
sourceItem: label
hideSource: true
visible: false
}
FastBlur {
anchors.fill: parent
source: effectSource
radius: root.blurred ? 32 : 0
Behavior on radius { NumberAnimation { duration: Style.animationDuration } }
}
}

View File

@ -220,54 +220,6 @@ ThingPageBase {
: 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>")
: ""
}
BlurredLabel {
Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
visible: isEnergyMeter || isConsumer
blurred: periodConsumptionModel.busy
font: Style.smallFont
text: isConsumer ?
qsTr("A total of %1 kWh has been <b>consumed</b> in the last 24 hours.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + (totalPeriodConsumption).toFixed(1) + '</span>')
: qsTr("A total of %1 kWh has been <b>obtained</b> in the last 24 hours.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + (totalPeriodConsumption).toFixed(1) + '</span>')
textFormat: Text.RichText
LogsModel {
id: periodConsumptionModel
engine: root.isEnergyMeter || root.isConsumer ? _engine : null
thingId: root.thing.id
typeIds: isEnergyMeter ? [root.totalEnergyConsumedStateType.id] : []
viewStartTime: root.startTime
live: true
}
property LogEntry logEntryAtStart: periodConsumptionModel.busy ? null : periodConsumptionModel.findClosest(periodConsumptionModel.viewStartTime)
property double totalPeriodConsumption: logEntryAtStart && totalEnergyConsumedState ? totalEnergyConsumedState.value - logEntryAtStart.value : 0
}
BlurredLabel {
visible: isEnergyMeter || isProducer
Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
blurred: periodProductionModel.busy
font: Style.smallFont
text: isProducer ?
qsTr("A total of %1 kWh has been <b>produced</b> in the last 24 hours.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + (totalPeriodProduction).toFixed(1) + '</span>')
: qsTr("A total of %1 kWh has been <b>returned</b> in the last 24 hours.").arg('<span style="font-size:' + Style.bigFont.pixelSize + 'px">' + (totalPeriodProduction).toFixed(1) + '</span>')
textFormat: Text.RichText
LogsModel {
id: periodProductionModel
engine: root.isEnergyMeter || root.isProducer ? _engine : null
thingId: root.thing.id
typeIds: isEnergyMeter ? [root.totalEnergyProducedStateType.id] : []
viewStartTime: root.startTime
live: true
}
property LogEntry logEntryAtStart: periodProductionModel.busy ? null : periodProductionModel.findClosest(periodProductionModel.viewStartTime)
property double totalPeriodProduction: logEntryAtStart && totalEnergyProducedState ? totalEnergyProducedState.value - logEntryAtStart.value : 0
}
}
}
}

View File

@ -16,6 +16,11 @@ ChartView {
property EnergyManager energyManager: null
ThingsProxy {
id: batteries
engine: _engine
shownInterfaces: ["energystorage"]
}
PieSeries {
id: consumptionBalanceSeries