Add page to show go-e device integrations page

This commit is contained in:
2024-10-02 17:23:20 +02:00
parent 90133dd7e0
commit 20e3e9c7ab
9 changed files with 137 additions and 409 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "3rdparty/QtZeroConf"] [submodule "3rdparty/QtZeroConf"]
path = 3rdparty/QtZeroConf path = 3rdparty/QtZeroConf
url = ../../0xFEEDC0DE64/QtZeroConf.git url = ../../0xFEEDC0DE64/QtZeroConf.git
[submodule "3rdparty/qrcode-svg"]
path = 3rdparty/qrcode-svg
url = ../../papnkukn/qrcode-svg.git

1
3rdparty/qrcode-svg vendored Submodule

Submodule 3rdparty/qrcode-svg added at 47d56ec28f

View File

@ -72,6 +72,7 @@ qt_add_qml_module(evcharger-app
qml/ChargerTabPage.qml qml/ChargerTabPage.qml
qml/ChargingConfigurationPage.qml qml/ChargingConfigurationPage.qml
qml/ChargingSpeedPage.qml qml/ChargingSpeedPage.qml
qml/CloudApiQrCodePage.qml
qml/CloudPage.qml qml/CloudPage.qml
qml/CloudUrlsModel.qml qml/CloudUrlsModel.qml
qml/ConfirmingOnOffSwitch.qml qml/ConfirmingOnOffSwitch.qml
@ -116,6 +117,7 @@ qt_add_qml_module(evcharger-app
qml/OpenLinkButton.qml qml/OpenLinkButton.qml
qml/PasswordPage.qml qml/PasswordPage.qml
qml/PvSurplusPage.qml qml/PvSurplusPage.qml
qml/QrCode.qml
qml/RebootPage.qml qml/RebootPage.qml
qml/RequestStatusText.qml qml/RequestStatusText.qml
qml/SchedulerDayPage.qml qml/SchedulerDayPage.qml
@ -159,6 +161,7 @@ qt_add_qml_module(evcharger-app
qml/images/wattpilot.png qml/images/wattpilot.png
qml/images/phoenix.png qml/images/phoenix.png
qml/images/geminiFix.png qml/images/geminiFix.png
qml/js/qrcode.min.js
qml/material-icons/add.svg qml/material-icons/add.svg
qml/material-icons/grid_guides.svg qml/material-icons/grid_guides.svg
qml/material-icons/open_in_new.svg qml/material-icons/open_in_new.svg

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,17 @@ NavigationPage {
text: qsTr("API documentation") text: qsTr("API documentation")
url: qsTr("https://github.com/goecharger/go-eCharger-API-v2/blob/main/cloudapi-en.md") 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 {
}
}
}
} }
} }

View File

@ -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
}
}

48
qml/QrCode.qml Normal file
View File

@ -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()
}

1
qml/js/qrcode.min.js vendored Symbolic link
View File

@ -0,0 +1 @@
../../3rdparty/qrcode-svg/dist/qrcode.min.js

View File

@ -17,6 +17,7 @@ EVChargerApp 1.0 CenteredDialog.qml
EVChargerApp 1.0 ChargerTabPage.qml EVChargerApp 1.0 ChargerTabPage.qml
EVChargerApp 1.0 ChargingConfigurationPage.qml EVChargerApp 1.0 ChargingConfigurationPage.qml
EVChargerApp 1.0 ChargingSpeedPage.qml EVChargerApp 1.0 ChargingSpeedPage.qml
EVChargerApp 1.0 CloudApiQrCodePage.qml
EVChargerApp 1.0 CloudPage.qml EVChargerApp 1.0 CloudPage.qml
EVChargerApp 1.0 CloudUrlsModel.qml EVChargerApp 1.0 CloudUrlsModel.qml
EVChargerApp 1.0 ConfirmingOnOffSwitch.qml EVChargerApp 1.0 ConfirmingOnOffSwitch.qml
@ -61,6 +62,7 @@ EVChargerApp 1.0 OcppPage.qml
EVChargerApp 1.0 OpenLinkButton.qml EVChargerApp 1.0 OpenLinkButton.qml
EVChargerApp 1.0 PasswordPage.qml EVChargerApp 1.0 PasswordPage.qml
EVChargerApp 1.0 PvSurplusPage.qml EVChargerApp 1.0 PvSurplusPage.qml
EVChargerApp 1.0 QrCode.qml
EVChargerApp 1.0 RebootPage.qml EVChargerApp 1.0 RebootPage.qml
EVChargerApp 1.0 RequestStatusText.qml EVChargerApp 1.0 RequestStatusText.qml
EVChargerApp 1.0 SchedulerDayPage.qml EVChargerApp 1.0 SchedulerDayPage.qml