diff --git a/ChargerTabPage.qml b/ChargerTabPage.qml index 739e7fa..cdc765e 100644 --- a/ChargerTabPage.qml +++ b/ChargerTabPage.qml @@ -70,6 +70,22 @@ AnimatedStackView { } Text { + ApiKeyValueHelper { + id: chargingDurationInfo + deviceConnection: theDeviceConnection + apiKey: "cdi" + } + ApiKeyValueHelper { + id: powerInfo + deviceConnection: theDeviceConnection + apiKey: "nrg" + } + ApiKeyValueHelper { + id: energyInfo + deviceConnection: theDeviceConnection + apiKey: "wh" + } + Layout.fillWidth: true text: { @@ -77,13 +93,45 @@ AnimatedStackView { { case 0: return null case 1: return qsTr("Plug in the cable to start charging your car") - case 2: return "TODO duration" + case 2: return qsTr("Duration: %0").arg(getDurationInfo()) + "\n" + + qsTr("Speed: %0").arg(getChargingSpeed()) + "\n" + + qsTr("Amount: %0").arg(getChargingAmount()) case 3: return qsTr("Charger is connecting to your car, it usually takes a few seconds") case 4: return qsTr("Let's go-e :)") case 5: return null } } wrapMode: Text.Wrap + + function getDurationInfo() { + if (!chargingDurationInfo.exists) + return qsTr("(api key doesnt exist)") + if (typeof chargingDurationInfo.value == null) + return qsTr("(api key is null)") + if (typeof chargingDurationInfo.value !== 'object') + return qsTr("(api key is not an object)") + if (!('type' in chargingDurationInfo.value)) + return qsTr("(api key does not contain a type)") + switch (chargingDurationInfo.value.type) + { + case 0: // counter going up, use rbt + return formatDuration(rebootTime.value - chargingDurationInfo.value.value) + case 1: // counter frozen, absolute duration + return formatDuration(chargingDurationInfo.value.value) + } + return qsTr("(api key has unknown type %0)").arg(chargingDurationInfo.value.type) + } + + function getChargingSpeed() { + return qsTr("%0 %1 %2") + .arg(qsTr("%0 A").arg(Qt.locale().toString(powerInfo.value[4], 'f', 1))) + .arg(qsTr("%0 A").arg(Qt.locale().toString(powerInfo.value[5], 'f', 1))) + .arg(qsTr("%0 A").arg(Qt.locale().toString(powerInfo.value[6], 'f', 1))) + } + + function getChargingAmount() { + return qsTr("%0 kWh").arg(Qt.locale().toString(energyInfo.value / 1000., 'f', 1)) + } } } diff --git a/ControllerTabPage.qml b/ControllerTabPage.qml index bd6617c..28a643d 100644 --- a/ControllerTabPage.qml +++ b/ControllerTabPage.qml @@ -66,25 +66,30 @@ AnimatedStackView { } WhiteBox { - GridLayout { - colums: 3 + Layout.fillWidth: true + Layout.preferredHeight: gridLayout.implicitHeight + 20 - Pane { - Component.onCompleted: { - background.color = "white" - background.radius = 5 - } - } - Pane { - Component.onCompleted: { - background.color = "white" - background.radius = 5 - } - } - Pane { - Component.onCompleted: { - background.color = "white" - background.radius = 5 + GridLayout { + id: gridLayout + anchors.fill: parent + columns: 3 + + Repeater { + model: 9 + + Pane { + Layout.fillWidth: true + Layout.preferredHeight: 50 + + Component.onCompleted: { + background.color = "grey" + background.radius = 5 + } + + Text { + anchors.fill: parent + text: qsTr("Category") + } } } } @@ -104,7 +109,7 @@ AnimatedStackView { Text { Layout.fillWidth: true -< + text: "Controller TODO" } diff --git a/i18n/qml_de.ts b/i18n/qml_de.ts index 3db2d2d..88c62fd 100644 --- a/i18n/qml_de.ts +++ b/i18n/qml_de.ts @@ -403,86 +403,156 @@ Unbekannter Fehler %0 - - + + Plug in the cable to start charging your car Stecke das Kabel ein, um dein Auto aufzuladen - - + + + Duration: %0 + + + + + + Speed: %0 + + + + + + Amount: %0 + + + + + Charger is connecting to your car, it usually takes a few seconds Der Charger stellt die Verbindung zu deinem Auto her, das dauert in der Regel ein paar Sekunden - - + + Let's go-e :) Let's go-e :) - - + + + (api key doesnt exist) + + + + + + (api key is null) + + + + + + (api key is not an object) + + + + + + (api key does not contain a type) + + + + + + (api key has unknown type %0) + + + + + + %0 %1 %2 + + + + + + + + + + %0 A + + + + + + %0 kWh + + + + + Price limit Preisgrenze - - + + %0 ct/kWh %0 ct/kWh - - + + By %0 with %1 Bis %0 mit %1 - - + + %0 km %0 km - - + + Charging speed Ladegeschwindigkeit - - + + %0 & %1 - - + + %0 Ampere %0 Ampere - - + + Automatic phase selection Automatische Phasenwahl - - + + 1-phase 1-phasig - - + + 3-phase 3-phasig - - + + Unknown phase selection (%0) Unbekannte Phasen Selektion (%0) @@ -499,8 +569,8 @@ Start - - + + Daily trip Daily trip @@ -787,6 +857,12 @@ Connected Verbunden + + + + Category + + CurrentLevelsPage