17#include <QCoreApplication>
18#include <QSharedPointer>
19#include <boost/algorithm/string.hpp>
27static std::unique_ptr<QThreadPool>
tp = {
nullptr};
35 tp = std::make_unique<QThreadPool>();
93 parent->connect(worker, SIGNAL(finished(
const FindFilesSearchResults &)), parent, SIGNAL(fileFindingFinished()),
94 Qt::QueuedConnection);
97 Qt::QueuedConnection);
99 this->connect(
this, SIGNAL(
disconnectWorkers()), worker, SLOT(disconnectWorker()), Qt::QueuedConnection);
115 QCoreApplication::sendPostedEvents();
static std::unique_ptr< QThreadPool > tp
std::function< FindFilesWorker *(const FindFilesSearchParameters &)> ThreadAllocator
void connectWorker(const QObject *parent, const FindFilesWorker *worker)
Connect worker to relevant signals/slots.
static void destroyThreadPool()
Destroy the static thread pool instance.
FindFilesThreadPoolManager()
Create a new thread pool manager for finding files.
const std::unique_ptr< QThreadPool > & poolInstance() const
Get a handle to the static file finder thread pool instance.
void setAllocator(ThreadAllocator allocator)
Set the worker object allocator for this thread pool.
void waitForDone()
Block execution and wait for all threads to finish processing.
ThreadAllocator m_workerAllocator
Handle to the allocator function for creating new worker threads.
void createWorker(const QObject *parent, const FindFilesSearchParameters ¶meters)
Create a new worker thread. This will cancel any currently running threads.
bool isSearchRunning() const
Check if a search is already in progress.
bool m_searchIsRunning
Flag set if a search is currently running.
void cancelWorker()
Cancel the currently running worker.
void searchFinished()
Mark the search as being finished.
A class to allow the asynchronous finding of files.
POD struct to hold details about the parameters of a file search.
POD struct to hold details about the results of a file search.