#include "hashcomparer.h" #include #include HashComparer::HashComparer(DataParser *dataParser,QObject *parent) { this->dataParser = dataParser; this->updateWidget = updateWidget; } void HashComparer::CompareDeltas() { QList *serverStreamingHash = new QList; QList *localStreamingHash = new QList; 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 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); } emit sigHaveDelta(); } void HashComparer::setWidget(UpdateNotifyWidget* updateWidget) { this->updateWidget = updateWidget; } QList *HashComparer::getFilesForUpdate() const { return filesForUpdate; } HashComparer::~HashComparer() { }