fead: load without animation

This commit is contained in:
semenov
2024-09-19 11:11:20 +03:00
parent f2163b97b5
commit a1a103ae1e
65 changed files with 5618 additions and 865 deletions

View File

@@ -1,19 +1,37 @@
#include "UpdateController.h"
UpdateController::UpdateController(DataParser *parser, QObject *parent) :
#include <QDialogButtonBox>
UpdateController::UpdateController(DataParser *parser,SendSystem *sendSystem, QObject *parent) :
QObject(parent)
{
this->dataParser = parser;
this->sendSystem = sendSystem;
localPath = QDir::currentPath() + applicationFolderName;
}
void UpdateController::calculateCommonHash()
{
fileDataList.clear();
calculateHash(localPath);
dataParser->createFileDataList(fileDataList,hashFilename);
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
qDebug() << " OR " << thread();
}
void UpdateController::calculateHash()
void UpdateController::calculateStreamingHash()
{
fileDataList.clear();
calculateHash(QDir::currentPath() + streamingAssetsPath);
dataParser->createFileDataList(fileDataList,streamingHashFilename);
}
void UpdateController::calculateHash(QString path)
{
qDebug() << "Try calculate";
QDirIterator iterator(localPath,QDirIterator::Subdirectories);
QDirIterator iterator(path,QDirIterator::Subdirectories);
fileDataList.clear();
QList<FileData> *files = new QList<FileData>;
QList<FileData> * folders = new QList<FileData>;
@@ -22,7 +40,7 @@ void UpdateController::calculateHash()
QDir().mkdir(applicationFolderName);
}
QDir dir(localPath);
QDir dir(path);
QString hashString;
while (iterator.hasNext())
@@ -50,6 +68,9 @@ void UpdateController::calculateHash()
hash.addData(buffer,bytesRead);
readSize = qMin(fileSize,bufferSize);
}
file.close();
hashString = QString(hash.result().toHex());
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
currentFile.hash = hashString;
@@ -70,13 +91,42 @@ void UpdateController::calculateHash()
fileDataList.append(*folders);
fileDataList.append(*files);
dataParser->createXML(fileDataList);
delete folders;
delete files;
}
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
QListIterator<FileData> serverIterator(*fileSendList);
try {
while(serverIterator.hasNext())
{
FileData data = serverIterator.next();
if (data.hash == "FOLDER")
{
sendSystem->sendFolderBlock(data.path);
}
else
{
sendSystem->sendFileBlock(data.path);
}
}
calculateCommonHash();
sendSystem->sendFinish();
emit sigUpdateComplete(true);
}
catch (...)
{
emit sigUpdateComplete(false);
}
}
UpdateController::~UpdateController()