bugfix: versions

* refactoring call update after update from client
* refactoring common client deAuth
* add packet for notify hash calculate start
* bugfix update static data
This commit is contained in:
semenov
2025-07-23 12:32:38 +03:00
parent 82b605ae50
commit 71215cf5ec
18 changed files with 297 additions and 171 deletions

View File

@@ -20,9 +20,6 @@ QObject(parent)
mutex = new QMutex;
if (!QDir(staticDataFolderName).exists()){
QDir().mkdir(staticDataFolderName);
}
qDebug() << "ParserThread: " << QThread::currentThreadId();
}

View File

@@ -78,6 +78,7 @@ void AssetsManager::fillDatas()
}
}
}
void AssetsManager::setVersionList(QList<StreamingVersionData*> *streamingVersion)
{
datas->clear();
@@ -327,7 +328,7 @@ void AssetsManager::writeVersionsToFile(QList<StreamingVersionData*> version,boo
file.close();
}
void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> version) //TODO: переименовать и перебросить в AssetManager
void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> version)
{
QFile file(versionListFile);
QList<StreamingVersionData*> *temp = new QList<StreamingVersionData*>();

View File

@@ -142,6 +142,21 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
emit sigListsInstructorsTraineesChanged();
}
//упращенная деавторизация при выключении сервера
void ProcessingSystem::processingClientDeAutorization(QString login)
{
//Отмена авторизации в БД
if(providerDBLMS->deAuthorizationTrainee(login))
{//Деавторизовался обучаемый
}
else if(providerDBLMS->deAuthorizationInstructor(login))
{//Деавторизовался инструктор
}
}
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id, void* data)
{
qDebug() << "ProcessingQueryThread " << QThread::currentThreadId();

View File

@@ -43,6 +43,7 @@ public:
void sendListTasksAMMofTraineetoClient(ClientHandler* client, int id_trainee);
void sendListTasksFIMofTraineetoClient(ClientHandler* client, int id_trainee);
ClientHandler* getUnityClientById(int id);
void processingClientDeAutorization(QString login);
signals:
void sigUpdateListClients();
void sigListsInstructorsTraineesChanged();

View File

@@ -23,8 +23,8 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser*
this->sendSystem = sendSystem;
socket = handler->getSocket();
connect(this,&RecognizeSystem::sigCalculateHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigCalculateHash,updateController,&UpdateController::setUpCurrentServerHash,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigCalculateHash,updateController,&UpdateController::calculateFullHashWithSetup,Qt::AutoConnection);
//connect(this,&RecognizeSystem::sigCalculateHash,updateController,&UpdateController::setUpCurrentServerHash,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigChangeVersion,updateController,&UpdateController::changeAssetVersion,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigDeleteVersion,updateController,&UpdateController::deleteAssetVersion,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigCopyVersion,updateController,&UpdateController::createCopyVersion,Qt::AutoConnection);

View File

@@ -29,7 +29,7 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
connect(this,&UpdateController::sigLogMessage,logger,&Logger::addTextToLogger,Qt::AutoConnection);
calculateFullHash();
currentStreamingPath = assetManager->setVersion("base");
currentStreamingPath = assetManager->setVersion("base"); //TODO: сохрнаять предыдущую версию и загружать ее при включении
setUpCurrentServerHash();
mutex = new QMutex;
@@ -82,18 +82,28 @@ void UpdateController::showHash()
void UpdateController::calculateFullHash()
{
qDebug() << "Calculate hash...";
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
auto *list = calculateHash(buildPath);
saveHash(buildHashName,list);
calculateSharedHash();
emit sigLogMessage("Calculate hash complete");
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
qDebug() << "Calculate complete...";
}
void UpdateController::calculateFullHashWithSetup()
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_CALCULATE_START);
calculateFullHash();
setUpCurrentServerHash();
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
}
void UpdateController::saveHash(QString fileName,QList<FileData> *fileList)
{
QFile hashFile(fileName);
hashFile.open(QIODevice::WriteOnly);
hashFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
QXmlStreamWriter xmlWriter(&hashFile);
QListIterator<FileData> fileDataIterator(*fileList);

View File

@@ -36,6 +36,7 @@ public:
void compareFiles(ClientHandler* handler, QByteArray array);
void showHash();
void calculateFullHash();
void calculateFullHashWithSetup();
void calculateSharedHash();
void sendNewVersionList();
void setCurrentStreamingPath(QString path);