mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add disconnect behaviour
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "tcpclient.h"
|
||||
#include "updatecontroller.h"
|
||||
#include "UpdateController.h"
|
||||
#include "externalexecuter.h"
|
||||
|
||||
#include <QDir>
|
||||
@@ -7,7 +7,10 @@
|
||||
TCPClient::TCPClient(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
socket = NULL;
|
||||
//socket = NULL;
|
||||
socket = new QTcpSocket();
|
||||
socket->setParent(this);
|
||||
socket->moveToThread(this->thread());
|
||||
}
|
||||
|
||||
void TCPClient::initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter)
|
||||
@@ -15,6 +18,7 @@ void TCPClient::initialize(RecognizeSystem *recognize,ExternalExecuter *external
|
||||
this->recognizeSystem = recognize;
|
||||
this->externalExecuter = externalExecuter;
|
||||
|
||||
|
||||
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
||||
}
|
||||
|
||||
@@ -26,8 +30,6 @@ void TCPClient::setConnect(ServerSettings *serverSettings)
|
||||
return;
|
||||
}
|
||||
|
||||
socket = new QTcpSocket(this);
|
||||
|
||||
connect(socket,&QTcpSocket::readyRead,this,&TCPClient::slotReadyRead,Qt::DirectConnection);
|
||||
connect(socket,&QTcpSocket::disconnected,this,&TCPClient::setDisconnect);
|
||||
connect(socket,&QTcpSocket::connected,this,&TCPClient::slotConnectNotify);
|
||||
@@ -98,6 +100,7 @@ void TCPClient::sendUnityConnect()
|
||||
void TCPClient::setDisconnect()
|
||||
{
|
||||
socket->disconnect();
|
||||
emit sigServerDisconnect();
|
||||
emit sigSendDebugLog("Server disabled");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user