1 #ifndef POPULATEMANAGER_H
2 #define POPULATEMANAGER_H
3 
4 #include "pluginservicebase.h"
5 #include "sqlitestudio.h"
6 #include <QObject>
7 #include <QHash>
8 #include <QStringList>
9 
10 class PopulatePlugin;
11 class PopulateEngine;
12 class Db;
13 
14 class API_EXPORT PopulateManager : public PluginServiceBase
15 {
16         Q_OBJECT
17 
18     public:
19         explicit PopulateManager(QObject *parent = 0);
20 
21         void populate(Db* db, const QString& table, const QHash<QString, PopulateEngine*>& engines, qint64 rows);
22 
23     private:
24         void error();
25         void deleteEngines(const QList<PopulateEngine*>& engines);
26 
27         bool workInProgress = false;
28         Db* db = nullptr;
29         QString table;
30         QStringList columns;
31         QList<PopulateEngine*> engineList;
32 
33     public slots:
34         void interrupt();
35 
36     private slots:
37         void finalizePopulating(bool result);
38 
39     signals:
40         void populatingFinished();
41         void populatingSuccessful();
42         void populatingFailed();
43         void orderWorkerToInterrupt();
44         void finishedStep(int step);
45 };
46 
47 #define POPULATE_MANAGER SQLITESTUDIO->getPopulateManager()
48 
49 #endif // POPULATEMANAGER_H
50