#ifndef UPDATECONTROLLER_H
#define UPDATECONTROLLER_H

#include "Core/sendsystem.h"
#include "Core/versioncontainer.h"
#include "fasthashcalculator.h"
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include <QXmlStreamAttribute>
#include <QCryptographicHash>
#include <QDirIterator>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
#include <QDebug>
#include <QList>
#include <QObject>
#include <QDialogButtonBox>

#include <Data\FileData.h>
#include <Data\streamingversiondata.h>
#include <Core\dataparseroutput.h>

class UpdateController : public QObject
{
    Q_OBJECT

public:
    explicit UpdateController(QObject *parent = 0);
    ~UpdateController();

    void initialize(VersionContainer *versionContainer,DataParserOutput *dataParser, SendSystem *sendSystem);
    void calculateCommonHash();
    void calculateStreamingHash();
    void updateFilesOnServer(QList<FileData> *fileSendList);
    void checkCanUpdate();

    FastHashCalculator *getHashCalculator() const;

signals:
    void sigUpdateComplete(bool flag);

private:
    SendSystem *sendSystem;
    DataParserOutput * dataParserOut;
    FastHashCalculator* hashCalculator;
    QString applicationFolderPath;
    VersionContainer *versionContainer;
    QList<FileData> appDataList;
    QList<FileData> streamingDataList;

    QList<FileData> calculateHash(const QString& path,const QString& ignoreName);
};



#endif // UPDATECONTROLLER_H
