From f59cb6385c24f11406e40dcc1c0d62a04ce10d69 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 21 Mar 2022 13:21:14 +0100 Subject: [PATCH] Fix tooltips for powerbalance history graphs --- nymea-app/translations/nymea-app-de.ts | 46 ++++++++++++++++--- nymea-app/translations/nymea-app-en.ts | 20 +++++--- nymea-app/translations/nymea-app-en_US.ts | 20 +++++--- nymea-app/translations/nymea-app-it.ts | 20 +++++--- nymea-app/translations/nymea-app-ko.ts | 20 +++++--- nymea-app/translations/nymea-app-nl.ts | 20 +++++--- nymea-app/translations/nymea-app-tr.ts | 20 +++++--- nymea-app/translations/nymea-app-vi.ts | 20 +++++--- .../energy/PowerConsumptionBalanceHistory.qml | 35 ++++++++++++-- .../energy/PowerProductionBalanceHistory.qml | 40 ++++++++++++++-- 10 files changed, 204 insertions(+), 57 deletions(-) diff --git a/nymea-app/translations/nymea-app-de.ts b/nymea-app/translations/nymea-app-de.ts index d99ba890..847ffe4f 100644 --- a/nymea-app/translations/nymea-app-de.ts +++ b/nymea-app/translations/nymea-app-de.ts @@ -5326,7 +5326,7 @@ Möchtest Du fortfahren? This will start a system update. Note that the update might take several minutes and your %1 might not be functioning properly or restart during this time. - Diese Aktion wird ein System-Update starten. Dies kann mehrere Minuten dauern und Dein %1 System könnte in dieser Zeit gegebenenfalls nicht ordungsgemäß funktionieren. + Diese Aktion wird ein System-Update starten. Dies kann mehrere Minuten dauern und Dein %1 System könnte in dieser Zeit gegebenenfalls nicht ordungsgemäß funktionieren. @@ -5512,15 +5512,31 @@ Möchtest Du fortfahren? Self production: %1 kW - Eigenproduktion: %1 kW + Eigenproduktion: %1 kW From battery: %1 kW - Batterie: %1 kW + Batterie: %1 kW From grid: %1 kW - Netzbezug: %1 kW + Netzbezug: %1 kW + + + Total consumption: %1 %2 + Gesamtverbrauch: %1 %2 + + + Self production: %1 %2 + Eigenproduktion: %1 %2 + + + From battery: %1 %2 + Von Batterie: %1 %2 + + + From grid: %1 %2 + Netzbezug: %1 %2 @@ -5543,15 +5559,31 @@ Möchtest Du fortfahren? To battery: %1 kW - Batterie: %1 kW + Batterie: %1 kW To grid: %1 kW - Netzeinspeisung: %1 kW + Netzeinspeisung: %1 kW Consumed: %1 kW - Verbraucht: %1 kW + Verbraucht: %1 kW + + + Total production: %1 %2 + Gesamtproduktion: %1 %2 + + + Consumed: %1 %2 + Verbraucht: %1 %2 + + + To battery: %1 %2 + Batterieladung: %1 %2 + + + To grid: %1 %2 + Netzeinspeisung: %1 %2 diff --git a/nymea-app/translations/nymea-app-en.ts b/nymea-app/translations/nymea-app-en.ts index 9f345e20..3c6340ce 100644 --- a/nymea-app/translations/nymea-app-en.ts +++ b/nymea-app/translations/nymea-app-en.ts @@ -5239,15 +5239,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5270,15 +5274,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/translations/nymea-app-en_US.ts b/nymea-app/translations/nymea-app-en_US.ts index ec712795..82672440 100644 --- a/nymea-app/translations/nymea-app-en_US.ts +++ b/nymea-app/translations/nymea-app-en_US.ts @@ -5239,15 +5239,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5270,15 +5274,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/translations/nymea-app-it.ts b/nymea-app/translations/nymea-app-it.ts index 163ed8ad..fad74d1d 100644 --- a/nymea-app/translations/nymea-app-it.ts +++ b/nymea-app/translations/nymea-app-it.ts @@ -5286,15 +5286,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5317,15 +5321,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/translations/nymea-app-ko.ts b/nymea-app/translations/nymea-app-ko.ts index 9c798710..123e1380 100644 --- a/nymea-app/translations/nymea-app-ko.ts +++ b/nymea-app/translations/nymea-app-ko.ts @@ -5397,15 +5397,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5428,15 +5432,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/translations/nymea-app-nl.ts b/nymea-app/translations/nymea-app-nl.ts index 2839e6db..7620c755 100644 --- a/nymea-app/translations/nymea-app-nl.ts +++ b/nymea-app/translations/nymea-app-nl.ts @@ -5297,15 +5297,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5328,15 +5332,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/translations/nymea-app-tr.ts b/nymea-app/translations/nymea-app-tr.ts index 72dd956f..2fbde4ca 100644 --- a/nymea-app/translations/nymea-app-tr.ts +++ b/nymea-app/translations/nymea-app-tr.ts @@ -5435,15 +5435,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5466,15 +5470,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/translations/nymea-app-vi.ts b/nymea-app/translations/nymea-app-vi.ts index c3973ad6..d0cf08d5 100644 --- a/nymea-app/translations/nymea-app-vi.ts +++ b/nymea-app/translations/nymea-app-vi.ts @@ -5222,15 +5222,19 @@ Do you want to proceed? - Self production: %1 kW + Total consumption: %1 %2 - From battery: %1 kW + Self production: %1 %2 - From grid: %1 kW + From battery: %1 %2 + + + + From grid: %1 %2 @@ -5253,15 +5257,19 @@ Do you want to proceed? - To battery: %1 kW + Total production: %1 %2 - To grid: %1 kW + Consumed: %1 %2 - Consumed: %1 kW + To battery: %1 %2 + + + + To grid: %1 %2 diff --git a/nymea-app/ui/mainviews/energy/PowerConsumptionBalanceHistory.qml b/nymea-app/ui/mainviews/energy/PowerConsumptionBalanceHistory.qml index 18541e72..5952414c 100644 --- a/nymea-app/ui/mainviews/energy/PowerConsumptionBalanceHistory.qml +++ b/nymea-app/ui/mainviews/energy/PowerConsumptionBalanceHistory.qml @@ -296,6 +296,14 @@ Item { font: Style.smallFont } + Label { + property double value: acquisitionUpperSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("Total consumption: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") + font: Style.extraSmallFont + } + RowLayout { Rectangle { width: Style.extraSmallFont.pixelSize @@ -304,7 +312,14 @@ Item { } Label { - text: qsTr("Self production: %1 kW").arg(selfProductionUpperSeries.at(toolTip.seriesIndex).y.toFixed(2)) + // Workaround for Qt bug that lowerSeries is non-notifyable and throws warnings + Component.onCompleted: lowerSeries = selfProductionSeries.lowerSeries + property XYSeries lowerSeries: null + + property double value: selfProductionUpperSeries.at(toolTip.seriesIndex).y - lowerSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("Self production: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } } @@ -316,7 +331,14 @@ Item { } Label { - text: qsTr("From battery: %1 kW").arg(storageUpperSeries.at(toolTip.seriesIndex).y.toFixed(2)) + // Workaround for Qt bug that lowerSeries is non-notifyable and throws warnings + Component.onCompleted: lowerSeries = storageSeries.lowerSeries + property XYSeries lowerSeries: null + + property double value: storageUpperSeries.at(toolTip.seriesIndex).y - lowerSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("From battery: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } } @@ -328,7 +350,14 @@ Item { } Label { - text: qsTr("From grid: %1 kW").arg(acquisitionUpperSeries.at(toolTip.seriesIndex).y.toFixed(2)) + // Workaround for Qt bug that lowerSeries is non-notifyable and throws warnings + Component.onCompleted: lowerSeries = acquisitionSeries.lowerSeries + property XYSeries lowerSeries: null + + property double value: acquisitionUpperSeries.at(toolTip.seriesIndex).y - lowerSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("From grid: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } } diff --git a/nymea-app/ui/mainviews/energy/PowerProductionBalanceHistory.qml b/nymea-app/ui/mainviews/energy/PowerProductionBalanceHistory.qml index 07d275fb..5241ce65 100644 --- a/nymea-app/ui/mainviews/energy/PowerProductionBalanceHistory.qml +++ b/nymea-app/ui/mainviews/energy/PowerProductionBalanceHistory.qml @@ -286,15 +286,30 @@ Item { font: Style.smallFont } + Label { + property double value: acquisitionUpperSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("Total production: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") + font: Style.extraSmallFont + } + RowLayout { Rectangle { width: Style.extraSmallFont.pixelSize height: width - color: Style.green + color: Style.red } Label { - text: qsTr("Consumed: %1 kW").arg(selfConsumptionUpperSeries.at(toolTip.seriesIndex).y.toFixed(2)) + // Workaround for Qt bug that lowerSeries is non-notifyable and throws warnings + Component.onCompleted: lowerSeries = selfConsumptionSeries.lowerSeries + property XYSeries lowerSeries: null + + property double value: selfConsumptionUpperSeries.at(toolTip.seriesIndex).y - lowerSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } } @@ -306,19 +321,34 @@ Item { } Label { - text: qsTr("To battery: %1 kW").arg(storageUpperSeries.at(toolTip.seriesIndex).y.toFixed(2)) + // Workaround for Qt bug that lowerSeries is non-notifyable and throws warnings + Component.onCompleted: lowerSeries = storageSeries.lowerSeries + property XYSeries lowerSeries: null + + property double value: storageUpperSeries.at(toolTip.seriesIndex).y - lowerSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("To battery: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont + onValueChanged: print("value:", value, "Upper:", storageUpperSeries.at(toolTip.seriesIndex).y, "lower:", lowerSeries.at(toolTip.seriesIndex).y) } } RowLayout { Rectangle { width: Style.extraSmallFont.pixelSize height: width - color: Style.red + color: Style.green } Label { - text: qsTr("To grid: %1 kW").arg(acquisitionUpperSeries.at(toolTip.seriesIndex).y.toFixed(2)) + // Workaround for Qt bug that lowerSeries is non-notifyable and throws warnings + Component.onCompleted: lowerSeries = acquisitionSeries.lowerSeries + property XYSeries lowerSeries: null + + property double value: acquisitionUpperSeries.at(toolTip.seriesIndex).y - lowerSeries.at(toolTip.seriesIndex).y + property bool translate: value >= 1000 + property double translatedValue: value / (translate ? 1000 : 1) + text: qsTr("To grid: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } }