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
90
91
92
93
94
95
96
97
98
99
100
|
#ifndef SQLITEEXTENSIONEDITOR_H
#define SQLITEEXTENSIONEDITOR_H
#include "icon.h"
#include "mdichild.h"
#include <QItemSelection>
#include <QWidget>
namespace Ui {
class SqliteExtensionEditor;
}
class QToolBar;
class SqliteExtensionEditorModel;
class QSortFilterProxyModel;
class SelectableDbModel;
class Db;
class LazyTrigger;
class SqliteExtensionEditor : public MdiChild
{
Q_OBJECT
public:
enum Action
{
COMMIT,
ROLLBACK,
ADD,
DELETE,
HELP
};
enum ToolBar
{
TOOLBAR
};
explicit SqliteExtensionEditor(QWidget *parent = nullptr);
~SqliteExtensionEditor();
bool restoreSessionNextTime();
bool isUncommitted() const;
QString getQuitUncommittedConfirmMessage() const;
protected:
QVariant saveSession();
bool restoreSession(const QVariant &sessionValue);
Icon* getIconNameForMdiWindow();
QString getTitleForMdiWindow();
void createActions();
void setupDefShortcuts();
QToolBar* getToolBar(int toolbar) const;
private:
void init();
int getCurrentExtensionRow() const;
void extensionDeselected(int row);
void extensionSelected(int row);
void clearEdits();
void selectExtension(int row);
QStringList getCurrentDatabases() const;
bool tryToLoad(const QString& filePath, const QString& initFunc, QString* resultError);
bool validateExtension(bool* fileOk = nullptr,
bool* initOk = nullptr,
QString* fileError = nullptr);
bool validateExtension(int row);
bool validateExtension(const QString& filePath,
const QString& initFunc,
bool* fileOk = nullptr,
bool* initOk = nullptr,
QString* fileError = nullptr);
void initStateForAll();
Ui::SqliteExtensionEditor *ui;
SqliteExtensionEditorModel* model = nullptr;
QSortFilterProxyModel* extensionFilterModel = nullptr;
SelectableDbModel* dbListModel = nullptr;
bool currentModified = false;
bool updatesForSelection = false;
Db* probingDb = nullptr;
LazyTrigger* statusUpdateTrigger = nullptr;
bool nameGenerationActive = true;
private slots:
void help();
void commit();
void rollback();
void newExtension();
void deleteExtension();
void updateState();
void updateCurrentExtensionState();
void extensionSelected(const QItemSelection& selected, const QItemSelection& deselected);
void updateModified();
void generateName();
void applyFilter(const QString& value);
void browseForFile();
};
#endif // SQLITEEXTENSIONEDITOR_H
|