Use The displayMessage in discovery results
This commit is contained in:
parent
7a1cd43a03
commit
9dca083f0e
@ -66,6 +66,7 @@ void DeviceDiscovery::discoverDevices(const QUuid &deviceClassId, const QVariant
|
|||||||
}
|
}
|
||||||
m_engine->jsonRpcClient()->sendCommand("Devices.GetDiscoveredDevices", params, this, "discoverDevicesResponse");
|
m_engine->jsonRpcClient()->sendCommand("Devices.GetDiscoveredDevices", params, this, "discoverDevicesResponse");
|
||||||
m_busy = true;
|
m_busy = true;
|
||||||
|
m_displayMessage.clear();
|
||||||
emit busyChanged();
|
emit busyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,11 +96,13 @@ bool DeviceDiscovery::busy() const
|
|||||||
return m_busy;
|
return m_busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DeviceDiscovery::displayMessage() const
|
||||||
|
{
|
||||||
|
return m_displayMessage;
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceDiscovery::discoverDevicesResponse(const QVariantMap ¶ms)
|
void DeviceDiscovery::discoverDevicesResponse(const QVariantMap ¶ms)
|
||||||
{
|
{
|
||||||
m_busy = false;
|
|
||||||
emit busyChanged();
|
|
||||||
|
|
||||||
// qDebug() << "response received" << params;
|
// qDebug() << "response received" << params;
|
||||||
QVariantList descriptors = params.value("params").toMap().value("deviceDescriptors").toList();
|
QVariantList descriptors = params.value("params").toMap().value("deviceDescriptors").toList();
|
||||||
foreach (const QVariant &descriptorVariant, descriptors) {
|
foreach (const QVariant &descriptorVariant, descriptors) {
|
||||||
@ -120,6 +123,10 @@ void DeviceDiscovery::discoverDevicesResponse(const QVariantMap ¶ms)
|
|||||||
emit countChanged();
|
emit countChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_displayMessage = params.value("params").toMap().value("displayMessage").toString();
|
||||||
|
m_busy = false;
|
||||||
|
emit busyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceDiscovery::contains(const QUuid &deviceDescriptorId) const
|
bool DeviceDiscovery::contains(const QUuid &deviceDescriptorId) const
|
||||||
|
|||||||
@ -36,6 +36,7 @@ class DeviceDiscovery : public QAbstractListModel
|
|||||||
Q_PROPERTY(Engine* engine READ engine WRITE setEngine)
|
Q_PROPERTY(Engine* engine READ engine WRITE setEngine)
|
||||||
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
|
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
|
||||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||||
|
Q_PROPERTY(QString displayMessage READ displayMessage NOTIFY busyChanged)
|
||||||
public:
|
public:
|
||||||
enum Roles {
|
enum Roles {
|
||||||
RoleId,
|
RoleId,
|
||||||
@ -59,6 +60,7 @@ public:
|
|||||||
void setEngine(Engine *jsonRpcClient);
|
void setEngine(Engine *jsonRpcClient);
|
||||||
|
|
||||||
bool busy() const;
|
bool busy() const;
|
||||||
|
QString displayMessage() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void discoverDevicesResponse(const QVariantMap ¶ms);
|
void discoverDevicesResponse(const QVariantMap ¶ms);
|
||||||
@ -71,6 +73,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
Engine *m_engine = nullptr;
|
Engine *m_engine = nullptr;
|
||||||
bool m_busy = false;
|
bool m_busy = false;
|
||||||
|
QString m_displayMessage;
|
||||||
|
|
||||||
bool contains(const QUuid &deviceDescriptorId) const;
|
bool contains(const QUuid &deviceDescriptorId) const;
|
||||||
QList<DeviceDescriptor*> m_foundDevices;
|
QList<DeviceDescriptor*> m_foundDevices;
|
||||||
|
|||||||
@ -292,16 +292,21 @@ Page {
|
|||||||
text: qsTr("Too bad...")
|
text: qsTr("Too bad...")
|
||||||
font.pixelSize: app.largeFont
|
font.pixelSize: app.largeFont
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("No things of this kind could be found...")
|
text: qsTr("No things of this kind could be found...")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
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
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user