#ifndef UPDATECONTROLLER_H
#define UPDATECONTROLLER_H


#include "Core\FileData.h"
#include "Core\dataparser.h"
#include "Core\tcpclient.h"
#include "streamingversiondata.h"
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include <QXmlStreamAttribute>
#include <QCryptographicHash>
#include <QDirIterator>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
#include <QDebug>
#include <QList>
#include <QObject>

class SendSystem;
class MainWindow;
class DataParser;

class UpdateController : public QObject
{

    Q_OBJECT

public:
    explicit UpdateController(DataParser *parser,SendSystem *sendSystem,QObject *parent = 0);
    void initialize(MainWindow *mainWindow);
    void calculateCommonHash();
    void calculateStreamingHash();
    void setServerVersion(StreamingVersionData *version);
    ~UpdateController();

    void updateFilesOnServer(QList<FileData> *fileSendList);

    StreamingVersionData *getServerVersion() const;

signals:
    void sigUpdateComplete(bool flag);
private:
    DataParser *dataParser;
    SendSystem *sendSystem;
    QString applicationFolderPath;
    QList<FileData> appDataList;
    QList<FileData> streamingDataList;
    StreamingVersionData *serverVersion;

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



#endif // UPDATECONTROLLER_H
