feat: connection thread

This commit is contained in:
semenov
2024-08-20 09:13:31 +03:00
parent ea18836923
commit fa79d72b6c
6 changed files with 13 additions and 11 deletions

View File

@@ -22,9 +22,8 @@ void MainWindow::Initialize()
ui->startButton->setEnabled(false);
updateControllerThread = new QThread;
updateControllerThread->setPriority(QThread::LowPriority);
connectionThread = new QThread;
connectionThread->setPriority(QThread::HighestPriority);
client = new TCPClient;
client->moveToThread(connectionThread);
@@ -44,17 +43,20 @@ void MainWindow::Initialize()
connect(recognizeSystem,&RecognizeSystem::onSendDebugLog,this,&MainWindow::DebugLog);
connect(recognizeSystem,&RecognizeSystem::SockedDisabled,this,&MainWindow::LostConnection);
connect(recognizeSystem,&RecognizeSystem::SaveLoginData,this,&MainWindow::CheckLoginResult);
connect(recognizeSystem,&RecognizeSystem::SocketWaitForReadyRead,client,&TCPClient::WaitRead);
connect(recognizeSystem,&RecognizeSystem::SocketWaitForReadyRead,client,&TCPClient::WaitRead,Qt::AutoConnection);
connectionThread->start();
updateControllerThread->start();
connect(client,&TCPClient::onSendDebugLog,this,&MainWindow::DebugLog);
updateControllerThread->setPriority(QThread::LowPriority);
connectionThread->setPriority(QThread::HighestPriority);
connect(this,&MainWindow::onInitializeClient,client,&TCPClient::Initialize);
connect(this,&MainWindow::onSetConnect,client,&TCPClient::SetConnect);
connect(this,&MainWindow::onSendMessage,client,&TCPClient::MessageEntered);
connect(this,&MainWindow::SendClientAuthorization,client,&TCPClient::SendClientAutorization);
connect(client,&TCPClient::onSendDebugLog,this,&MainWindow::DebugLog,Qt::AutoConnection);
connect(this,&MainWindow::onInitializeClient,client,&TCPClient::Initialize,Qt::AutoConnection);
connect(this,&MainWindow::onSetConnect,client,&TCPClient::SetConnect,Qt::AutoConnection); //умирает
connect(this,&MainWindow::onSendMessage,client,&TCPClient::MessageEntered,Qt::AutoConnection);
connect(this,&MainWindow::SendClientAuthorization,client,&TCPClient::SendClientAutorization,Qt::AutoConnection);
connect(this,&MainWindow::onCalculateHash,updateController,&UpdateController::CalculateHash);