Introduce FileSaverOptions to consolidate common parameters

This commit is contained in:
2023-01-08 17:37:28 +01:00
parent efca45b88a
commit 4b1522b82a
11 changed files with 77 additions and 53 deletions

View File

@ -71,9 +71,16 @@ int CommandAdd::handle(QStringList arguments)
}
}
FileSaverOptions fileSaverOptions;
fileSaverOptions.keepGoing = keepGoing;
fileSaverOptions.fillPathsOnlyWithContent = fillContent;
fileSaverOptions.pathsOnly = pathsOnly;
fileSaverOptions.verbose = false;
indexer = new Indexer(*this->dbService);
indexer->setFileSaverOptions(fileSaverOptions);
indexer->setTargetPaths(files.toVector());
indexer->setKeepGoing(keepGoing);
connect(indexer, &Indexer::pathsCountChanged, this,
[](int pathsCount) { Logger::info() << "Found paths: " << pathsCount << Qt::endl; });

View File

@ -40,8 +40,12 @@ int CommandUpdate::handle(QStringList arguments)
bool hasErrors = false;
IndexSyncer *syncer = new IndexSyncer(*this->dbService);
syncer->setKeepGoing(keepGoing);
syncer->setVerbose(verbose);
FileSaverOptions fileOptions;
fileOptions.keepGoing = keepGoing;
fileOptions.verbose = verbose;
syncer->setFileSaverOptions(fileOptions);
syncer->setPattern(pattern);
syncer->setDryRun(dryRun);
syncer->setRemoveDeletedFromIndex(deleteMissing);