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 71 72 73 74 75 76 77 78 79 80 81 82
|
#ifndef POPULATEDIALOG_H
#define POPULATEDIALOG_H
#include "guiSQLiteStudio_global.h"
#include <QDialog>
#include <QVariant>
namespace Ui {
class PopulateDialog;
}
class PopulatePlugin;
class PopulateEngine;
class QGridLayout;
class DbListModel;
class DbObjListModel;
class Db;
class QComboBox;
class QCheckBox;
class QToolButton;
class QSignalMapper;
class WidgetCover;
class GUI_API_EXPORT PopulateDialog : public QDialog
{
Q_OBJECT
public:
explicit PopulateDialog(QWidget *parent = 0);
~PopulateDialog();
void setDbAndTable(Db* db, const QString& table);
private:
struct GUI_API_EXPORT ColumnEntry
{
ColumnEntry(const QString& column, QCheckBox* check, QComboBox* combo, QToolButton* button);
~ColumnEntry();
QString column;
QCheckBox* check = nullptr;
QComboBox* combo = nullptr;
QToolButton* button = nullptr;
PopulateEngine* engine = nullptr;
PopulatePlugin* plugin = nullptr;
};
void init();
PopulateEngine* getEngine(int selectedPluginIndex);
void deleteEngines(const QList<PopulateEngine*>& engines);
void rebuildEngines(const QHash<QString, QPair<QString, QVariant> >& columnConfig);
Ui::PopulateDialog *ui = nullptr;
QGridLayout* columnsGrid = nullptr;
DbListModel* dbListModel = nullptr;
DbObjListModel* tablesModel = nullptr;
Db* db = nullptr;
QStringList pluginTitles;
QList<PopulatePlugin*> plugins;
QHash<QString,PopulatePlugin*> pluginByName;
QList<ColumnEntry> columnEntries;
QSignalMapper* checkMapper = nullptr;
QSignalMapper* buttonMapper = nullptr;
QHash<int,bool> columnsValid;
WidgetCover* widgetCover = nullptr;
bool started = false;
private slots:
void refreshTables();
void refreshColumns();
void pluginSelected(int index);
void pluginSelected(QComboBox* combo, int index, const QVariant& config);
void configurePlugin(int index);
void updateColumnState(int index, bool updateGlobalState = true);
void updateState();
void finished();
public:
void accept();
void reject();
};
#endif // POPULATEDIALOG_H
|