2018-08-12 16:45:39 +02:00
|
|
|
#ifndef PDFWORKER_H
|
|
|
|
#define PDFWORKER_H
|
|
|
|
#include <QObject>
|
|
|
|
#include <QImage>
|
|
|
|
#include <QHash>
|
2018-08-30 21:54:29 +02:00
|
|
|
#include <QThread>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QWaitCondition>
|
2018-08-12 16:45:39 +02:00
|
|
|
#include <poppler-qt5.h>
|
|
|
|
#include "pdfpreview.h"
|
|
|
|
#include "searchresult.h"
|
|
|
|
class PdfWorker : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QHash<QString, Poppler::Document *> documentcache;
|
|
|
|
Poppler::Document *document(QString path);
|
2018-08-30 21:54:29 +02:00
|
|
|
std::atomic<bool> cancelCurrent { false } ;
|
|
|
|
std::atomic<bool> generating { false };
|
|
|
|
QMutex isFreeMutex;
|
|
|
|
QWaitCondition isFree;
|
2018-08-12 16:45:39 +02:00
|
|
|
public:
|
|
|
|
PdfWorker();
|
2018-08-30 21:54:29 +02:00
|
|
|
void cancelAndWait();
|
2018-08-12 16:45:39 +02:00
|
|
|
public slots:
|
|
|
|
void generatePreviews(QVector<SearchResult> paths, double scalefactor);
|
|
|
|
signals:
|
|
|
|
void previewReady(PdfPreview p);
|
|
|
|
void previewsFinished();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PDFWORKER_H
|