diff --git a/libnymea-app-core/devicediscovery.cpp b/libnymea-app-core/devicediscovery.cpp index e937f4b1..b783132f 100644 --- a/libnymea-app-core/devicediscovery.cpp +++ b/libnymea-app-core/devicediscovery.cpp @@ -66,6 +66,7 @@ void DeviceDiscovery::discoverDevices(const QUuid &deviceClassId, const QVariant } m_engine->jsonRpcClient()->sendCommand("Devices.GetDiscoveredDevices", params, this, "discoverDevicesResponse"); m_busy = true; + m_displayMessage.clear(); emit busyChanged(); } @@ -95,11 +96,13 @@ bool DeviceDiscovery::busy() const return m_busy; } +QString DeviceDiscovery::displayMessage() const +{ + return m_displayMessage; +} + void DeviceDiscovery::discoverDevicesResponse(const QVariantMap ¶ms) { - m_busy = false; - emit busyChanged(); - // qDebug() << "response received" << params; QVariantList descriptors = params.value("params").toMap().value("deviceDescriptors").toList(); foreach (const QVariant &descriptorVariant, descriptors) { @@ -120,6 +123,10 @@ void DeviceDiscovery::discoverDevicesResponse(const QVariantMap ¶ms) emit countChanged(); } } + + m_displayMessage = params.value("params").toMap().value("displayMessage").toString(); + m_busy = false; + emit busyChanged(); } bool DeviceDiscovery::contains(const QUuid &deviceDescriptorId) const diff --git a/libnymea-app-core/devicediscovery.h b/libnymea-app-core/devicediscovery.h index cd99d228..5106d4a6 100644 --- a/libnymea-app-core/devicediscovery.h +++ b/libnymea-app-core/devicediscovery.h @@ -36,6 +36,7 @@ class DeviceDiscovery : public QAbstractListModel Q_PROPERTY(Engine* engine READ engine WRITE setEngine) Q_PROPERTY(bool busy READ busy NOTIFY busyChanged) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) + Q_PROPERTY(QString displayMessage READ displayMessage NOTIFY busyChanged) public: enum Roles { RoleId, @@ -59,6 +60,7 @@ public: void setEngine(Engine *jsonRpcClient); bool busy() const; + QString displayMessage() const; private slots: void discoverDevicesResponse(const QVariantMap ¶ms); @@ -71,6 +73,7 @@ signals: private: Engine *m_engine = nullptr; bool m_busy = false; + QString m_displayMessage; bool contains(const QUuid &deviceDescriptorId) const; QList m_foundDevices; diff --git a/nymea-app/ui/thingconfiguration/SetupWizard.qml b/nymea-app/ui/thingconfiguration/SetupWizard.qml index e04b59a3..1573ca70 100644 --- a/nymea-app/ui/thingconfiguration/SetupWizard.qml +++ b/nymea-app/ui/thingconfiguration/SetupWizard.qml @@ -292,16 +292,21 @@ Page { text: qsTr("Too bad...") font.pixelSize: app.largeFont Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter } Label { text: qsTr("No things of this kind could be found...") Layout.fillWidth: true wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter } Label { Layout.fillWidth: true - text: qsTr("Make sure your things are set up and connected, try searching again or go back and pick a different kind of thing.") + horizontalAlignment: Text.AlignHCenter + text: discovery.displayMessage.length === 0 ? + qsTr("Make sure your things are set up and connected, try searching again or go back and pick a different kind of thing.") + : discovery.displayMessage wrapMode: Text.WordWrap } }