1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Add explicit quit command when removing a wallpaper

This commit is contained in:
Elias Steurer 2020-05-31 15:13:51 +02:00
parent d67ccb5e8f
commit 43666b0860
2 changed files with 19 additions and 0 deletions

View File

@ -188,6 +188,16 @@ public slots:
void close()
{
qInfo() << "Close " << m_type;
QJsonObject obj;
obj.insert("command", QJsonValue("quit"));
QByteArray command = QJsonDocument(obj).toJson();
m_socket->write(command);
m_socket->waitForBytesWritten();
if (m_socket->state() == QLocalSocket::ConnectedState) {
m_socket->disconnectFromServer();
m_socket->close();

View File

@ -77,6 +77,15 @@ void ScreenPlaySDK::readyRead()
return;
}
QJsonObject ob = doc.object();
if(ob.size() == 1){
if(ob.contains("command")){
if(ob.value("command") == "quit"){
emit sdkDisconnected();
return;
}
}
}
QJsonObject::iterator iterator;
for (iterator = ob.begin(); iterator != ob.end(); iterator++) {
emit incommingMessage(iterator.key(), ob.value(iterator.key()).toString());