mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: stable loading
This commit is contained in:
@@ -14,6 +14,7 @@ void TCPClient::initialize(RecognizeSystem *recognize,ExternalExecuter *external
|
||||
this->recognizeSystem = recognize;
|
||||
this->externalExecuter = externalExecuter;
|
||||
this->sendSystem = sendSystem;
|
||||
isConnected = false;
|
||||
|
||||
emit sigSendDebugLog(Tools::getTime() + " Client started");
|
||||
}
|
||||
@@ -31,6 +32,7 @@ void TCPClient::setConnect(ServerSettings *serverSettings,QThread *th)
|
||||
|
||||
socket->connectToHost(serverSettings->Address,serverSettings->Port.toShort());
|
||||
emit sigSendDebugLog("Try connect...");
|
||||
isConnected = true;
|
||||
|
||||
if (socket->waitForConnected(2000))
|
||||
{
|
||||
@@ -46,6 +48,7 @@ void TCPClient::setConnect(ServerSettings *serverSettings,QThread *th)
|
||||
}
|
||||
else
|
||||
{
|
||||
isConnected = false;
|
||||
emit sigServerDisconnect();
|
||||
}
|
||||
}
|
||||
@@ -54,6 +57,7 @@ void TCPClient::setConnect(ServerSettings *serverSettings,QThread *th)
|
||||
void TCPClient::setDisconnect()
|
||||
{
|
||||
socket->disconnect();
|
||||
isConnected = false;
|
||||
emit sigServerDisconnect();
|
||||
emit sigSendDebugLog("Server disabled");
|
||||
}
|
||||
@@ -106,12 +110,14 @@ void TCPClient::slotConnectNotify()
|
||||
{
|
||||
if(socket->state() != QTcpSocket::ConnectedState)
|
||||
{
|
||||
isConnected = false;
|
||||
emit sigSendDebugLog("Connect invalid");
|
||||
emit sigConnectionState(false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
isConnected = true;
|
||||
emit sigSendDebugLog("Connect complete");
|
||||
emit sigConnectionState(true);
|
||||
sendSystem->sendQTConnect();
|
||||
@@ -128,6 +134,11 @@ void TCPClient::slotReadyRead()
|
||||
emit sigRecognize(socket);
|
||||
}
|
||||
|
||||
bool TCPClient::getIsConnected() const
|
||||
{
|
||||
return isConnected;
|
||||
}
|
||||
|
||||
TCPClient::~TCPClient()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user