shared: Indexer: Handle keepGoing, set verbose
This commit is contained in:
		@@ -59,6 +59,16 @@ void Indexer::setTargetPaths(QVector<QString> pathsToScan)
 | 
				
			|||||||
	this->pathsToScan = pathsToScan;
 | 
						this->pathsToScan = pathsToScan;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Indexer::setVerbose(bool verbose)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						this->verbose = verbose;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Indexer::setKeepGoing(bool keepGoing)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						this->keepGoing = keepGoing;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Indexer::requestCancellation()
 | 
					void Indexer::requestCancellation()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	this->dirScanner->cancel();
 | 
						this->dirScanner->cancel();
 | 
				
			||||||
@@ -96,17 +106,24 @@ void Indexer::dirScanProgress(int current, int total)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Indexer::processFileScanResult(FileScanResult result)
 | 
					void Indexer::processFileScanResult(FileScanResult result)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							this->currentIndexResult.results.append(result);
 | 
				
			||||||
 | 
							if(!keepGoing)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this->requestCancellation();
 | 
				
			||||||
 | 
								emit finished();
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		if(verbose)
 | 
							if(verbose)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			this->currentIndexResult.results.append(result);
 | 
								this->currentIndexResult.results.append(result);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		if(result.second == DBFAIL || result.second == PROCESSFAIL || result.second == NOTFOUND)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			this->currentIndexResult.results.append(result);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(result.second == OK)
 | 
						if(result.second == OK)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		++this->currentIndexResult.addedPaths;
 | 
							++this->currentIndexResult.addedPaths;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,6 +67,8 @@ class Indexer : public QObject
 | 
				
			|||||||
	void beginIndexing();
 | 
						void beginIndexing();
 | 
				
			||||||
	void setIgnorePattern(QStringList ignorePattern);
 | 
						void setIgnorePattern(QStringList ignorePattern);
 | 
				
			||||||
	void setTargetPaths(QVector<QString> pathsToScan);
 | 
						void setTargetPaths(QVector<QString> pathsToScan);
 | 
				
			||||||
 | 
						void setVerbose(bool verbose);
 | 
				
			||||||
 | 
						void setKeepGoing(bool keepGoing);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void requestCancellation();
 | 
						void requestCancellation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user