From c5ac250b4e79ba10b621f1c3dbabd757cdc13334 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Tue, 22 Sep 2020 15:44:57 +0200 Subject: [PATCH] - redesigned the Extension status display in the top left corner - redesigned the Extension overview in the basestation settings (for #19) --- ScStwLibraries/headers/client/scstwclient.h | 8 ++++---- ScStwLibraries/sources/client/scstwclient.cpp | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ScStwLibraries/headers/client/scstwclient.h b/ScStwLibraries/headers/client/scstwclient.h index 99e8dc3..e316097 100644 --- a/ScStwLibraries/headers/client/scstwclient.h +++ b/ScStwLibraries/headers/client/scstwclient.h @@ -51,7 +51,7 @@ class ScStwClient : public QObject { Q_OBJECT Q_PROPERTY(State state READ getState NOTIFY stateChanged) - Q_PROPERTY(QVariantList extensions READ getExtensions NOTIFY extensionsChanged) + Q_PROPERTY(QVariantMap extensions READ getExtensions NOTIFY extensionsChanged) Q_PROPERTY(QString ipAddress READ getIP WRITE setIP) public: @@ -77,7 +77,7 @@ private: int errors; const static int ERRORS_UNTIL_DISCONNECT = 4; - QVariantList extensions; + QVariantMap extensions; QList signalSubscriptions; @@ -173,7 +173,7 @@ public slots: * \brief Function to get the extensions and their state from the base station * \return a list with all configured extensions and their state */ - QVariantList getExtensions(); + QVariantMap getExtensions(); /*! * \brief Function to get the time offset of the base station relative to the clients time @@ -287,7 +287,7 @@ private slots: * \see gotSignal() * \param connections the list to set the chache to */ - void setExtensions(QVariantList extensions); + void setExtensions(QVariantMap extensions); /*! * \brief Function to set the local state. diff --git a/ScStwLibraries/sources/client/scstwclient.cpp b/ScStwLibraries/sources/client/scstwclient.cpp index e9a4ef9..cf12a27 100644 --- a/ScStwLibraries/sources/client/scstwclient.cpp +++ b/ScStwLibraries/sources/client/scstwclient.cpp @@ -24,7 +24,7 @@ ScStwClient::ScStwClient(QObject * parent, QList signalSubscri { this->state = DISCONNECTED; this->nextConnectionId = 1; - this->extensions = QVariantList({}); + this->extensions = QVariantMap({}); this->signalSubscriptions = signalSubscriptions; this->socket = new QTcpSocket(this); @@ -121,7 +121,7 @@ void ScStwClient::deInit() { if(this->state == DISCONNECTED) return; - this->setExtensions(QVariantList({})); + this->setExtensions(QVariantMap({})); this->setState(DISCONNECTED); } @@ -380,7 +380,7 @@ void ScStwClient::handleSignal(QVariantMap data) { { // the extension connections have changed // -> handle locally - this->setExtensions(data["data"].toList()); + this->setExtensions(data["data"].toMap()); return; break; } @@ -434,7 +434,7 @@ void ScStwClient::setState(ScStwClient::State newState){ } } -QVariantList ScStwClient::getExtensions() { +QVariantMap ScStwClient::getExtensions() { return this->extensions; } @@ -450,7 +450,9 @@ QString ScStwClient::getApiVersion() { return this->apiVersion; } -void ScStwClient::setExtensions(QVariantList extensions) { +void ScStwClient::setExtensions(QVariantMap extensions) { + qDebug() << "[CLIENT][DEBUG] Extensions changed: " << extensions; + if(this->extensions != extensions){ this->extensions = extensions; emit this->gotSignal(ScStw::ExtensionsChanged, this->getExtensions());