diff --git a/CMakeLists.txt b/CMakeLists.txt index 29f7640..5a69d04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,7 @@ qt_add_qml_module(evcharger-app LoadBalancingPage.qml LogicModeButton.qml MainScreen.qml + MqttPage.qml NamePage.qml NavigationItem.qml NavigationPage.qml diff --git a/ConnectingScreen.qml b/ConnectingScreen.qml index 6f4b274..c634324 100644 --- a/ConnectingScreen.qml +++ b/ConnectingScreen.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts +import EVChargerApp ColumnLayout { signal connected diff --git a/ConnectionPage.qml b/ConnectionPage.qml index 75470c9..857944c 100644 --- a/ConnectionPage.qml +++ b/ConnectionPage.qml @@ -27,6 +27,13 @@ NavigationPage { visible: ethernetApiKeyValueHelper.exists } + NavigationItem { + iconSource: "material-icons/grid_guides.svg" + title: qsTr("Cloud") + component: "CloudPage.qml" + visible: cloudApiKeyValueHelper.exists + } + NavigationItem { iconSource: "material-icons/grid_guides.svg" title: qsTr("OCPP") @@ -36,9 +43,9 @@ NavigationPage { NavigationItem { iconSource: "material-icons/grid_guides.svg" - title: qsTr("Cloud") - component: "CloudPage.qml" - visible: cloudApiKeyValueHelper.exists + title: qsTr("MQTT") + component: "MqttPage.qml" + visible: mqttApiKeyValueHelper.exists } NavigationItem { diff --git a/EVChargerApp.qml b/EVChargerApp.qml index 0a59101..e2a659d 100644 --- a/EVChargerApp.qml +++ b/EVChargerApp.qml @@ -40,6 +40,8 @@ ApplicationWindow { PageIndicator { id: indicator + visible: view.count > 1 + count: view.count currentIndex: view.currentIndex diff --git a/MqttPage.qml b/MqttPage.qml new file mode 100644 index 0000000..c9fcb31 --- /dev/null +++ b/MqttPage.qml @@ -0,0 +1,88 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import EVChargerApp + +NavigationPage { + title: qsTr("MQTT") + + GeneralOnOffSwitch { + apiKey: "mce" + } + + WhiteBox { + Layout.fillWidth: true + + GridLayout { + anchors.fill: parent + columns: 2 + + Label { + text: qsTr("Trying to connect:") + font.bold: true + } + + ApiKeyValueItem { + apiKey: "mcs" + } + + Label { + text: qsTr("Is connected:") + font.bold: true + } + + ApiKeyValueItem { + apiKey: "mcc" + } + + Label { + text: qsTr("Connected since:") + font.bold: true + } + + ApiKeyValueHelper { + id: connectedSince + deviceConnection: mainScreen.deviceConnection + apiKey: "mcca" + } + + Text { + text: connectedSince.value ? formatDuration(connectedSince.value - rebootTime.value) : "" + } + + Label { + text: qsTr("Command Counter:") + font.bold: true + } + + ApiKeyValueItem { + apiKey: "mcsl" + } + + Label { + text: qsTr("Last error:") + font.bold: true + } + + ApiKeyValueItem { + apiKey: "mlr" + wrapMode: Text.Wrap + } + + Label { + text: qsTr("Last error age:") + font.bold: true + } + + ApiKeyValueHelper { + id: lastErrorAge + deviceConnection: mainScreen.deviceConnection + apiKey: "mlra" + } + + Text { + text: lastErrorAge.value ? formatDuration(lastErrorAge.value - rebootTime.value) : "" + } + } + } +} diff --git a/SettingsTabPage.qml b/SettingsTabPage.qml index a1d675e..047094d 100644 --- a/SettingsTabPage.qml +++ b/SettingsTabPage.qml @@ -70,15 +70,20 @@ StackView { deviceConnection: mainScreen.deviceConnection apiKey: "ee" } + ApiKeyValueHelper { + id: cloudApiKeyValueHelper + deviceConnection: mainScreen.deviceConnection + apiKey: "cwe" + } ApiKeyValueHelper { id: ocppApiKeyValueHelper deviceConnection: mainScreen.deviceConnection apiKey: "ocppe" } ApiKeyValueHelper { - id: cloudApiKeyValueHelper + id: mqttApiKeyValueHelper deviceConnection: mainScreen.deviceConnection - apiKey: "cwe" + apiKey: "mce" } iconSource: "material-icons/grid_guides.svg" @@ -87,8 +92,9 @@ StackView { wifiStaApiKeyValueHelper.exists ? qsTr("Wi-Fi") : null, wifiApApiKeyValueHelper.exists ? qsTr("Hotspot") : null, ethernetApiKeyValueHelper.exists ? qsTr("Ethernet") : null, - ocppApiKeyValueHelper.exists ? qsTr("OCPP") : null, cloudApiKeyValueHelper.exists ? qsTr("Cloud") : null, + ocppApiKeyValueHelper.exists ? qsTr("OCPP") : null, + mqttApiKeyValueHelper.exists ? qsTr("MQTT") : null, qsTr("API Settings") ].filter(Boolean).join(" • ") component: "ConnectionPage.qml" diff --git a/i18n/qml_de.ts b/i18n/qml_de.ts index 974ae92..8459d94 100644 --- a/i18n/qml_de.ts +++ b/i18n/qml_de.ts @@ -505,14 +505,14 @@ ConnectingScreen - - + + Trying to reach device... Versuche Gerät zu erreichen... - - + + Cancel Abbrechen diff --git a/qmldir b/qmldir index 5678c36..782a4e0 100644 --- a/qmldir +++ b/qmldir @@ -43,6 +43,7 @@ EVChargerApp 1.0 LicensesPage.qml EVChargerApp 1.0 LoadBalancingPage.qml EVChargerApp 1.0 LogicModeButton.qml EVChargerApp 1.0 MainScreen.qml +EVChargerApp 1.0 MqttPage.qml EVChargerApp 1.0 NamePage.qml EVChargerApp 1.0 NavigationItem.qml EVChargerApp 1.0 NavigationPage.qml