From f8542dc96ab40b953e3b119c496286e94741b7f2 Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 6 Jun 2022 09:21:17 +0200 Subject: [PATCH] shared: Indexer: Handle keepGoing, set verbose --- shared/indexer.cpp | 21 +++++++++++++++++++-- shared/indexer.h | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/shared/indexer.cpp b/shared/indexer.cpp index 3cc7470..974fe18 100644 --- a/shared/indexer.cpp +++ b/shared/indexer.cpp @@ -59,6 +59,16 @@ void Indexer::setTargetPaths(QVector pathsToScan) this->pathsToScan = pathsToScan; } +void Indexer::setVerbose(bool verbose) +{ + this->verbose = verbose; +} + +void Indexer::setKeepGoing(bool keepGoing) +{ + this->keepGoing = keepGoing; +} + void Indexer::requestCancellation() { this->dirScanner->cancel(); @@ -96,17 +106,24 @@ void Indexer::dirScanProgress(int current, int total) void Indexer::processFileScanResult(FileScanResult result) { - if(verbose) + if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND) { this->currentIndexResult.results.append(result); + if(!keepGoing) + { + this->requestCancellation(); + emit finished(); + return; + } } else { - if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND) + if(verbose) { this->currentIndexResult.results.append(result); } } + if(result.second == OK) { ++this->currentIndexResult.addedPaths; diff --git a/shared/indexer.h b/shared/indexer.h index ccd88f3..db6aee8 100644 --- a/shared/indexer.h +++ b/shared/indexer.h @@ -67,6 +67,8 @@ class Indexer : public QObject void beginIndexing(); void setIgnorePattern(QStringList ignorePattern); void setTargetPaths(QVector pathsToScan); + void setVerbose(bool verbose); + void setKeepGoing(bool keepGoing); void requestCancellation();