blob: b2c0d68cda5d60d32d683538e4966ef313c8ec4e (
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#ifndef DBDIALOG_H
#define DBDIALOG_H
#include "db/db.h"
#include "db/dbpluginoption.h"
#include "guiSQLiteStudio_global.h"
#include <QDialog>
#include <QList>
#include <QHash>
#include <QStringList>
class DbPlugin;
class QGridLayout;
struct DbPluginOption;
namespace Ui {
class DbDialog;
}
class GUI_API_EXPORT DbDialog : public QDialog
{
Q_OBJECT
public:
enum Mode
{
ADD,
EDIT
};
DbDialog(Mode mode, QWidget *parent = 0);
~DbDialog();
void setDb(Db* db);
void setPermanent(bool perm);
QString getPath();
void setPath(const QString& path);
QString getName();
QHash<QString,QVariant> collectOptions();
bool isPermanent();
protected:
void changeEvent(QEvent *e);
void showEvent(QShowEvent* e);
private:
void init();
void updateOptions();
void addOption(const DbPluginOption& option, int row);
QWidget* getEditor(const DbPluginOption& opt, QWidget *&editorHelper);
QVariant getValueFrom(DbPluginOption::Type type, QWidget* editor);
void setValueFor(DbPluginOption::Type type, QWidget* editor, const QVariant& value);
void updateType();
Db* getDb();
bool testDatabase();
bool validate();
void updateState();
Ui::DbDialog *ui = nullptr;
Mode mode;
QStringList existingDatabaseNames;
Db* db = nullptr;
QList<DbPlugin*> dbPlugins;
QList<QWidget*> optionWidgets;
QHash<QString,QWidget*> optionKeyToWidget;
QHash<QString,DbPluginOption::Type> optionKeyToType;
QHash<QWidget*,QString> helperToKey;
QWidget* lastWidgetInTabOrder = nullptr;
static const constexpr int ADDITIONAL_ROWS_BEGIN_INDEX = 4;
private slots:
void typeChanged(int index);
void valueForNameGenerationChanged();
void browseForFile();
void generateNameSwitched(bool checked);
void fileChanged(const QString &arg1);
void browseClicked();
void testConnectionClicked();
void propertyChanged();
void dbTypeChanged(int index);
void nameModified(const QString &arg1);
public slots:
void accept();
};
#endif // DBDIALOG_H
|