- redesigned the Extension status display in the top left corner

- redesigned the Extension overview in the basestation settings
(for #19)
This commit is contained in:
Dorian Zedler 2020-09-22 15:44:57 +02:00
parent ec2d6fb9ef
commit c5ac250b4e
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
2 changed files with 11 additions and 9 deletions

View file

@ -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<ScStw::SignalKey> 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.

View file

@ -24,7 +24,7 @@ ScStwClient::ScStwClient(QObject * parent, QList<ScStw::SignalKey> 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());