From 20e3e9c7ab924965e70eac91df80e72edac59a08 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Wed, 2 Oct 2024 17:23:20 +0200 Subject: [PATCH] Add page to show go-e device integrations page --- .gitmodules | 3 + 3rdparty/qrcode-svg | 1 + CMakeLists.txt | 3 + i18n/qml_de.ts | 439 +++---------------------------------- qml/ApiSettingsPage.qml | 11 + qml/CloudApiQrCodePage.qml | 38 ++++ qml/QrCode.qml | 48 ++++ qml/js/qrcode.min.js | 1 + qml/qmldir | 2 + 9 files changed, 137 insertions(+), 409 deletions(-) create mode 160000 3rdparty/qrcode-svg create mode 100644 qml/CloudApiQrCodePage.qml create mode 100644 qml/QrCode.qml create mode 120000 qml/js/qrcode.min.js diff --git a/.gitmodules b/.gitmodules index 0aa54a5..5ca6d82 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "3rdparty/QtZeroConf"] path = 3rdparty/QtZeroConf url = ../../0xFEEDC0DE64/QtZeroConf.git +[submodule "3rdparty/qrcode-svg"] + path = 3rdparty/qrcode-svg + url = ../../papnkukn/qrcode-svg.git diff --git a/3rdparty/qrcode-svg b/3rdparty/qrcode-svg new file mode 160000 index 0000000..47d56ec --- /dev/null +++ b/3rdparty/qrcode-svg @@ -0,0 +1 @@ +Subproject commit 47d56ec28fcd0a3aabbb5f11a34167a02a80c54e diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bf43e3..ec3e813 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ qt_add_qml_module(evcharger-app qml/ChargerTabPage.qml qml/ChargingConfigurationPage.qml qml/ChargingSpeedPage.qml + qml/CloudApiQrCodePage.qml qml/CloudPage.qml qml/CloudUrlsModel.qml qml/ConfirmingOnOffSwitch.qml @@ -116,6 +117,7 @@ qt_add_qml_module(evcharger-app qml/OpenLinkButton.qml qml/PasswordPage.qml qml/PvSurplusPage.qml + qml/QrCode.qml qml/RebootPage.qml qml/RequestStatusText.qml qml/SchedulerDayPage.qml @@ -159,6 +161,7 @@ qt_add_qml_module(evcharger-app qml/images/wattpilot.png qml/images/phoenix.png qml/images/geminiFix.png + qml/js/qrcode.min.js qml/material-icons/add.svg qml/material-icons/grid_guides.svg qml/material-icons/open_in_new.svg diff --git a/i18n/qml_de.ts b/i18n/qml_de.ts index cd06fbe..2fa4705 100644 --- a/i18n/qml_de.ts +++ b/i18n/qml_de.ts @@ -5,25 +5,21 @@ AboutPage - About Über - Firmware Firmware - Hardware information Hardwareinformationen - Licenses Lizenzen @@ -32,7 +28,6 @@ AccessPage - Access Zugangskontrolle @@ -41,39 +36,32 @@ AddDeviceScreen - Setup or add device Gerät hinzufügen oder einrichten - Add via local connection or AP: Über lokale Verbindung oder AP einrichten: - Local url Lokale url - - Connect Verbinden - Add via cloud: Über Cloud einrichten: - Cloud Serial Cloud Seriennr. @@ -86,7 +74,6 @@ ApiSettingsPage - API Settings API Einstellungen @@ -100,87 +87,75 @@ - Allow access to local HTTP-Api v2 Zugriff auf die lokale HTTP-API v2 zulassen - - - - - - + + API documentation API-Dokumentation - https://github.com/goecharger/go-eCharger-API-v2/blob/main/http-en.md https://github.com/goecharger/go-eCharger-API-v2/blob/main/http-de.md - Generate token Token erzeugen - OK! token: %0 OK! token: %0 - Clear API token API-Token entfernen - Enable cloud API Cloud HTTP API aktivieren - - - + API key: %0 API key: %0 - https://github.com/goecharger/go-eCharger-API-v2/blob/main/cloudapi-en.md https://github.com/goecharger/go-eCharger-API-v2/blob/main/cloudapi-de.md - - + + 3rdparty integrations (QR-Code) + Dritthersteller-Integrationen (QR-Code) + + + Enable grid API Netzbetreiber-API aktiviert - - + https://github.com/goecharger/go-eCharger-API-v2/blob/main/gridapi-en.md https://github.com/goecharger/go-eCharger-API-v2/blob/main/gridapi-de.md - - + Allow access to legacy HTTP-Api v1 Zugriff auf lokale HTTP-API v1 zulassen - - + https://github.com/goecharger/go-eCharger-API-v1/blob/master/go-eCharger%20API%20v1%20EN.md https://github.com/goecharger/go-eCharger-API-v1/blob/master/go-eCharger%20API%20v1%20DE.md @@ -189,47 +164,38 @@ AppSettingsPage - App Settings App Einstellungen - Number of app instances: Anzahl an App Instanzen: - solalaweb key: solalaweb key: - - Select... Auswählen... - - Replace... Ersetzen... - solalaweb cert: solalaweb cert: - Show solalaweb: Zeige solalaweb: @@ -238,7 +204,6 @@ BaseNavigationPage - Back Zurück @@ -247,7 +212,6 @@ CablePage - Cable Kabel @@ -256,7 +220,6 @@ CarPage - Car Auto @@ -265,97 +228,81 @@ CellularPage - Cellular Mobilfunk - Are you sure? Sind Sie sicher? - Disabling Cellular could make your device unreachable from the cloud! Wenn die Mobilfunkverbindung ausgeschaltet wird, kann Ihr Gerät unerreichbar werden, wenn die App über Mobilfunk verbunden ist! - APN APN - PIN PIN - Username Benutzername - Password Passwort - Show technical details of LTE modem Technische Informationen des LTE Modems anzeigen - Initialization status: Initialisierungsstatus: - IMEI: IMEI: - IMSI: IMSI: - Pin status: Pin Status: - Operator name: Netzbetreibername: - Signal quality: Signalstärke: - Current system mode: Aktuelle Verbindungsart: - IP Address: IP Adresse: @@ -368,109 +315,91 @@ - Internal error Interner Fehler - No car connected Kein Auto angeschlossen - Car is charging Auto wird geladen - Connecting to your car... Verbinde mit Auto... - Charging completed Ladevorgang abgeschlossen - Unknown error %0 Unbekannter Fehler %0 - Plug in the cable to start charging your car Stecke das Kabel ein, um dein Auto aufzuladen - Duration: %0 Dauer: %0 - Speed: %0 Geschwindigkeit: %0 - Amount: %0 Menge: %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 existiert nicht) - (api key is null) (api key is null) - (api key is not an object) (api key ist kein Objekt) - (api key does not contain a type) (api key beinhaltet keinen Typ) - (api key has unknown type %0) (api key hat unbekannten Typ %0) - %0 %1 %2 %0 %1 %2 @@ -478,81 +407,66 @@ - - - %0 A %0 A - %0 kWh %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 & %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) @@ -570,7 +484,6 @@ - Daily trip Daily trip @@ -579,61 +492,51 @@ ChargingConfigurationPage - Charging configuration Konfiguration des Ladevorgangs - Charging Speed Ladegeschwindigkeit - kWh Limit kWh Limit - Daily Trip Daily Trip - Flexible energy tariff Flexibler Energietarif - PV Surplus PV-Überschuss - Load Balancing Lastmanagement - Scheduler Ladetimer - Current Levels Strompegel - Car Auto @@ -642,70 +545,77 @@ ChargingSpeedPage - Charging Speed Ladegeschwindigkeit + + CloudApiQrCodePage + + + 3rdparty integrations + Dritthersteller-Integrationen + + + + https://device.go-e.io/%0?t=%1 + + + + + Open integrations page + Integrationsseite öffnen + + CloudPage - Cloud Cloud - Enable cloud connection Cloud Verbindung aktivieren - Are you sure? Sind Sie sicher? - Disabling could connection could make your device unreachable from other places than home! Wenn die Cloud-Verbindung ausgeschaltet wird, kann Ihr Gerät unerreichbar werden, wenn Sie sich nicht zuhause im Heimnetzwerk befinden! - Features like flexible energy tariffs, time sync and app connection are unavilable when "Enable cloud connection" is disabled Wenn "Cloud Verbindung aktivieren" deaktiviert ist, sind Funktionen wie flexible Energietarife, Zeitsynchronisierung und App-Verbindung über das Internet nicht möglich - Trying to connect: Versuche zu verbinden: - Is connected: Ist verbunden: - Hello received: Hallo empfangen: - Queue size cloud: Cloud Warteschlagengröße: - Last error: Letzer Fehler: @@ -714,31 +624,26 @@ CloudUrlsModel - V2 V2 - Wattpilot Wattpilot - go-eCharger go-eCharger - go-eController go-eController - Solalaweb Solalaweb @@ -747,19 +652,16 @@ ConfirmingOnOffSwitch - On An - Off Aus - Unknown Unbekannt @@ -768,13 +670,11 @@ ConnectingScreen - Trying to reach device... Versuche Gerät zu erreichen... - Cancel Abbrechen @@ -783,55 +683,46 @@ ConnectionPage - Connection Verbindung - Wi-Fi WLAN - Cellular Mobilfunk - Hotspot Hotspot - Ethernet Ethernet - OCPP OCPP - Cloud Cloud - MQTT MQTT - API Settings API Einstellungen @@ -840,7 +731,6 @@ ControllerPage - Controller Controller @@ -853,13 +743,11 @@ - Connected Verbunden - %0W %0W @@ -872,7 +760,6 @@ CurrentLevelsPage - Current Levels Strompegel @@ -881,7 +768,6 @@ DailyTripPage - Daily Trip Daily Trip @@ -890,7 +776,6 @@ DateAndTimePage - Date and time Datum und Uhrzeit @@ -1112,7 +997,6 @@ DeviceHeaderBar - Devices Geräte @@ -1137,61 +1021,51 @@ - Device list Geräteliste - App Settings App Einstellungen - My devices Meine Geräte - Found devices Im Netzwerk verfügbare Geräte - Delete Löschen - Serial Number %0 Seriennummer %0 - Local Lokal - Cloud Cloud - Solala Solala - Add or setup device Gerät hinzufügen oder einrichten @@ -1213,13 +1087,11 @@ - Manufacturer: Hersteller: - Device Type: Gerätetyp: @@ -1229,13 +1101,11 @@ - Host Name: Host Name: - Ip: Ip: @@ -1256,37 +1126,31 @@ DeviceScreen - Password required Passwort erforderlich - Password: Passwort: - Password Passwort - Authentication impossible! Authentifizierung unmöglich! - To use this password remotely a password has to be setup first. This can be done over the AccessPoint. Um dieses Gerät aus der Ferne nutzen zu können, müssen Sie erst ein Passwort einrichten. Dies kann über den AccessPoint gemacht werden. - Connection disturbed Verbindung schwer gestört @@ -1304,7 +1168,6 @@ DisplaySettingsPage - Display settings Display @@ -1313,7 +1176,6 @@ EVChargerApp - EVcharger App EVcharger App @@ -1322,45 +1184,37 @@ EcoTabPage - Eco Eco - - Flexible energy tariff Flexibler Energietarif - PV Surplus PV-Überschuss - About eco Über Eco - We offer to charge your car during periods of low electricity price, If you have an electricity contract based on flexible energy tariffs. Du kannst dein Auto in Zeiten niedriger Strompreise aufladen, sofern du einen Stromvertrag mit flexiblen Tarifen hast. - PV surplus energy PV-Überschuss - By connecting a PV system and a controller to your charger, you can charge your EV particularly cheaply and use clean energy at the same time. Wenn du eine PV-Anlage und einen Controller an deinen Charger anschließt, kannst du dein Elektroauto besonders günstig aufladen und gleichzeitig grüne Energie nutzen. @@ -1369,7 +1223,6 @@ EthernetPage - Ethernet Ethernet @@ -1378,67 +1231,56 @@ FirmwarePage - Firmware Firmware - Update: Update: - Start Start - Abort Abbrechen - Switch partition Partition tauschen - Update status: Update status: - Update progress: Update Fortschritt: - Update message: Update Meldung: - Recommended version: Empfohlene Version: - Running version: Ausgeführte Version: - Details: Details: @@ -1447,27 +1289,22 @@ FlexibleEnergyTariffPage - Flexible energy tariff Flexibler Energietarif - - Charge with flexible energy tariff Laden mit flexiblen Stromtarif - Price limit Preisgrenze - %0 ct/kWh %0 ct/kWh @@ -1483,19 +1320,16 @@ GeneralOnOffSwitch - On An - Off Aus - Unknown Unbekannt @@ -1504,55 +1338,46 @@ GeneralPage - General Allgemein - Name Name - Switch Language Sprache ändern - Notifications Benachrichtigungen - Date and time Datum und Uhrzeit - LED LED - Controller Controller - Display settings Display - Reboot Neustart @@ -1561,7 +1386,6 @@ GridPage - Grid Netz @@ -1570,7 +1394,6 @@ GroundCheckPage - Ground check Erdungsprüfung @@ -1579,25 +1402,21 @@ HardwareInformationPage - Hardware information Hardwareinformationen - Serial Number: Seriennummer: - Variant: Variante: - RSSI: RSSI: @@ -1606,31 +1425,26 @@ HotspotPage - Hotspot Hotspot - Disable AP when online AP ausschalten wenn online - SSID SSID - Password Passwort - Channel Kanal @@ -1639,13 +1453,11 @@ InformationsTabPage - Informations Informationen - Download informations Informationen herunterladen @@ -1654,7 +1466,6 @@ KwhLimitPage - kWh Limit kWh Limit @@ -1663,7 +1474,6 @@ LedPage - LED LED @@ -1672,7 +1482,6 @@ LicensesPage - Licenses Lizenzen @@ -1681,7 +1490,6 @@ LoadBalancingPage - Load Balancing Lastmanagement @@ -1690,37 +1498,29 @@ MainScreen - %0 ago vor %0 - in %0 in %0 - - Charger Charger - - Eco Eco - - Controller Controller @@ -1729,10 +1529,6 @@ - - - - Infromations Informationen @@ -1741,10 +1537,6 @@ - - - - Settings Einstellungen @@ -1753,103 +1545,86 @@ MqttPage - MQTT MQTT - Broker url Broker url - API documentation API-Dokumentation - https://github.com/goecharger/go-eCharger-API-v2/blob/main/mqtt-en.md https://github.com/goecharger/go-eCharger-API-v2/blob/main/mqtt-de.md - Trying to connect: Versuche zu verbinden: - Is connected: Ist verbunden: - Connected since: Verbunden seit: - Command Counter: Befehlszähler: - Last error: Letzer Fehler: - Last error age: Alter des letzten Fehlers: - Use global CA store Verwende den global CA Store - Skip cert commonName check commonName Überprüfung überspringen - Skip server cert verification Server Zertifikat Überprüfung überspringen - MQTT readonly MQTT nur-lesend - Topic prefix Topic prefix - Homeassistant autodiscover Homeassistant autodiscover - Homeassistant topic prefix Homeassistant topic prefix @@ -1859,8 +1634,6 @@ - - Name Name @@ -1876,7 +1649,6 @@ NotificationsPage - Notifications Benachrichtigungen @@ -1885,205 +1657,171 @@ OcppPage - OCPP OCPP - Backend url Backend url - API documentation API-Dokumentation - https://github.com/goecharger/go-eCharger-API-v2/blob/main/ocpp-en.md https://github.com/goecharger/go-eCharger-API-v2/blob/main/ocpp-de.md - Trying to connect: Versuche zu verbinden: - Is connected: Ist verbunden: - Connected since: Verbunden seit: - Is accepted: Ist akzeptiert: - Accepted since: Akzeptiert seit: - Last error: Letzer Fehler: - Last error age: Alter des letzten Fehlers: - Chargepoint status: Chargepoint Status: - Available - Preparing - Charging - SuspendedEVSE - SuspendedEV - Finishing - Reserved - Unavailable - Faulted - Use global CA store Verwende den global CA Store - Skip cert commonName check commonName Überprüfung überspringen - Skip server cert verification Server Zertifikat Überprüfung überspringen - Heartbeat interval: Heartbeat Intervall: - MeterValues sample interval: MeterValues Sample Intervall: - Clock aligned data interval: Clock Aligned Data Intervall: - Dummy card id Dummy Karten-ID - Rotate phases on charger Phasen am Charger rotieren - Allow Offline Tx For UnknownId - Local Authorize Offline - Local Auth List Enabled - Accept time from backend - Set as inoperable Als Unverfügbar setzen @@ -2092,7 +1830,6 @@ PasswordPage - Password Passwort @@ -2101,13 +1838,11 @@ PvSurplusPage - PV Surplus PV-Überschuss - Charging with PV surplus Laden mit PV-Überschuss @@ -2116,7 +1851,6 @@ RebootPage - Reboot Neustart @@ -2132,13 +1866,11 @@ SchedulerDayPage - Scheduler day Ladetimer Tag - 24 Hour 24 Stunden @@ -2147,79 +1879,66 @@ SchedulerPage - Scheduler Ladetimer - About Schedule Über den Ladetimer - Customize your charging routine on workdays, Saturdays, and Sundays. Define specific time slots for charging or blocking to perfectly align with your weekly schedule. Schedule can only start charging if all other functions like eco or access settings allow charging. Passe deine Laderoutine an Werktagen, Samstagen und Sonntagen an. Lege bestimmte Zeitfenster für das Aufladen oder Blockieren fest, um deinen Wochenplan perfekt abzustimmen. Der Ladevorgang kann nur gestartet werden, wenn alle anderen Funktionen wie Eco Modus oder Zugangskontrolle das Laden zulassen. - Charging schedule Laden erlauben - go-e Charger will exclusively charge your car during the time slots you set, and won't charge for the rest of the time. go-e Charger wird das Fahrzeug ausschließlich in den von dir eingestellten Zeitfenstern aufladen und in der restlichen Zeit nicht laden. - Blocking schedule Laden blockieren - go-e Charger will block charging your car during the time slots you set, but it will charge your car for the rest of the time. go-e Charger wird das Aufladen deines Fahrzeugs während des von dir eingestellten Zeitfensters verhindern. In der restlichen Zeit kann dein Auto geladen werden. - Workdays Wochentags - Create workdays schedule Wochentags-Ladetimer erstellen - Saturdays Samstags - Create saturdays schedule Samstags-Ladetimer erstellen - Sundays Sonntags - Create sundays schedule Sonntags-Ladetimer erstellen @@ -2248,37 +1967,31 @@ SecurityPage - Security Sicherheit - Cable Kabel - Access Zugangskontrolle - Password Passwort - Grid Netz - Ground check Erdungsprüfung @@ -2287,37 +2000,31 @@ SelectLogicModeItem - Eco Eco - Eco-friendly & cost effective Nachhaltig & Wirtschaftlich - Basic Basic - Basic charging Einfaches Laden - Daily trip Daily trip - Specific energy and time Energie zur bestimmten Zeit @@ -2326,25 +2033,21 @@ SelectPhaseSwitchModeItem - Phase switching Phasen wechseln - Automatic Automatisch - 1-Phase 1-phasig - 3-Phase 3-phasig @@ -2361,7 +2064,6 @@ SensorsConfigurationPage - Sensors Configuration Sensorkonfiguration @@ -2370,25 +2072,21 @@ SetPriceLimitPage - Set price limit Preisgrenze festlegen - Set a proper price limit for charging, so charging starts when the electricity price is below this limit. Also, you can see the charging forecast chart below based on the limit that you define. Lege eine angemessene Preisgrenze für das Laden fest, sodass das Laden beginnt, wenn der Strompreis unter dieser Grenze liegt. Außerdem siehst du unten ein Diagramm mit der Ladeprognose, die auf dem von dir festgelegten Grenzwert basiert. - Price limit Preisgrenze - %0 ct/kWh %0 ct/kWh @@ -2397,193 +2095,161 @@ SettingsTabPage - Settings Einstellungen - Charging configuration Konfiguration des Ladevorgangs - Charging Speed Ladegeschwindigkeit - kWh Limit kWh Limit - Daily Trip Daily Trip - Flexible energy tariff Flexibler Energietarif - PV Surplus PV-Überschuss - Cable Kabel - Access Zugangskontrolle - Password Passwort - Grid Netz - Ground check Erdungsprüfung - Sensors Sensoren - Categories Kategorien - Wi-Fi WLAN - Cellular Mobilfunk - Hotspot Hotspot - Ethernet Ethernet - OCPP OCPP - Cloud Cloud - MQTT MQTT - API Settings API Einstellungen - Name Name - Switch Language Sprache ändern - Notifications Benachrichtigungen - Date and time Datum und Uhrzeit - LED LED - Controller Controller - Display settings Display - Firmware Firmware - Hardware information Hardwareinformationen - Licenses Lizenzen @@ -2593,7 +2259,6 @@ - Security Sicherheit @@ -2603,7 +2268,6 @@ - Sensors Configuration Sensorkonfiguration @@ -2613,7 +2277,6 @@ - Connection Verbindung @@ -2623,7 +2286,6 @@ - General Allgemein @@ -2633,7 +2295,6 @@ - About Über @@ -2646,13 +2307,11 @@ StartStopButton - Stop Stop - Start Start @@ -2661,7 +2320,6 @@ SwitchLanguagePage - Switch Language Sprache ändern @@ -2670,13 +2328,11 @@ TimePickerLabel - AM AM - PM PM @@ -2685,31 +2341,26 @@ WiFiErrorsPage - Wi-Fi Errors WLAN Probleme - Timestamp: Zeitpunkt: - SSID: SSID: - BSSID: BSSID: - Reason: Grund: @@ -2737,55 +2388,46 @@ WiFiPage - Wi-Fi WLAN - Are you sure? Sind Sie sicher? - Disabling Wi-Fi could make your device unreachable from your local homenetwork or the cloud! Wenn die WLAN-Verbindung ausgeschaltet wird, kann Ihr Gerät im Heimnetzwerk und über die Cloud unerreichbar werden! - Status: Status: - (%0) Wi-Fi Scan (%0) Wi-Fi Scan - (%0) Wi-Fi Errors (%0) WLAN Probleme - Min RSSI Min RSSI - Pmf capable Pmf fähig - Pmf required Pmf erforderlich @@ -2794,127 +2436,106 @@ WiFiScanPage - Wi-Fi Scan Result WLAN Scan Result - SSID: SSID: - Authmode: Authentifizierungsart: - OPEN - WEP - WPA_PSK - WPA2_PSK - WPA_WPA2_PSK - WPA2_ENTERPRISE - WPA3_PSK - WPA2_WPA3_PSK - WAPI_PSK - OWE - WPA3_ENT_192 - WPA3_EXT_PSK - WPA3_EXT_PSK_MIXED_MODE - Pairwise cipher: Paarweise Cipher: - Group cipher: Gruppen Cipher: - RSSI: RSSI: - Channel: Kanal: - BSSID: BSSID: diff --git a/qml/ApiSettingsPage.qml b/qml/ApiSettingsPage.qml index e86d70b..2bca656 100644 --- a/qml/ApiSettingsPage.qml +++ b/qml/ApiSettingsPage.qml @@ -119,6 +119,17 @@ NavigationPage { text: qsTr("API documentation") url: qsTr("https://github.com/goecharger/go-eCharger-API-v2/blob/main/cloudapi-en.md") } + + Button { + text: qsTr("3rdparty integrations (QR-Code)") + onClicked: stackView.push(cloudApiQrCodePage) + + Component { + id: cloudApiQrCodePage + CloudApiQrCodePage { + } + } + } } } diff --git a/qml/CloudApiQrCodePage.qml b/qml/CloudApiQrCodePage.qml new file mode 100644 index 0000000..29302ca --- /dev/null +++ b/qml/CloudApiQrCodePage.qml @@ -0,0 +1,38 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import EVChargerApp + +NavigationPage { + title: qsTr("3rdparty integrations") + + ApiKeyValueHelper { + id: serial + deviceConnection: theDeviceConnection + apiKey: "sse" + } + + ApiKeyValueHelper { + id: cloudApiKey + deviceConnection: theDeviceConnection + apiKey: "cak" + } + + property string integrationUrl: qsTr("https://device.go-e.io/%0?t=%1").arg(serial.value).arg(cloudApiKey.value) + + QrCode { + Layout.fillWidth: true + fillMode: Image.PreserveAspectFit + anchors.leftMargin: 50 + anchors.rightMargin: 50 + + visible: (typeof serial.value === 'string' || serial.value instanceof String) && serial.value != "" && + (typeof cloudApiKey.value === 'string' || cloudApiKey.value instanceof String) && cloudApiKey.value != "" + content: integrationUrl + } + + OpenLinkButton { + text: qsTr("Open integrations page") + url: integrationUrl + } +} diff --git a/qml/QrCode.qml b/qml/QrCode.qml new file mode 100644 index 0000000..eca1ed3 --- /dev/null +++ b/qml/QrCode.qml @@ -0,0 +1,48 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import EVChargerApp + +import "js/qrcode.min.js" as QrSvg + +Image { + required property string content + //property int padding: 4 + //property int width: 256 + //property int height: 256 + //property string color: "black" + //property string background: "white" + //property string ecl: "M" + //property bool join: false + //property bool predefined: false + //property bool pretty: true + //property bool swap: false + //property bool xmlDeclaration: true + //property string container: "svg" + + function createSvgString() { + const svg = new QrSvg.QRCode({ + content: content, + //padding: root.padding, + //width: root.width, + //height: root.height, + //color: root.color, + //background: root.background, + //ecl: root.ecl, + //join: root.join, + //predefined: root.predefined, + //pretty: root.pretty, + //swap: root.swap, + //xmlDeclaration: root.xmlDeclaration, + //container: root.container + }).svg() + + if (svg === "") + source = "" + else + source = "data:image/svg+xml;utf8," + svg; + } + + onContentChanged: createSvgString() + Component.onCompleted: createSvgString() +} diff --git a/qml/js/qrcode.min.js b/qml/js/qrcode.min.js new file mode 120000 index 0000000..e1ac4a9 --- /dev/null +++ b/qml/js/qrcode.min.js @@ -0,0 +1 @@ +../../3rdparty/qrcode-svg/dist/qrcode.min.js \ No newline at end of file diff --git a/qml/qmldir b/qml/qmldir index 8355f42..122421b 100644 --- a/qml/qmldir +++ b/qml/qmldir @@ -17,6 +17,7 @@ EVChargerApp 1.0 CenteredDialog.qml EVChargerApp 1.0 ChargerTabPage.qml EVChargerApp 1.0 ChargingConfigurationPage.qml EVChargerApp 1.0 ChargingSpeedPage.qml +EVChargerApp 1.0 CloudApiQrCodePage.qml EVChargerApp 1.0 CloudPage.qml EVChargerApp 1.0 CloudUrlsModel.qml EVChargerApp 1.0 ConfirmingOnOffSwitch.qml @@ -61,6 +62,7 @@ EVChargerApp 1.0 OcppPage.qml EVChargerApp 1.0 OpenLinkButton.qml EVChargerApp 1.0 PasswordPage.qml EVChargerApp 1.0 PvSurplusPage.qml +EVChargerApp 1.0 QrCode.qml EVChargerApp 1.0 RebootPage.qml EVChargerApp 1.0 RequestStatusText.qml EVChargerApp 1.0 SchedulerDayPage.qml