mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
ref: refactoring treads, check local update instructor
This commit is contained in:
@@ -26,6 +26,8 @@ void MainWindow::initialize()
|
||||
updateTextWidget->initialize();
|
||||
entryWidget->initialize(this);
|
||||
versionSelectWidget->initialize();
|
||||
hashComparer->initialize(this);
|
||||
updateController->initialize(this);
|
||||
|
||||
commonButtonGroupWidget->initialize(externalExecuter,sendSystem,client);
|
||||
commonButtonGroupWidget->show();
|
||||
@@ -43,14 +45,15 @@ void MainWindow::initialize()
|
||||
bindConnection();
|
||||
|
||||
sendSystem->initialize(this,dataParser);
|
||||
dataParser->initialize(recognizeSystem);
|
||||
emit sigCalculateHash();
|
||||
emit sigInitializeClient(recognizeSystem,externalExecuter,sendSystem,connectionThread);
|
||||
emit sigInitializeClient(this,recognizeSystem,externalExecuter,sendSystem,workerThread);
|
||||
emit sigRecognize(updateController,dataParser,this,hashComparer,client);
|
||||
|
||||
recognizeSystem->initialize(updateController,dataParser,this,hashComparer,client);
|
||||
screenChecker->check();
|
||||
|
||||
loadStaticData();
|
||||
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
||||
emit sigSetConnect(dataParser->getServerSettings(),workerThread);
|
||||
|
||||
checkAppAvailable();
|
||||
|
||||
@@ -74,30 +77,32 @@ void MainWindow::createObjects()
|
||||
ui->interactiveGroup->addWidget(updateTextWidget);
|
||||
ui->interactiveGroup->addWidget(versionSelectWidget);
|
||||
|
||||
connectionThread = new QThread;
|
||||
workerThread = new QThread;
|
||||
animationThread = new QThread;
|
||||
|
||||
client = new TCPClient;
|
||||
client->moveToThread(connectionThread);
|
||||
client->moveToThread(workerThread);
|
||||
|
||||
dataParser = new DataParser;
|
||||
dataParser->moveToThread(workerThread);
|
||||
|
||||
sendSystem = new SendSystem;
|
||||
sendSystem->moveToThread(connectionThread);
|
||||
sendSystem->moveToThread(workerThread);
|
||||
|
||||
updateController = new UpdateController(dataParser,sendSystem);
|
||||
updateController->moveToThread(connectionThread);
|
||||
updateController->moveToThread(workerThread);
|
||||
|
||||
recognizeSystem = new RecognizeSystem;
|
||||
recognizeSystem->moveToThread(connectionThread);
|
||||
recognizeSystem->moveToThread(workerThread);
|
||||
|
||||
screenChecker = new ScreenChecker(this,dataParser,ui->displayLayout);
|
||||
externalExecuter = new ExternalExecuter;
|
||||
|
||||
hashComparer = new HashComparer(dataParser);
|
||||
hashComparer->moveToThread(workerThread);
|
||||
|
||||
connectionThread->start();
|
||||
connectionThread->setPriority(QThread::HighestPriority);
|
||||
workerThread->start();
|
||||
workerThread->setPriority(QThread::HighestPriority);
|
||||
|
||||
timer = new QTimer;
|
||||
}
|
||||
@@ -106,19 +111,12 @@ void MainWindow::bindConnection()
|
||||
{
|
||||
connect(timer,&QTimer::timeout,this,&MainWindow::slotDisableNotify);
|
||||
|
||||
connect(updateController,&UpdateController::sigUpdateComplete,this,&MainWindow::showCompleteDialogBox);
|
||||
|
||||
connect(hashComparer,&HashComparer::sigCallCheck,this,&MainWindow::checkUpdate);
|
||||
connect(hashComparer,&HashComparer::sigHaveDelta,this,&MainWindow::showUpdateInfo);
|
||||
|
||||
connect(this,&MainWindow::sigUpdateFilesOnServer,updateController,&UpdateController::updateFilesOnServer);
|
||||
connect(this,&MainWindow::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
||||
connect(this,&MainWindow::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
||||
connect(this,&MainWindow::sigSendCommand,client,&TCPClient::slotSendCommand,Qt::AutoConnection);
|
||||
connect(this,&MainWindow::sigSendXMLAnswer,sendSystem,&SendSystem::xmlAnswer,Qt::AutoConnection);
|
||||
|
||||
connect(client,&TCPClient::sigConnectionState,this,&MainWindow::slotConnectionState,Qt::AutoConnection);
|
||||
connect(client,&TCPClient::sigServerDisconnect,this,&MainWindow::slotServerDisconnect);
|
||||
connect(this,&MainWindow::sigRecognize,recognizeSystem,&RecognizeSystem::initialize,Qt::AutoConnection);
|
||||
|
||||
connect(this,&MainWindow::sigGetConnected,client,&TCPClient::getIsConnected);
|
||||
connect(this,&MainWindow::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
|
||||
@@ -365,7 +363,7 @@ void MainWindow::saveServerSettingsWithConnect()
|
||||
ServerSettings *settings = entryWidget->getServerSettings();
|
||||
dataParser->createServerSettings(settings);
|
||||
|
||||
emit sigSetConnect(settings,connectionThread);
|
||||
emit sigSetConnect(settings,workerThread);
|
||||
}
|
||||
|
||||
void MainWindow::on_settingsButton_clicked()
|
||||
@@ -546,12 +544,12 @@ void MainWindow::stopLoadingMovie()
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
connectionThread->quit();
|
||||
connectionThread->wait();
|
||||
workerThread->quit();
|
||||
workerThread->wait();
|
||||
|
||||
emit sigSendXMLAnswer("DISABLE");
|
||||
|
||||
delete connectionThread;
|
||||
delete workerThread;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user