#ifndef FASTHASHCALCULATOR_H
#define FASTHASHCALCULATOR_H

#include <QHash>
#include <QMutex>
#include <QObject>
#include <QFile>
#include <QDirIterator>
#include <Data/FileData.h>
#include "tools.h"


class FastHashCalculator : public QObject
{
    Q_OBJECT
public:
    explicit FastHashCalculator(QObject *parent = nullptr);
    void calculateHashes(const QString& path, const QString& ignoreName);
    QList<FileData> *getHashList() const;

signals:
    void sigSendHashInfo(QString fullSize,QString current);
    void finished();

private:
    QByteArray calculateFileHashOptimized(const QString &filePath);
    void calculateSingleHash(const QString &filePath);

    QList<FileData>* hashList;
    QMutex _mutex;
    QString fullSize;
    quint64 currentSize;

    quint64 getDirectorySize(const QString &path);
    void hashCounterDisplay(quint64 size);
};

#endif // FASTHASHCALCULATOR_H
