shared: Introduce IndexSyncer, containing logic of cli/CommandUpdate

IndexSyncer contains most of the logic of cli/CommandUpdate, so
it can be reused in the GUI where we need it too
This commit is contained in:
2022-06-03 10:06:03 +02:00
parent 86d629c957
commit abc126548b
3 ha cambiato i file con 156 aggiunte e 0 eliminazioni

36
shared/indexsyncer.h Normal file
Vedi File

@ -0,0 +1,36 @@
#ifndef INDEXSYNCER_H
#define INDEXSYNCER_H
#include "sqlitedbservice.h"
class IndexSyncer : public QObject
{
Q_OBJECT
private:
SqliteDbService *dbService = nullptr;
bool keepGoing = true;
bool removeDeletedFromIndex = true;
bool dryRun = false;
bool verbose = false;
QString pattern;
public:
IndexSyncer(SqliteDbService &dbService);
public slots:
void sync();
void setDryRun(bool dryRun);
void setVerbose(bool verbose);
void setKeepGoing(bool keepGoing);
void setRemoveDeletedFromIndex(bool removeDeletedFromIndex);
void setPattern(QString pattern);
signals:
void error(QString error);
void removed(QString path);
void removedDryRun(QString path);
void updatedDryRun(QString path);
void updated(QString path);
void finished(unsigned int totalUpdated, unsigned int totalDeleted, unsigned int totalErrored);
};
#endif // INDEXSYNCER_H