shared: DirscanWorker: Use WildcardMatcher to ignore paths
Tento commit je obsažen v:
rodič
edc41d6f59
revize
a3666f283e
@ -7,7 +7,7 @@ DirScanWorker::DirScanWorker(ConcurrentQueue<QString> &queue, ConcurrentQueue<QS
|
||||
{
|
||||
this->queue = &queue;
|
||||
this->resultQueue = &resultQueue;
|
||||
this->ignorePattern = ignorePattern;
|
||||
this->wildcardMatcher.setPatterns(ignorePattern);
|
||||
this->progressReportThreshold = progressReportThreshold;
|
||||
this->stopToken = &stopToken;
|
||||
setAutoDelete(false);
|
||||
@ -24,10 +24,19 @@ void DirScanWorker::run()
|
||||
start new DirScanWorkers ourselves here... */
|
||||
while(queue->dequeue(path))
|
||||
{
|
||||
QDirIterator iterator(path, ignorePattern, QDir::Files, QDirIterator::Subdirectories);
|
||||
if(wildcardMatcher.match(path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QDirIterator iterator(path, QStringList{}, QDir::Files, QDirIterator::Subdirectories);
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
this->results.append(iterator.next());
|
||||
QString entry = iterator.next();
|
||||
if(wildcardMatcher.match(entry))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
this->results.append(entry);
|
||||
++currentProgress;
|
||||
if(currentProgress == progressReportThreshold)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QRunnable>
|
||||
#include <QDirIterator>
|
||||
#include "concurrentqueue.h"
|
||||
#include "wildcardmatcher.h"
|
||||
class DirScanWorker : public QObject, public QRunnable
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -12,7 +13,7 @@ class DirScanWorker : public QObject, public QRunnable
|
||||
ConcurrentQueue<QString> *queue = nullptr;
|
||||
ConcurrentQueue<QString> *resultQueue = nullptr;
|
||||
|
||||
QStringList ignorePattern;
|
||||
WildcardMatcher wildcardMatcher;
|
||||
QVector<QString> results;
|
||||
|
||||
std::atomic<bool> *stopToken;
|
||||
|
Načítá se…
Odkázat v novém úkolu
Zablokovat Uživatele