Lots of cleanups

This commit is contained in:
2024-07-17 19:47:36 +02:00
parent d387a34177
commit f6a2fef64b
28 changed files with 152 additions and 114 deletions

View File

@@ -11,7 +11,7 @@ Text {
ApiKeyValueHelper {
id: apiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
text: apiKeyValueHelper.value

View File

@@ -28,7 +28,7 @@ NavigationPage {
SendMessageHelper {
id: apiToken
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
Button {
@@ -61,7 +61,7 @@ NavigationPage {
ApiKeyValueHelper {
id: tokenSetup
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "hatv"
}
@@ -69,7 +69,7 @@ NavigationPage {
SendMessageHelper {
id: abortFirmwareUpdate
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
Button {
@@ -105,7 +105,7 @@ NavigationPage {
ApiKeyValueHelper {
id: cloudApiKey
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "cak"
}
@@ -136,7 +136,7 @@ NavigationPage {
ApiKeyValueHelper {
id: gridApiKey
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "gmk"
}

View File

@@ -62,6 +62,8 @@ qt_add_qml_module(evcharger-app
BaseNavigationPage.qml
CablePage.qml
CarPage.qml
CenteredDialog.qml
ChangeNumberItem.qml
ChargerTabPage.qml
ChargingConfigurationPage.qml
ChargingSpeedPage.qml
@@ -120,6 +122,9 @@ qt_add_qml_module(evcharger-app
TimePicker.qml
VerticalTabButton.qml
WhiteBox.qml
WhiteCheckDelegate.qml
WhiteItemDelegate.qml
WhiteSwipeDelegate.qml
WiFiErrorsPage.qml
WiFiOnOffSwitch.qml
WiFiPage.qml

7
CenteredDialog.qml Normal file
View File

@@ -0,0 +1,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Dialog {
anchors.centerIn: parent
}

45
ChangeNumberItem.qml Normal file
View File

@@ -0,0 +1,45 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
WhiteItemDelegate {
property alias descriptionText: descriptionText.text
property alias valueText: valueText.text
Layout.fillWidth: true
contentItem: RowLayout {
Text {
id: descriptionText
wrapMode: Text.Wrap
Layout.fillWidth: true
font.bold: true
}
Text {
id: valueText
}
Text {
text: ">"
}
}
onClicked: dialog.open()
CenteredDialog {
id: dialog
title: qsTr("Password required")
standardButtons: Dialog.Ok | Dialog.Cancel
focus: true
modal: true
contentItem: SpinBox {
}
// onAccepted: theDeviceConnection.sendAuth(passwordInput.text)
// onRejected: loader.close()
}
}

View File

@@ -36,7 +36,7 @@ AnimatedStackView {
ApiKeyValueHelper {
id: friendlyName
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "fna"
}
@@ -117,13 +117,13 @@ AnimatedStackView {
ApiKeyValueHelper {
id: devicetype
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "typ"
}
ApiKeyValueHelper {
id: isgo
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "isgo"
}
@@ -159,7 +159,7 @@ AnimatedStackView {
ApiKeyValueHelper {
id: logicMode
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "lmo"
}

View File

@@ -6,14 +6,12 @@ import EVChargerApp
ColumnLayout {
signal connected
required property DeviceConnection deviceConnection
function backPressed() {
return false
}
Connections {
target: deviceConnection
target: theDeviceConnection
function onFullStatusReceived() {
connected()
}

View File

@@ -26,7 +26,7 @@ Page {
ApiKeyValueHelper {
id: friendlyName
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "fna"
}

View File

@@ -72,7 +72,7 @@ BaseNavigationPage {
}
}
delegate: SwipeDelegate {
delegate: WhiteSwipeDelegate {
id: delegate
checkable: true
width: ListView.view.width - 30
@@ -89,11 +89,6 @@ BaseNavigationPage {
required property string hostName
required property string ip
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
swipe.enabled: saved
swipe.right: Label {

View File

@@ -48,8 +48,6 @@ Loader {
sourceComponent: Component {
ConnectingScreen {
deviceConnection: theDeviceConnection
anchors.fill: parent
onConnected: loader.sourceComponent = mainScreen;
@@ -60,17 +58,13 @@ Loader {
id: mainScreen
MainScreen {
deviceConnection: theDeviceConnection
onCloseRequested: loader.closeRequested()
}
}
Dialog {
CenteredDialog {
id: passwordDialog
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
title: qsTr("Password required")
standardButtons: Dialog.Ok | Dialog.Cancel
focus: true
@@ -111,12 +105,9 @@ Loader {
}
}
Dialog {
CenteredDialog {
id: authImpossibleDialog
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
title: qsTr("Authentication impossible!")
standardButtons: Dialog.Ok | Dialog.Cancel
focus: true

View File

@@ -33,7 +33,7 @@ NavigationPage {
ApiKeyValueHelper {
id: runningVersionDetails
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "apd"
}
@@ -70,7 +70,7 @@ NavigationPage {
ApiKeyValueHelper {
id: availableUrls
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocu"
}
@@ -88,7 +88,7 @@ NavigationPage {
SendMessageHelper {
id: startFirmwareUpdate
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
Button {
@@ -114,7 +114,7 @@ NavigationPage {
SendMessageHelper {
id: abortFirmwareUpdate
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
Button {
@@ -139,7 +139,7 @@ NavigationPage {
SendMessageHelper {
id: switchAppPartition
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
Button {
@@ -173,7 +173,7 @@ NavigationPage {
ApiKeyValueHelper {
id: updateStatus
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocs"
}
@@ -202,13 +202,13 @@ NavigationPage {
ApiKeyValueHelper {
id: updateProgress
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocp"
}
ApiKeyValueHelper {
id: updateLength
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocl"
}

View File

@@ -3,7 +3,7 @@ import QtQuick.Controls
import QtQuick.Layouts
import EVChargerApp
CheckDelegate {
WhiteCheckDelegate {
id: checkDelegate
required property string apiKey
@@ -12,20 +12,18 @@ CheckDelegate {
Layout.fillWidth: true
Component.onCompleted: {
background.color = "white"
background.radius = 5
contentItem.children[0].wrapMode = Text.Wrap
}
ApiKeyValueHelper {
id: valueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: checkDelegate.apiKey
}
SendMessageHelper {
id: valueChanger
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
onResponseChanged: checkDelegate.checked = Qt.binding(function(){ return valueHelper.value; })
}

View File

@@ -8,8 +8,6 @@ ColumnLayout {
signal closeRequested
required property DeviceConnection deviceConnection
function backPressed() {
if (stackLayout.currentItem.item.backPressed())
return true
@@ -23,7 +21,7 @@ ColumnLayout {
ApiKeyValueHelper {
id: rebootTime
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "rbt"
}
@@ -59,13 +57,13 @@ ColumnLayout {
ApiKeyValueHelper {
id: carApiKeyHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "car"
}
ApiKeyValueHelper {
id: controllerApiKeyHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ccp"
}

View File

@@ -42,7 +42,7 @@ NavigationPage {
ApiKeyValueHelper {
id: connectedSince
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "mcca"
}
@@ -76,7 +76,7 @@ NavigationPage {
ApiKeyValueHelper {
id: lastErrorAge
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "mlra"
}

View File

@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ItemDelegate {
WhiteItemDelegate {
id: navigationItem
property alias iconSource: icon.source
@@ -15,11 +15,6 @@ ItemDelegate {
implicitWidth: row.implicitWidth
implicitHeight: Math.max(row.implicitHeight, 50)
Component.onCompleted: {
background.radius = 5
background.color = "white"
}
onClicked: stackView.push(navigationItem.component)
RowLayout {

View File

@@ -42,7 +42,7 @@ NavigationPage {
ApiKeyValueHelper {
id: connectedSince
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocppca"
}
@@ -66,7 +66,7 @@ NavigationPage {
ApiKeyValueHelper {
id: acceptedSince
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocppaa"
}
@@ -91,7 +91,7 @@ NavigationPage {
ApiKeyValueHelper {
id: lastErrorAge
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocpplea"
}
@@ -106,7 +106,7 @@ NavigationPage {
ApiKeyValueHelper {
id: chargepointStatus
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocppcs"
}

View File

@@ -39,7 +39,6 @@ NavigationPage {
TimePickerDialog {
id: timePickerDialog
anchors.centerIn: parent
is24Hour: is24HourSwitch.checked
onTimeAccepted: print("A time was chosen - do something here!")

View File

@@ -11,7 +11,7 @@ WhiteBox {
SendMessageHelper {
id: valueChanger
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
onResponseChanged: {
ecoButton.checked = Qt.binding(() => ecoButton.selectedMode)
basicButton.checked = Qt.binding(() => basicButton.selectedMode)

View File

@@ -11,29 +11,9 @@ NavigationPage {
wrapMode: Text.Wrap
}
ItemDelegate {
Layout.fillWidth: true
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
contentItem: RowLayout {
Text {
text: qsTr("Price limit")
wrapMode: Text.Wrap
Layout.fillWidth: true
font.bold: true
}
Text {
text: qsTr("%0 ct/kWh").arg(0)
}
Text {
text: ">"
}
}
ChangeNumberItem {
descriptionText: qsTr("Price limit")
valueText: qsTr("%0 ct/kWh").arg(0)
}
Item {

View File

@@ -57,32 +57,32 @@ AnimatedStackView {
NavigationItem {
ApiKeyValueHelper {
id: wifiStaApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "wen"
}
ApiKeyValueHelper {
id: wifiApApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "wae"
}
ApiKeyValueHelper {
id: ethernetApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ee"
}
ApiKeyValueHelper {
id: cloudApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "cwe"
}
ApiKeyValueHelper {
id: ocppApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ocppe"
}
ApiKeyValueHelper {
id: mqttApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "mce"
}
@@ -102,17 +102,17 @@ AnimatedStackView {
NavigationItem {
ApiKeyValueHelper {
id: ledApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "lbr"
}
ApiKeyValueHelper {
id: controllerApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "ccd"
}
ApiKeyValueHelper {
id: displayApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "dro"
}

View File

@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ItemDelegate {
WhiteItemDelegate {
id: navigationItem
property color color
@@ -12,8 +12,6 @@ ItemDelegate {
Layout.fillWidth: true
Component.onCompleted: {
background.radius = 5
background.color = "white"
contentItem.children[0].color = navigationItem.color
}

View File

@@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls.Material
Dialog {
CenteredDialog {
id: root
standardButtons: Dialog.Ok | Dialog.Cancel
closePolicy: Dialog.NoAutoClose

10
WhiteCheckDelegate.qml Normal file
View File

@@ -0,0 +1,10 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
CheckDelegate {
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
}

10
WhiteItemDelegate.qml Normal file
View File

@@ -0,0 +1,10 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
ItemDelegate {
Component.onCompleted: {
background.radius = 5
background.color = "white"
}
}

10
WhiteSwipeDelegate.qml Normal file
View File

@@ -0,0 +1,10 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
SwipeDelegate {
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
}

View File

@@ -3,26 +3,24 @@ import QtQuick.Controls
import QtQuick.Layouts
import EVChargerApp
CheckDelegate {
WhiteCheckDelegate {
id: checkDelegate
Layout.fillWidth: true
Component.onCompleted: {
background.color = "white"
background.radius = 5
contentItem.children[0].wrapMode = Text.Wrap
}
ApiKeyValueHelper {
id: staEnabled
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "wen"
}
SendMessageHelper {
id: staEnabledChanger
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
}
checked: staEnabled.value
@@ -49,14 +47,10 @@ CheckDelegate {
request: staEnabledChanger
}
Dialog {
CenteredDialog {
id: disableStaDialog
x: window.width / 2 - width / 2
y: window.height / 2 - height / 2
width: Math.min(implicitWidth, window.width - 20)
title: qsTr("Do you really want to disable Wi-Fi?")
title: qsTr("Are you sure?")
standardButtons: Dialog.Ok | Dialog.Cancel
focus: true
modal: true
@@ -72,7 +66,7 @@ CheckDelegate {
onRejected: checkDelegate.checked = Qt.binding(function() { return staEnabled.value })
contentItem: Text {
text: qsTr("This action could make your device unreachable from your local homenetwork or the cloud!");
text: qsTr("Disabling Wi-Fi could make your device unreachable from your local homenetwork or the cloud!");
wrapMode: Text.Wrap
}
}

View File

@@ -22,7 +22,7 @@ NavigationPage {
ApiKeyValueHelper {
id: staStatus
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "wst"
}
@@ -49,7 +49,7 @@ NavigationPage {
Button {
ApiKeyValueHelper {
id: wifiScanResult
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "scan"
}
@@ -68,7 +68,7 @@ NavigationPage {
Button {
ApiKeyValueHelper {
id: wifiErrorLog
deviceConnection: mainScreen.deviceConnection
deviceConnection: theDeviceConnection
apiKey: "wsl"
}

5
qmldir
View File

@@ -12,6 +12,8 @@ EVChargerApp 1.0 AppSettingsPage.qml
EVChargerApp 1.0 BaseNavigationPage.qml
EVChargerApp 1.0 CablePage.qml
EVChargerApp 1.0 CarPage.qml
EVChargerApp 1.0 CenteredDialog.qml
EVChargerApp 1.0 ChangeNumberItem.qml
EVChargerApp 1.0 ChargerTabPage.qml
EVChargerApp 1.0 ChargingConfigurationPage.qml
EVChargerApp 1.0 ChargingSpeedPage.qml
@@ -70,6 +72,9 @@ EVChargerApp 1.0 TimePickerLabel.qml
EVChargerApp 1.0 TimePicker.qml
EVChargerApp 1.0 VerticalTabButton.qml
EVChargerApp 1.0 WhiteBox.qml
EVChargerApp 1.0 WhiteCheckDelegate.qml
EVChargerApp 1.0 WhiteItemDelegate.qml
EVChargerApp 1.0 WhiteSwipeDelegate.qml
EVChargerApp 1.0 WiFiErrorsPage.qml
EVChargerApp 1.0 WiFiOnOffSwitch.qml
EVChargerApp 1.0 WiFiPage.qml