From c17d32d8352c7aa70e243cc1944e74e22deaefee Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Thu, 4 Aug 2022 22:21:38 +0200 Subject: [PATCH] Show more details about the zwave controller --- libnymea-app/zwave/zwavenetwork.cpp | 13 +++++++++++++ libnymea-app/zwave/zwavenetwork.h | 6 ++++++ nymea-app/ui/system/zwave/ZWaveNetworkPage.qml | 16 ++-------------- .../ui/system/zwave/ZWaveNetworkSettingsPage.qml | 9 +++++++++ 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/libnymea-app/zwave/zwavenetwork.cpp b/libnymea-app/zwave/zwavenetwork.cpp index 7c05b936..76e4cdde 100644 --- a/libnymea-app/zwave/zwavenetwork.cpp +++ b/libnymea-app/zwave/zwavenetwork.cpp @@ -72,6 +72,19 @@ void ZWaveNetwork::setIsStaticUpdateController(bool isStaticUpdateController) } } +bool ZWaveNetwork::isBridgeController() const +{ + return m_isBridgeController; +} + +void ZWaveNetwork::setIsBridgeController(bool isBridgeController) +{ + if (m_isBridgeController != isBridgeController) { + m_isBridgeController = isBridgeController; + emit isBridgeControllerChanged(); + } +} + bool ZWaveNetwork::waitingForNodeAddition() const { return m_waitingForNodeAddition; diff --git a/libnymea-app/zwave/zwavenetwork.h b/libnymea-app/zwave/zwavenetwork.h index 9af621b3..bee4bb78 100644 --- a/libnymea-app/zwave/zwavenetwork.h +++ b/libnymea-app/zwave/zwavenetwork.h @@ -17,6 +17,7 @@ class ZWaveNetwork : public QObject Q_PROPERTY(bool isZWavePlus READ isZWavePlus NOTIFY isZWavePlusChanged) Q_PROPERTY(bool isPrimaryController READ isPrimaryController NOTIFY isPrimaryControllerChanged) Q_PROPERTY(bool isStaticUpdateController READ isStaticUpdateController NOTIFY isStaticUpdateControllerChanged) + Q_PROPERTY(bool isBridgeController READ isBridgeController NOTIFY isBridgeControllerChanged) Q_PROPERTY(bool waitingForNodeAddition READ waitingForNodeAddition NOTIFY waitingForNodeAdditionChanged) Q_PROPERTY(bool waitingForNodeRemoval READ waitingForNodeRemoval NOTIFY waitingForNodeRemovalChanged) Q_PROPERTY(ZWaveNetworkState networkState READ networkState NOTIFY networkStateChanged) @@ -47,6 +48,9 @@ public: bool isStaticUpdateController() const; void setIsStaticUpdateController(bool isStaticUpdateController); + bool isBridgeController() const; + void setIsBridgeController(bool isBridgeController); + bool waitingForNodeAddition() const; void setWaitingForNodeAddition(bool waitingForNodeAddition); @@ -67,6 +71,7 @@ signals: void isZWavePlusChanged(); void isPrimaryControllerChanged(); void isStaticUpdateControllerChanged(); + void isBridgeControllerChanged(); void waitingForNodeAdditionChanged(); void waitingForNodeRemovalChanged(); @@ -77,6 +82,7 @@ private: bool m_isZWavePlus = false; bool m_isPrimaryController = false; bool m_isStaticUpdateController = false; + bool m_isBridgeController = false; bool m_waitingForNodeAddition = false; bool m_waitingForNodeRemoval = false; ZWaveNetworkState m_networkState = ZWaveNetworkStateOffline; diff --git a/nymea-app/ui/system/zwave/ZWaveNetworkPage.qml b/nymea-app/ui/system/zwave/ZWaveNetworkPage.qml index 48d61f84..2e1c3f25 100644 --- a/nymea-app/ui/system/zwave/ZWaveNetworkPage.qml +++ b/nymea-app/ui/system/zwave/ZWaveNetworkPage.qml @@ -201,19 +201,6 @@ SettingsPageBase { } } } - - RowLayout { - Layout.fillWidth: true - - Label { - Layout.fillWidth: true - text: qsTr("Controller type") - } - - Label { - text: network.isPrimaryController ? qsTr("Primary") : qsTr("Secondary") + (network.isStaticUpdateController ? ", " + qsTr("Static") : "") - } - } } SettingsPageSectionHeader { @@ -255,7 +242,7 @@ SettingsPageBase { Layout.fillWidth: true Layout.margins: Style.margins horizontalAlignment: Text.AlignHCenter - text: qsTr("There are no ZigBee devices connected yet. Open the network for new devices to join and start the pairing procedure from the ZigBee device. Please refer to the devices manual for more information on how to start the pairing.") + text: qsTr("There are no Z-Wave devices connected yet. Open the network for new devices to join and start the pairing procedure from the Z-Wave device. Please refer to the devices manual for more information on how to start the pairing.") wrapMode: Text.WordWrap visible: nodesModel.count === 0 } @@ -301,6 +288,7 @@ SettingsPageBase { busy: !node.initialized canDelete: node.failed +// canDelete: true onDeleteClicked: { var dialog = removeZWaveNodeDialogComponent.createObject(app, {zwaveNode: node}) dialog.open() diff --git a/nymea-app/ui/system/zwave/ZWaveNetworkSettingsPage.qml b/nymea-app/ui/system/zwave/ZWaveNetworkSettingsPage.qml index 7d19a196..2424a8ef 100644 --- a/nymea-app/ui/system/zwave/ZWaveNetworkSettingsPage.qml +++ b/nymea-app/ui/system/zwave/ZWaveNetworkSettingsPage.qml @@ -131,6 +131,15 @@ SettingsPageBase { progressive: false } + NymeaItemDelegate { + Layout.fillWidth: true + text: qsTr("Controller type") + subText: network.isPrimaryController ? qsTr("Primary") : qsTr("Secondary") + + (network.isStaticUpdateController ? ", " + qsTr("Static") : "") + + (network.isBridgeController ? ", " + qsTr("Bridge") : "") + progressive: false + } + SettingsPageSectionHeader { text: qsTr("Hardware information") }