diff --git a/ApiKeyValueItem.qml b/ApiKeyValueItem.qml index c91dc8e..645ae0c 100644 --- a/ApiKeyValueItem.qml +++ b/ApiKeyValueItem.qml @@ -11,7 +11,7 @@ Text { ApiKeyValueHelper { id: apiKeyValueHelper - deviceConnection: mainScreen.deviceConnection + deviceConnection: theDeviceConnection } text: apiKeyValueHelper.value diff --git a/ApiSettingsPage.qml b/ApiSettingsPage.qml index a81c77b..cbe8c44 100644 --- a/ApiSettingsPage.qml +++ b/ApiSettingsPage.qml @@ -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" } diff --git a/CMakeLists.txt b/CMakeLists.txt index ded8c5c..4b14adb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/CenteredDialog.qml b/CenteredDialog.qml new file mode 100644 index 0000000..feefa3c --- /dev/null +++ b/CenteredDialog.qml @@ -0,0 +1,7 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Dialog { + anchors.centerIn: parent +} diff --git a/ChangeNumberItem.qml b/ChangeNumberItem.qml new file mode 100644 index 0000000..d8b051b --- /dev/null +++ b/ChangeNumberItem.qml @@ -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() + } +} diff --git a/ChargerTabPage.qml b/ChargerTabPage.qml index f841c0c..d77d4b6 100644 --- a/ChargerTabPage.qml +++ b/ChargerTabPage.qml @@ -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" } diff --git a/ConnectingScreen.qml b/ConnectingScreen.qml index 47cb464..dcb6186 100644 --- a/ConnectingScreen.qml +++ b/ConnectingScreen.qml @@ -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() } diff --git a/ControllerTabPage.qml b/ControllerTabPage.qml index 26e3787..c79a333 100644 --- a/ControllerTabPage.qml +++ b/ControllerTabPage.qml @@ -26,7 +26,7 @@ Page { ApiKeyValueHelper { id: friendlyName - deviceConnection: mainScreen.deviceConnection + deviceConnection: theDeviceConnection apiKey: "fna" } diff --git a/DeviceListScreen.qml b/DeviceListScreen.qml index 01244b3..44e0be4 100644 --- a/DeviceListScreen.qml +++ b/DeviceListScreen.qml @@ -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 { diff --git a/DeviceScreen.qml b/DeviceScreen.qml index 370dec1..41fb744 100644 --- a/DeviceScreen.qml +++ b/DeviceScreen.qml @@ -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 diff --git a/FirmwarePage.qml b/FirmwarePage.qml index 60eb170..7a5245e 100644 --- a/FirmwarePage.qml +++ b/FirmwarePage.qml @@ -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" } diff --git a/GeneralOnOffSwitch.qml b/GeneralOnOffSwitch.qml index 7cbd418..0868515 100644 --- a/GeneralOnOffSwitch.qml +++ b/GeneralOnOffSwitch.qml @@ -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; }) } diff --git a/MainScreen.qml b/MainScreen.qml index a753a6d..25aa616 100644 --- a/MainScreen.qml +++ b/MainScreen.qml @@ -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" } diff --git a/MqttPage.qml b/MqttPage.qml index 82c4a9c..a69b0bb 100644 --- a/MqttPage.qml +++ b/MqttPage.qml @@ -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" } diff --git a/NavigationItem.qml b/NavigationItem.qml index 041c2b8..933dc83 100644 --- a/NavigationItem.qml +++ b/NavigationItem.qml @@ -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 { diff --git a/OcppPage.qml b/OcppPage.qml index 91c64f0..94eb0ca 100644 --- a/OcppPage.qml +++ b/OcppPage.qml @@ -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" } diff --git a/SchedulerDayPage.qml b/SchedulerDayPage.qml index 03f3879..27d9274 100644 --- a/SchedulerDayPage.qml +++ b/SchedulerDayPage.qml @@ -39,7 +39,6 @@ NavigationPage { TimePickerDialog { id: timePickerDialog - anchors.centerIn: parent is24Hour: is24HourSwitch.checked onTimeAccepted: print("A time was chosen - do something here!") diff --git a/SelectLogicModeItem.qml b/SelectLogicModeItem.qml index 00deac5..93f9d1e 100644 --- a/SelectLogicModeItem.qml +++ b/SelectLogicModeItem.qml @@ -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) diff --git a/SetPriceLimitPage.qml b/SetPriceLimitPage.qml index dd1ce95..aa772f4 100644 --- a/SetPriceLimitPage.qml +++ b/SetPriceLimitPage.qml @@ -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 { diff --git a/SettingsTabPage.qml b/SettingsTabPage.qml index a320d7e..7ee1103 100644 --- a/SettingsTabPage.qml +++ b/SettingsTabPage.qml @@ -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" } diff --git a/SimpleNavigationItem.qml b/SimpleNavigationItem.qml index ee204df..d24f12f 100644 --- a/SimpleNavigationItem.qml +++ b/SimpleNavigationItem.qml @@ -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 } diff --git a/TimePickerDialog.qml b/TimePickerDialog.qml index 56eda85..765124f 100644 --- a/TimePickerDialog.qml +++ b/TimePickerDialog.qml @@ -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 diff --git a/WhiteCheckDelegate.qml b/WhiteCheckDelegate.qml new file mode 100644 index 0000000..4d71a9a --- /dev/null +++ b/WhiteCheckDelegate.qml @@ -0,0 +1,10 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +CheckDelegate { + Component.onCompleted: { + background.color = "white" + background.radius = 5 + } +} diff --git a/WhiteItemDelegate.qml b/WhiteItemDelegate.qml new file mode 100644 index 0000000..e97fb87 --- /dev/null +++ b/WhiteItemDelegate.qml @@ -0,0 +1,10 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ItemDelegate { + Component.onCompleted: { + background.radius = 5 + background.color = "white" + } +} diff --git a/WhiteSwipeDelegate.qml b/WhiteSwipeDelegate.qml new file mode 100644 index 0000000..a212531 --- /dev/null +++ b/WhiteSwipeDelegate.qml @@ -0,0 +1,10 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +SwipeDelegate { + Component.onCompleted: { + background.color = "white" + background.radius = 5 + } +} diff --git a/WiFiOnOffSwitch.qml b/WiFiOnOffSwitch.qml index 41a51d0..1ee64d3 100644 --- a/WiFiOnOffSwitch.qml +++ b/WiFiOnOffSwitch.qml @@ -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 } } diff --git a/WiFiPage.qml b/WiFiPage.qml index ebe8fa6..60a7a80 100644 --- a/WiFiPage.qml +++ b/WiFiPage.qml @@ -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" } diff --git a/qmldir b/qmldir index 1dd10c5..87f0796 100644 --- a/qmldir +++ b/qmldir @@ -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