summaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/dialogs/importdialog.h
blob: b4c2883d2f5e36de486ec44af7e841b3de32d94b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef IMPORTDIALOG_H
#define IMPORTDIALOG_H

#include "guiSQLiteStudio_global.h"
#include <QWizard>

namespace Ui {
    class ImportDialog;
}

class DbListModel;
class DbObjListModel;
class ImportPlugin;
class ConfigMapper;
class CfgEntry;
class WidgetCover;
class Db;

class GUI_API_EXPORT ImportDialog : public QWizard
{
        Q_OBJECT

    public:
        explicit ImportDialog(QWidget *parent = 0);
        ~ImportDialog();

        void setDbAndTable(Db* db, const QString& table);
        void setDb(Db* db);

    protected:
        void showEvent(QShowEvent* e);
        void keyPressEvent(QKeyEvent* e);

    private:
        void init();
        void initTablePage();
        void initDataSourcePage();
        void removeOldOptions();
        void updateStandardOptions();
        void updatePluginOptions(int& rows);
        bool isPluginConfigValid() const;

        Ui::ImportDialog *ui = nullptr;
        DbListModel* dbListModel = nullptr;
        DbObjListModel* tablesModel = nullptr;
        ConfigMapper* configMapper = nullptr;
        QWidget* pluginOptionsWidget = nullptr;
        ImportPlugin* currentPlugin = nullptr;
        QHash<CfgEntry*,bool> pluginConfigOk;
        WidgetCover* widgetCover = nullptr;

    private slots:
        void handleValidationResultFromPlugin(bool valid, CfgEntry* key, const QString& errorMsg);
        void stateUpdateRequestFromPlugin(CfgEntry* key, bool visible, bool enabled);
        void refreshTables();
        void pluginSelected();
        void updateValidation();
        void pageChanged();
        void browseForInputFile();
        void success();
        void hideCoverWidget();

    public slots:
        void accept();

    signals:
        void dsPageCompleteChanged();
};

#endif // IMPORTDIALOG_H