diff --git a/libnymea-app-core/connection/awsclient.cpp b/libnymea-app-core/connection/awsclient.cpp index 48eedd15..8f3b6c75 100644 --- a/libnymea-app-core/connection/awsclient.cpp +++ b/libnymea-app-core/connection/awsclient.cpp @@ -970,7 +970,7 @@ void AWSClient::fetchDevices() QString deviceId = entry.toMap().value("deviceId").toString(); QString name = entry.toMap().value("name").toString(); bool online = entry.toMap().value("online").toBool(); -// qDebug() << "Have cloud device:" << deviceId << name << "online:" << online; + qDebug() << "Have cloud device:" << deviceId << name << "online:" << online; AWSDevice *d = m_devices->getDevice(deviceId); if (!d) { @@ -978,6 +978,7 @@ void AWSClient::fetchDevices() m_devices->insert(d); } d->setOnline(online); + d->setName(name); actualDevices.append(d->id()); } @@ -1144,6 +1145,21 @@ void AWSDevices::insert(AWSDevice *device) device->setParent(this); beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); m_list.append(device); + + connect(device, &AWSDevice::onlineChanged, this, [this, device](){ + int idx = m_list.indexOf(device); + if (idx >= 0) { + emit dataChanged(index(idx), index(idx), {RoleOnline}); + } + }); + + connect(device, &AWSDevice::nameChanged, this, [this, device](){ + int idx = m_list.indexOf(device); + if (idx >= 0) { + emit dataChanged(index(idx), index(idx), {RoleName}); + } + }); + endInsertRows(); emit countChanged(); } @@ -1196,6 +1212,14 @@ QString AWSDevice::name() const return m_name; } +void AWSDevice::setName(const QString &name) +{ + if (m_name != name) { + m_name = name; + emit nameChanged(); + } +} + bool AWSDevice::online() const { return m_online; diff --git a/libnymea-app-core/connection/awsclient.h b/libnymea-app-core/connection/awsclient.h index e8048ddc..b7cdb966 100644 --- a/libnymea-app-core/connection/awsclient.h +++ b/libnymea-app-core/connection/awsclient.h @@ -12,18 +12,20 @@ class QNetworkAccessManager; class AWSDevice: public QObject { Q_OBJECT Q_PROPERTY(QString id READ id CONSTANT) - Q_PROPERTY(QString name READ name CONSTANT) + Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(bool online READ online NOTIFY onlineChanged) public: AWSDevice(const QString &id, const QString &name, bool online = false, QObject *parent = nullptr); QString id() const; QString name() const; + void setName(const QString &name); bool online() const; void setOnline(bool online); signals: void onlineChanged(); + void nameChanged(); private: QString m_id; diff --git a/libnymea-app-core/connection/nymeaconnection.cpp b/libnymea-app-core/connection/nymeaconnection.cpp index 3c539bde..b53c05a8 100644 --- a/libnymea-app-core/connection/nymeaconnection.cpp +++ b/libnymea-app-core/connection/nymeaconnection.cpp @@ -275,6 +275,9 @@ void NymeaConnection::onError(QAbstractSocket::SocketError error) transport->deleteLater(); } qDebug() << "A transport error happened for" << transport->url() << error << "(Still trying on" << m_transportCandidates.count() << "connections)"; + foreach (Connection *c, m_transportCandidates) { + qDebug() << "Connection candidate:" << c->url(); + } if (m_transportCandidates.isEmpty()) { m_connectionStatus = errorStatus; emit connectionStatusChanged(); diff --git a/nymea-app/ui/appsettings/CloudLoginPage.qml b/nymea-app/ui/appsettings/CloudLoginPage.qml index fc817db5..a35b3d47 100644 --- a/nymea-app/ui/appsettings/CloudLoginPage.qml +++ b/nymea-app/ui/appsettings/CloudLoginPage.qml @@ -214,7 +214,7 @@ Page { errorLabel.text = qsTr("Failed to connect to the login server. Please mase sure your network connection is working.") break; default: - errorLabel.text = qsTr("An unexpected error happened. Please report this isse. Error code:").arg(error) + errorLabel.text = qsTr("An unexpected error happened. Please report this isse. Error code: %1").arg(error) break; } errorLabel.visible = (error !== AWSClient.LoginErrorNoError) diff --git a/nymea-remoteproxy b/nymea-remoteproxy index eacffb69..9c707519 160000 --- a/nymea-remoteproxy +++ b/nymea-remoteproxy @@ -1 +1 @@ -Subproject commit eacffb695f8870c75b027a701277f6ec4455d327 +Subproject commit 9c7075192b2b799feb302b48618eb4ef4d942172