2022-04-14 14:58:07 +02:00
|
|
|
#ifndef FILESCANWORKER_H
|
|
|
|
#define FILESCANWORKER_H
|
|
|
|
#include <QString>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QtConcurrent>
|
|
|
|
#include <utility>
|
|
|
|
#include "paralleldirscanner.h"
|
|
|
|
#include "filesaver.h"
|
|
|
|
|
|
|
|
typedef std::pair<QString, SaveFileResult> FileScanResult;
|
|
|
|
|
|
|
|
class FileScanWorker : public QObject, public QRunnable
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
protected:
|
|
|
|
SqliteDbService *dbService;
|
|
|
|
ConcurrentQueue<QString> *queue;
|
2023-01-08 17:37:28 +01:00
|
|
|
FileSaverOptions fileSaverOptions;
|
2022-04-14 14:58:07 +02:00
|
|
|
int batchsize;
|
2022-04-15 21:06:19 +02:00
|
|
|
std::atomic<bool> *stopToken;
|
2022-04-14 14:58:07 +02:00
|
|
|
|
|
|
|
public:
|
2022-04-15 21:06:19 +02:00
|
|
|
FileScanWorker(SqliteDbService &db, ConcurrentQueue<QString> &queue, int batchsize, std::atomic<bool> &stopToken);
|
2022-04-14 14:58:07 +02:00
|
|
|
void run() override;
|
2023-01-08 17:37:28 +01:00
|
|
|
void setFileSaverOptions(FileSaverOptions options);
|
2022-04-14 14:58:07 +02:00
|
|
|
signals:
|
|
|
|
void result(FileScanResult);
|
|
|
|
void finished();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FILESCANWORKER_H
|