feat: add client information

This commit is contained in:
semenov
2025-11-20 17:20:52 +03:00
parent 633881847b
commit 6665f417c9
12 changed files with 11023 additions and 10881 deletions

View File

@@ -4,7 +4,7 @@ CoreManager::CoreManager(QObject *parent) :
QObject(parent),
isRecovery(false)
{
client = new TCPClient;
tcpClient = new TCPClient;
dataParser = new DataParser;
dataParserOutput = new DataParserOutput;
updateController = new UpdateController;
@@ -16,6 +16,7 @@ CoreManager::CoreManager(QObject *parent) :
versionContainer = new VersionContainer;
resourceManager = new ResourceManager;
postProcessorSystem = new PostProcessorSystem;
client = new Client;
}
void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
@@ -23,7 +24,7 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
this->workerThread = workerThread;
this->widgetManager = widgetManager;
client->moveToThread(workerThread);
tcpClient->moveToThread(workerThread);
dataParser->moveToThread(workerThread);
dataParserOutput->moveToThread(workerThread);
sendSystem->moveToThread(workerThread);
@@ -31,11 +32,8 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
recognizeSystem->moveToThread(workerThread);
postProcessorSystem->moveToThread(workerThread);
hashComparer->moveToThread(workerThread);
// versionContainer->moveToThread(workerThread); //проверить работоспособность
// resourceManager->moveToThread(workerThread); //проверить работоспособность
workerThread->start();
//workerThread->setPriority(QThread::HighestPriority);
binding();
initializeSystems();
@@ -64,15 +62,15 @@ void CoreManager::binding()
{
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,widgetManager,&WidgetManager::slotActivateLoadAnimation,Qt::AutoConnection);
connect(this,&CoreManager::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
connect(this,&CoreManager::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
connect(this,&CoreManager::sigInitializeClient,tcpClient,&TCPClient::initialize,Qt::AutoConnection);
connect(this,&CoreManager::sigSetConnect,tcpClient,&TCPClient::setConnect,Qt::AutoConnection);
connect(this,&CoreManager::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
connect(this,&CoreManager::sigSendCheckUpdate,sendSystem,&SendSystem::sendCheckHash,Qt::AutoConnection);
connect(this,&CoreManager::sigSendXMLAnswer,sendSystem,&SendSystem::xmlAnswer,Qt::AutoConnection);
connect(this,&CoreManager::sigSendAutorization,sendSystem,&SendSystem::sendClientAutorization);
connect(this,&CoreManager::sigSendUpdateToServer,updateController,&UpdateController::checkCanUpdate,Qt::AutoConnection);
connect(this,&CoreManager::sigGetConnected,client,&TCPClient::getIsConnected);
connect(this,&CoreManager::sigGetConnected,tcpClient,&TCPClient::getIsConnected);
connect(this,&CoreManager::sigCalculateHash,updateController,&UpdateController::calculateCommonHash);
connect(this,&CoreManager::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
@@ -101,8 +99,8 @@ void CoreManager::binding()
connect(updateController,&UpdateController::sigUpdateComplete,widgetManager,&WidgetManager::setCompeteState,Qt::AutoConnection);
connect(updateController->getHashCalculator(),&FastHashCalculator::sigSendHashInfo,widgetManager->getMainWindow(),&MainWindow::updateInitInformation,Qt::AutoConnection);
connect(client,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);
connect(client,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);
connect(tcpClient,&TCPClient::sigConnectionState,widgetManager,&WidgetManager::setConnectionState,Qt::AutoConnection);
connect(tcpClient,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
@@ -116,7 +114,7 @@ void CoreManager::initializeSystems()
hashComparer->initialize(versionContainer,widgetManager->getUpdateWidget());
postProcessorSystem->initialize(dataParserOutput,hashComparer,versionContainer,updateController);
dataParser->initialize(postProcessorSystem);
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem);
recognizeSystem->initialize(dataParser,versionContainer,postProcessorSystem,client);
resourceManager->painting();
emit sigCalculateHash();
@@ -168,6 +166,7 @@ void CoreManager::callUpdateList()
void CoreManager::lostConnection()
{
widgetManager->setLostConnectionState();
client->setIsLoggedIn(false);
}
void CoreManager::serverBlocked()
@@ -201,16 +200,19 @@ void CoreManager::checkLoginResult(ServerAuthorization *auth)
setLocalVersion();
widgetManager->setLoginSuccess();
widgetManager->getMainWindow()->setClientVersionName(versionContainer->getLocalVersion());
client->setLogin(auth->ClientName);
client->setIsLoggedIn(true);
}
else
{
widgetManager->setLoginFailed();
client->setIsLoggedIn(false);
}
}
void CoreManager::tryLogin()
{
if (!client->getIsConnected())
if (!tcpClient->getIsConnected())
{
widgetManager->getMainWindow()->showConnectionEmpty();
return;
@@ -362,10 +364,10 @@ void CoreManager::saveServerSettingsWithConnect()
settings->LocalVersionName = dataParser->getClientSettings()->LocalVersionName;
dataParserOutput->createServerSettings(settings);
if(client->getIsConnected())
if(tcpClient->getIsConnected())
{
emit sigSendXMLAnswer(cmd_Disable);
client->setDisconnect();
tcpClient->setDisconnect();
entryWidget->showLoginWidget(true);
widgetManager->getMainWindow()->showOfflineButton(true);
widgetManager->activateLoadingAnimation(false);
@@ -398,7 +400,7 @@ void CoreManager::setLanguage(const QString& language)
void CoreManager::exit()
{
emit sigSendXMLAnswer(cmd_Disable);
client->disconnect();
tcpClient->disconnect();
workerThread->quit();
workerThread->wait();