feat: add version container

This commit is contained in:
semenov
2024-12-27 10:43:26 +03:00
parent 9ac5b46030
commit 2944f2d510
85 changed files with 1875 additions and 632 deletions

View File

@@ -26,11 +26,13 @@ void RecognizeSystem::initialize(UpdateController *updateController,
DataParser *dataParser,
MainWindow *mainWindow,
HashComparer *hashComparer,
TCPClient *client)
TCPClient *client,
VersionContainer* versionContainer)
{
this->updateController = updateController;
this->dataParser = dataParser;
this->mainWindow = mainWindow;
this->versionContainer = versionContainer;
connect(this,&RecognizeSystem::sigSaveLoginData,dataParser,&DataParser::createAuthData);
connect(this,&RecognizeSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas);
@@ -83,7 +85,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
continue;
}
filePath = Tools::createReceiveFullPath(filePath,updateController->getServerVersion());
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
QDir dir(filePath);
if(!dir.exists()){
@@ -118,7 +120,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
}
filePath = Tools::createReceiveFullPath(filePath,updateController->getServerVersion());
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
emit sigSendDebugLog("CLIENT: filesize: " + QString::number(fileSize));
emit sigSendDebugLog("CLIENT: filePath: " + filePath);
@@ -201,7 +203,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
continue;
}
filePath = Tools::createReceiveFullPath(filePath,updateController->getServerVersion());
filePath = Tools::createReceiveFullPath(filePath,versionContainer->getServerVersionData());
QFileInfo fileInfo(filePath);
@@ -227,7 +229,8 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
}
if(packetType ==PacketType::TYPE_FINISH){ //для повторного создания хэша после загрузки
if (packetType ==PacketType::TYPE_FINISH) //для повторного создания хэша после загрузки
{
updateController->calculateCommonHash();
emit sigLoadComplete();
packetType = PacketType::TYPE_NONE;
@@ -238,17 +241,19 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
bool flag = false;
quint64 size = 0;
quint64 fileCount = 0;
quint64 fileDelete = 0;
stream.startTransaction();
stream >> flag;
stream >> size;
stream >> fileCount;
stream >> fileDelete;
if(!stream.commitTransaction()){
continue;
}
emit sigNeedUpdate(flag,size,fileCount);
emit sigNeedUpdate(flag,size,fileCount,fileDelete);
packetType = PacketType::TYPE_NONE;
}
@@ -284,9 +289,7 @@ void RecognizeSystem::checkAccessType(QString type)
void RecognizeSystem::setServerVersion(StreamingVersionData *serverVersion)
{
dataParser->changeVersion(serverVersion->getViewName());
updateController->setServerVersion(serverVersion);
mainWindow->setCurrentVersionName(serverVersion->getViewName());
versionContainer->setServerVersonData(serverVersion);
}
void RecognizeSystem::showServerDataList(QList<StreamingVersionData*> *showServerDataList)