ref: instructor Button

* fix streamingHash path
* fix instructor button position
* change return fileList style
This commit is contained in:
semenov
2024-12-12 11:16:52 +03:00
parent 15a0535a3a
commit db8023eb74
14 changed files with 353 additions and 65 deletions

View File

@@ -8,35 +8,34 @@ UpdateController::UpdateController(DataParser *parser,SendSystem *sendSystem, QO
this->dataParser = parser;
this->sendSystem = sendSystem;
applicationFolderPath = QDir::currentPath() + applicationFolderName;
//calculateStreamingHash();
}
void UpdateController::calculateCommonHash()
{
fileDataList.clear();
calculateHash(applicationFolderPath);
dataParser->createFileDataList(fileDataList,hashFilename);
appDataList.clear();
appDataList = calculateHash(applicationFolderPath);
calculateStreamingHash();
dataParser->createFileDataList(appDataList,hashFilename);
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
}
void UpdateController::calculateStreamingHash()
{
fileDataList.clear();
calculateHash(QDir::currentPath() + streamingAssetsPath);
dataParser->createFileDataList(fileDataList,streamingHashFilename);
streamingDataList.clear();
streamingDataList = calculateHash(QDir::currentPath() + streamingAssetsPath);
dataParser->createFileDataList(appDataList,streamingHashFilename);
}
void UpdateController::calculateHash(QString path)
QList<FileData> UpdateController::calculateHash(QString path)
{
qDebug() << "Try calculate";
QDir dir(path);
QDirIterator iterator(dir,QDirIterator::Subdirectories);
fileDataList.clear();
QList<FileData> *files = new QList<FileData>;
QList<FileData> *folders = new QList<FileData>;
QList<FileData> *hashes = new QList<FileData>;
if(!QDir(path).exists()){ //проверка на наличие папки
if(!QDir(path).exists())
{ //проверка на наличие папки
QDir().mkdir(path);
}
@@ -68,12 +67,10 @@ void UpdateController::calculateHash(QString path)
readSize = qMin(fileSize,bufferSize);
}
hashString = QString(hash.result().toHex());
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
currentFile.hash = hashString;
files->push_back(currentFile);
hashes->push_back(currentFile);
file.close();
}
else if (fileInfo.isDir() && !fileInfo.isRoot() && fileInfo.fileName() != "..")
@@ -81,19 +78,15 @@ void UpdateController::calculateHash(QString path)
currentFile.path = Tools::createLocalPath(fileInfo.path());
currentFile.hash = "FOLDER";
if(!folders->contains(currentFile)){
folders->push_back(currentFile);
if(!hashes->contains(currentFile))
{
hashes->push_back(currentFile);
}
}
}
fileDataList.append(*folders);
fileDataList.append(*files);
delete folders;
delete files;
return *hashes;
}
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){