ref: draft

This commit is contained in:
semenov
2025-08-11 16:37:12 +03:00
parent 0ba99d6149
commit c993e12b84
37 changed files with 717 additions and 612 deletions

View File

@@ -51,16 +51,22 @@ void MainWindow::createObjects()
dataParser = new DataParser;
dataParser->moveToThread(workerThread);
dataParserOutput = new DataParserOutput;
dataParser->moveToThread(workerThread);
sendSystem = new SendSystem;
sendSystem->moveToThread(workerThread);
updateController = new UpdateController(dataParser,sendSystem);
updateController = new UpdateController(dataParserOutput,sendSystem);
updateController->moveToThread(workerThread);
recognizeSystem = new RecognizeSystem;
recognizeSystem->moveToThread(workerThread);
screenChecker = new ScreenChecker(this,dataParser,ui->displayLayout);
postProcessorSystem = new PostProcessorSystem;
postProcessorSystem->moveToThread(workerThread);
screenChecker = new ScreenChecker(this,dataParserOutput,ui->displayLayout);
externalExecuter = new ExternalExecuter;
hashComparer = new HashComparer(dataParser);
@@ -73,8 +79,6 @@ void MainWindow::createObjects()
workerThread->setPriority(QThread::HighestPriority);
timer = new QTimer;
}
void MainWindow::paintEvent(QPaintEvent* event) {
@@ -99,16 +103,15 @@ void MainWindow::initialize()
loadStaticData();
bindConnection();
updateWidget->initialize(this,versionContainer);
entryWidget->initialize(this);
updateWidget->initialize(versionContainer,pos());
entryWidget->initialize();
versionSelectWidget->initialize(sendSystem,versionContainer,notifyController);
hashComparer->initialize(this,versionContainer);
updateController->initialize(this,versionContainer);
sendSystem->initialize(this,dataParser);
dataParser->initialize(recognizeSystem,notifyController,updateController,hashComparer);
recognizeSystem->initialize(updateController,dataParser,this,hashComparer,client,versionContainer);
hashComparer->initialize(versionContainer);
updateController->initialize(versionContainer);
dataParser->initialize();
recognizeSystem->initialize(versionContainer,postProcessorSystem);
resourceManager->painting();
commonButtonGroupWidget->initialize(this,externalExecuter,sendSystem,client);
commonButtonGroupWidget->initialize(externalExecuter,sendSystem,client);
commonButtonGroupWidget->show();
ui->LanguageWidget->hide();
@@ -116,7 +119,7 @@ void MainWindow::initialize()
setInlineDebug(tr("Инициализация..."));
emit sigCalculateHash();
emit sigInitializeClient(this,recognizeSystem,externalExecuter,sendSystem,workerThread);
emit sigInitializeClient(recognizeSystem,externalExecuter,sendSystem);
screenChecker->check();
@@ -144,7 +147,53 @@ void MainWindow::bindConnection()
connect(this,&MainWindow::sigSendCheckUpdate,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
connect(this,&MainWindow::sigGetConnected,client,&TCPClient::getIsConnected);
connect(this,&MainWindow::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&MainWindow::callUpdateList,Qt::AutoConnection);
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&MainWindow::lostConnection,Qt::AutoConnection);
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&MainWindow::serverBlocked,Qt::AutoConnection);
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection); // ОПАСНОСТЬ
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&MainWindow::checkLoginResult,Qt::AutoConnection);
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,dataParserOutput,&DataParserOutput::createAuthData,Qt::AutoConnection);
connect(postProcessorSystem,&PostProcessorSystem::sigShowServerList,this,&MainWindow::showServerListWidget);
connect(postProcessorSystem,&PostProcessorSystem::sigShowUpdateList,this,&MainWindow::showUpdateInfo,Qt::AutoConnection);
connect(versionContainer,&VersionContainer::sigSetServerVersion,this,&MainWindow::setServerVersion);
connect(recognizeSystem,&RecognizeSystem::sigUpdateBytesAvailable,this,&MainWindow::updateProgress,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigLoadComplete,this,&MainWindow::loadComplete);
connect(recognizeSystem,&RecognizeSystem::sigNeedUpdate,this,&MainWindow::setNeedUpdate);
connect(recognizeSystem,&RecognizeSystem::sigCheckUpdate,this,&MainWindow::checkUpdate,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigSetInineDebug,this,&MainWindow::setInlineDebug,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,this,&MainWindow::activateLoadingAnimation,Qt::AutoConnection);
connect(updateWidget,&UpdateNotifyWidget::sigLoadToServerBehaviour,this,&MainWindow::loadToServer,Qt::AutoConnection);
connect(updateWidget,&UpdateNotifyWidget::sigUndoCurrentChanges,this,&MainWindow::undoCurrentChanges,Qt::AutoConnection);
connect(updateWidget,&UpdateNotifyWidget::sigStartUnityClient,this,&MainWindow::startUnityClient,Qt::AutoConnection);
connect(updateWidget,&UpdateNotifyWidget::sigShowMainFrame,this,&MainWindow::showMainFrame,Qt::AutoConnection);
connect(hashComparer,&HashComparer::sigCallCheck,this,&MainWindow::checkUpdate);
connect(hashComparer,&HashComparer::sigHaveDelta,this,&MainWindow::showUpdateInfo);
connect(updateController,&UpdateController::sigUpdateComplete,this,&MainWindow::showCompleteDialogBox);
connect(client,&TCPClient::sigConnectionState,this,&MainWindow::slotConnectionState,Qt::AutoConnection);
connect(client,&TCPClient::sigServerDisconnect,this,&MainWindow::slotServerDisconnect);
connect(sendSystem,&SendSystem::sigSend,this,&MainWindow::updateProgress);
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);//ОПАСНОСТЬ
connect(commonButtonGroupWidget,&CommonButtonGroupWidget::sigUpdateCommonWidget,this,&MainWindow::commonWidgetState);
connect(entryWidget,&EntryWidget::sigTryLogin,this,&MainWindow::login,Qt::AutoConnection);
connect(entryWidget,&EntryWidget::sigSaveServerSettings,this,&MainWindow::saveServerSettingsWithConnect,Qt::AutoConnection);
connect(instructorButtonGroup,&InstructorButtonGroupWidget::sigLoadToServer,this,&MainWindow::loadToServer, Qt::AutoConnection);
connect(instructorButtonGroup,&InstructorButtonGroupWidget::sigUndoCurrentChanges,this,&MainWindow::undoCurrentChanges, Qt::AutoConnection);
connect(instructorButtonGroup,&InstructorButtonGroupWidget::sigStartUnityClient,this,&MainWindow::startUnityClient, Qt::AutoConnection);
connect(dataParser,&DataParser::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);//ОПАСНОСТЬ
connect(dataParser,&DataParser::sigUpdateFilesOnServer,updateController,&UpdateController::updateFilesOnServer,Qt::AutoConnection);//ОПАСНОСТЬ
}
void MainWindow::updateProgress()
@@ -164,7 +213,7 @@ void MainWindow::loadComplete()
ui->autostartCheckBox->hide();
ui->offlineStartButton->show();
dataParser->changeVersion(versionContainer->getServerVersionData());
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
setTitle();
}
@@ -206,7 +255,7 @@ void MainWindow::setNeedUpdate(bool flag,quint64 size, quint64 fileCount,quint64
commonButtonGroupWidget->lastVerInstalledState();
ui->unsafeChangingButton->hide();
ui->offlineStartButton->setEnabled(true);
dataParser->changeVersion(versionContainer->getServerVersionData());
dataParserOutput->changeVersion(versionContainer->getServerVersionData());
activateLoadingAnimation(false);
setTitle();
}
@@ -251,7 +300,7 @@ void MainWindow::checkLoginResult(ServerAuthorization *serverAuth)
emit sigSendXMLAnswer(cmd_CheckVersionList);
}
dataParser->createAuthData(serverAuth);
dataParserOutput->createAuthData(serverAuth);
entryWidget->loginIsActive(false);
//ui->LanguageWidget->hide();
ui->settingsButton->hide();
@@ -411,7 +460,7 @@ void MainWindow::login()
entryWidget->loginIsActive(false);
ClientAutorization *autorization = entryWidget->getAuthData();
dataParser->createAuthMessage(autorization);
dataParserOutput->createAuthMessage(autorization);
emit sigSendAutorization();
}
@@ -422,7 +471,7 @@ void MainWindow::saveServerSettingsWithConnect()
entryWidget->isActive(false);
ServerSettings *settings = entryWidget->getServerSettings();
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
dataParser->createServerSettings(settings);
dataParserOutput->createServerSettings(settings);
if(client->getIsConnected())
{
@@ -449,7 +498,7 @@ void MainWindow::on_settingsButton_clicked()
void MainWindow::on_languageComboBox_activated(const QString &arg1)
{
qDebug() << arg1;
dataParser->saveClientSettrings(arg1,ui->autostartCheckBox->isChecked());
dataParserOutput->saveClientSettrings(arg1,ui->autostartCheckBox->isChecked());
checkLanguage(arg1);
ui->retranslateUi(this);
}
@@ -577,6 +626,12 @@ void MainWindow::setUpUi()
activateLoadingAnimation(true);
}
void MainWindow::commonWidgetState()
{
disableUnsaveButton(true);
setInlineDebug(tr("Загрузка..."));
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
@@ -630,7 +685,7 @@ void MainWindow::on_offlineStartButton_clicked()
QString username = "offlineUser";
QString password = "000000";
dataParser->createAuthDataOffline(username,password);
dataParserOutput->createAuthDataOffline(username,password);
startUnityClient();