mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
72 lines
1.6 KiB
C++
72 lines
1.6 KiB
C++
#include "hashcomparer.h"
|
|
|
|
#include <QCoreApplication>
|
|
#include <updatenotifywidget.h>
|
|
|
|
|
|
HashComparer::HashComparer(DataParser *dataParser,QObject *parent)
|
|
{
|
|
this->dataParser = dataParser;
|
|
this->updateWidget = updateWidget;
|
|
}
|
|
|
|
void HashComparer::CompareDeltas()
|
|
{
|
|
QList<FileData> *serverStreamingHash = new QList<FileData>;
|
|
QList<FileData> *localStreamingHash = new QList<FileData>;
|
|
|
|
QFile file(serverHash);
|
|
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
|
|
serverStreamingHash = dataParser->xmlFileDataParse(file.readAll(),"StreamingAssets");
|
|
file.close();
|
|
|
|
QFile file2(streamingHashFilename);
|
|
file2.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
|
|
localStreamingHash = dataParser->xmlFileDataParse(file2.readAll(),"StreamingAssets");
|
|
file2.close();
|
|
|
|
QMutableListIterator<FileData> iterator(*localStreamingHash);
|
|
|
|
for (auto &item:*localStreamingHash)
|
|
{
|
|
if(serverStreamingHash->contains(item))
|
|
{
|
|
serverStreamingHash->removeOne(item);
|
|
localStreamingHash->removeOne(item);
|
|
}
|
|
}
|
|
|
|
filesForUpdate = localStreamingHash;
|
|
showDeltas();
|
|
}
|
|
|
|
void HashComparer::showDeltas()
|
|
{
|
|
|
|
if (filesForUpdate->length() <= 0)
|
|
{
|
|
emit sigCallCheck();
|
|
return;
|
|
}
|
|
for (auto &item:*filesForUpdate)
|
|
{
|
|
updateWidget->addToList(item);
|
|
}
|
|
|
|
updateWidget->setUpdateList(filesForUpdate);
|
|
updateWidget->show();
|
|
updateWidget->activateWindow();
|
|
}
|
|
|
|
void HashComparer::setWidget(UpdateNotifyWidget* updateWidget)
|
|
{
|
|
this->updateWidget = updateWidget;
|
|
}
|
|
|
|
HashComparer::~HashComparer()
|
|
{
|
|
|
|
}
|