Wait till pdfworker finishes before new search, cancel running

Tá an tiomantas seo le fáil i:
2018-08-30 21:54:29 +02:00
tuismitheoir 854f252dd9
tiomantas 64b2eda9e5
D'athraigh 5 comhad le 50 breiseanna agus 1 scriosta

Féach ar an gComhad

@ -3,6 +3,9 @@
#include <QObject>
#include <QImage>
#include <QHash>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <poppler-qt5.h>
#include "pdfpreview.h"
#include "searchresult.h"
@ -13,9 +16,14 @@ class PdfWorker : public QObject
private:
QHash<QString, Poppler::Document *> documentcache;
Poppler::Document *document(QString path);
std::atomic<bool> cancelCurrent{false};
std::atomic<bool> generating{false};
QMutex isFreeMutex;
QWaitCondition isFree;
public:
PdfWorker();
void cancelAndWait();
public slots:
void generatePreviews(QVector<SearchResult> paths, double scalefactor);
signals: