From bfab7d7c871322e55adf90e00feb0a9347e04cd5 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 31 Aug 2020 22:24:02 +0200 Subject: [PATCH] Update QtZeroconf --- QtZeroConf | 2 +- libnymea-app/connection/discovery/upnpdiscovery.cpp | 12 ++++++++---- .../connection/discovery/zeroconfdiscovery.cpp | 6 +++--- nymea-app/ui/RootItem.qml | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/QtZeroConf b/QtZeroConf index 39efbe28..cbf4f2bf 160000 --- a/QtZeroConf +++ b/QtZeroConf @@ -1 +1 @@ -Subproject commit 39efbe2879d93bd483ee1f14fc94281a03b49935 +Subproject commit cbf4f2bf7b926b9a874af013efbf0f6dde3155e9 diff --git a/libnymea-app/connection/discovery/upnpdiscovery.cpp b/libnymea-app/connection/discovery/upnpdiscovery.cpp index a65b0833..ef4fb66c 100644 --- a/libnymea-app/connection/discovery/upnpdiscovery.cpp +++ b/libnymea-app/connection/discovery/upnpdiscovery.cpp @@ -260,14 +260,18 @@ void UpnpDiscovery::networkReplyFinished(QNetworkReply *reply) device->setName(name); device->setVersion(version); foreach (const QUrl &url, connections) { - if (!device->connections()->find(url)) { + Connection *connection = device->connections()->find(url); + if (!connection) { qDebug() << "UPnP: Adding new connection to host:" << device->name() << url; bool sslEnabled = url.scheme() == "nymeas" || url.scheme() == "wss"; QString displayName = QString("%1:%2").arg(url.host()).arg(url.port()); Connection::BearerType bearerType = QHostAddress(url.host()).isLoopback() ? Connection::BearerTypeLoopback : Connection::BearerTypeLan; - Connection *conn = new Connection(url, bearerType, sslEnabled, displayName); - conn->setOnline(true); - device->connections()->addConnection(conn); + connection = new Connection(url, bearerType, sslEnabled, displayName); + connection->setOnline(true); + device->connections()->addConnection(connection); + } else { + qDebug() << "UPnP: Setting connection online:" << device->name() << url.toString(); + connection->setOnline(true); } } } diff --git a/libnymea-app/connection/discovery/zeroconfdiscovery.cpp b/libnymea-app/connection/discovery/zeroconfdiscovery.cpp index 985901d3..40ffdce0 100644 --- a/libnymea-app/connection/discovery/zeroconfdiscovery.cpp +++ b/libnymea-app/connection/discovery/zeroconfdiscovery.cpp @@ -153,14 +153,14 @@ void ZeroconfDiscovery::serviceEntryAdded(const QZeroConfService &entry) url.setPort(entry->port()); Connection *connection = host->connections()->find(url); if (!connection) { -// qDebug() << "Zeroconf: Adding new connection to host:" << host->name() << url.toString(); + qDebug() << "Zeroconf: Adding new connection to host:" << host->name() << url.toString(); QString displayName = QString("%1:%2").arg(url.host()).arg(url.port()); Connection::BearerType bearerType = QHostAddress(url.host()).isLoopback() ? Connection::BearerTypeLoopback : Connection::BearerTypeLan; connection = new Connection(url, bearerType, sslEnabled, displayName); connection->setOnline(true); host->connections()->addConnection(connection); } else { -// qDebug() << "Zeroconf: Setting connection online:" << host->name() << url.toString(); + qDebug() << "Zeroconf: Setting connection online:" << host->name() << url.toString(); connection->setOnline(true); } } @@ -213,7 +213,7 @@ void ZeroconfDiscovery::serviceEntryRemoved(const QZeroConfService &entry) return; } -// qDebug() << "Zeroconf: Setting connection offline:" << host->name() << url.toString(); + qDebug() << "Zeroconf: Setting connection offline:" << host->name() << url.toString(); connection->setOnline(false); } #endif diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index 09bb1b29..e38bc904 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -375,7 +375,7 @@ Item { property var engine: mainRepeater.itemAt(index)._engine property string serverName: engine.nymeaConfiguration.serverName Material.elevation: index - width: Math.max(150, tabbar.width / tabbar.count) + width: Math.max(150, tabbar.width / tabModel.count) Rectangle { anchors.fill: parent