mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
ref: instructor Button
* fix streamingHash path * fix instructor button position * change return fileList style
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -39,9 +39,10 @@ private:
|
||||
DataParser *dataParser;
|
||||
SendSystem *sendSystem;
|
||||
QString applicationFolderPath;
|
||||
QList<FileData> fileDataList;
|
||||
QList<FileData> appDataList;
|
||||
QList<FileData> streamingDataList;
|
||||
|
||||
void calculateHash(QString path);
|
||||
QList<FileData> calculateHash(QString path);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user