Merge PR #810: Fix count property in zigbeedevicesproxy

This commit is contained in:
jenkins 2022-04-25 09:40:20 +02:00
commit cef8550d8b
3 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include "zigbeemanager.h" #include "zigbeemanager.h"
#include <QMetaEnum> #include <QMetaEnum>
#include <QJsonDocument>
#include "engine.h" #include "engine.h"
#include "logging.h" #include "logging.h"
@ -253,6 +254,7 @@ void ZigbeeManager::removeNodeResponse(int commandId, const QVariantMap &params)
void ZigbeeManager::notificationReceived(const QVariantMap &notification) void ZigbeeManager::notificationReceived(const QVariantMap &notification)
{ {
qCDebug(dcZigbee()) << "Zigbee notification" << qUtf8Printable(QJsonDocument::fromVariant(notification).toJson());
QString notificationString = notification.value("notification").toString(); QString notificationString = notification.value("notification").toString();
if (notificationString == "Zigbee.AdapterAdded") { if (notificationString == "Zigbee.AdapterAdded") {
QVariantMap adapterMap = notification.value("params").toMap().value("adapter").toMap(); QVariantMap adapterMap = notification.value("params").toMap().value("adapter").toMap();

View File

@ -64,6 +64,7 @@ void ZigbeeNodesProxy::setZigbeeNodes(ZigbeeNodes *zigbeeNodes)
for (int i = first; i <= last; i++) { for (int i = first; i <= last; i++) {
m_newNodes.insert(m_zigbeeNodes->get(i), QDateTime::currentDateTime()); m_newNodes.insert(m_zigbeeNodes->get(i), QDateTime::currentDateTime());
} }
emit countChanged();
}); });
connect(m_zigbeeNodes, &ZigbeeNodes::dataChanged, this, [this](const QModelIndex &/*topLeft*/, const QModelIndex &/*bottomRight*/, const QVector<int> &roles = QVector<int>()){ connect(m_zigbeeNodes, &ZigbeeNodes::dataChanged, this, [this](const QModelIndex &/*topLeft*/, const QModelIndex &/*bottomRight*/, const QVector<int> &roles = QVector<int>()){
if (roles.contains(ZigbeeNodes::RoleReachable) && (!m_showOffline || !m_showOnline)) { if (roles.contains(ZigbeeNodes::RoleReachable) && (!m_showOffline || !m_showOnline)) {

View File

@ -248,7 +248,7 @@ SettingsPageBase {
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: Style.margins Layout.margins: Style.margins
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("There are no ZigBee devices connectd 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 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.")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: nodesModel.count === 0 visible: nodesModel.count === 0
} }