another small patch

This commit is contained in:
Dorian Zedler 2020-04-06 22:53:58 +02:00
parent 02b759b406
commit e7ecd6730f
Signed by: dorian
GPG key ID: 989DE36109AFA354

View file

@ -187,6 +187,7 @@ void ScStwClient::handleSocketStateChange(QAbstractSocket::SocketState socketSta
switch (socketState) { switch (socketState) {
case QAbstractSocket::UnconnectedState: case QAbstractSocket::UnconnectedState:
{ {
this->deInit();
break; break;
} }
case QAbstractSocket::ConnectedState: case QAbstractSocket::ConnectedState:
@ -289,6 +290,8 @@ void ScStwClient::handleSocketMessage(QString reply) {
reply.replace(ScStw::SOCKET_MESSAGE_START_KEY, ""); reply.replace(ScStw::SOCKET_MESSAGE_START_KEY, "");
reply.replace(ScStw::SOCKET_MESSAGE_END_KEY, ""); reply.replace(ScStw::SOCKET_MESSAGE_END_KEY, "");
//qDebug() << "got message: " << reply;
int id = 0; int id = 0;
QJsonDocument jsonReply = QJsonDocument::fromJson(reply.toUtf8()); QJsonDocument jsonReply = QJsonDocument::fromJson(reply.toUtf8());
@ -320,7 +323,13 @@ void ScStwClient::handleSocketMessage(QString reply) {
void ScStwClient::handleSignal(QVariantMap data) { void ScStwClient::handleSignal(QVariantMap data) {
// get the signal type // get the signal type
ScStw::SignalKey signalKey = ScStw::SignalKey(data["header"].toInt()); if(ScStw::signalKeyFromInt(data["header"].toInt()) == ScStw::InvalidSignal)
return;
ScStw::SignalKey signalKey = ScStw::signalKeyFromInt(data["header"].toInt());
//qDebug() << "got signal: " << signalKey << " with data: " << data["data"];
switch (signalKey) { switch (signalKey) {
case ScStw::ExtensionsChanged: case ScStw::ExtensionsChanged:
{ {
@ -432,9 +441,6 @@ void ScStwClient::setState(ScStwClient::State newState){
qDebug() << "+--- ScStwClient state changed: " << newState; qDebug() << "+--- ScStwClient state changed: " << newState;
this->state = newState; this->state = newState;
emit stateChanged(); emit stateChanged();
if(this->state == DISCONNECTED) {
this->deInit();
}
} }
} }