{{ message }}
Repository navigation
Expand file tree
/
Copy pathMainWindow.h
More file actions
286 lines (251 loc) · 8.41 KB
/
Copy pathMainWindow.h
File metadata and controls
286 lines (251 loc) · 8.41 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "sqltextedit.h"
#include "sqlitedb.h"
#include "RemoteDatabase.h"
#include <QMainWindow>
#include <QMap>
class QDragEnterEvent;
class EditDialog;
class QIntValidator;
class QLabel;
class QModelIndex;
class QPersistentModelIndex;
class SqliteTableModel;
class DbStructureModel;
class QNetworkReply;
class QNetworkAccessManager;
class QTreeWidgetItem;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
DBBrowserDB& getDb() { return db; }
const RemoteDatabase& getRemote() const { return m_remoteDb; }
struct PlotSettings
{
int lineStyle;
int pointShape;
QColor colour;
friend QDataStream& operator<<(QDataStream& stream, const MainWindow::PlotSettings& object)
{
stream << object.lineStyle;
stream << object.pointShape;
stream << object.colour;
return stream;
}
friend QDataStream& operator>>(QDataStream& stream, MainWindow::PlotSettings& object)
{
stream >> object.lineStyle;
stream >> object.pointShape;
stream >> object.colour;
return stream;
}
};
struct BrowseDataTableSettings
{
int sortOrderIndex;
Qt::SortOrder sortOrderMode;
QMap<int, int> columnWidths;
QMap<int, QString> filterValues;
QMap<int, QString> displayFormats;
bool showRowid;
QString encoding;
QString plotXAxis;
QMap<QString, PlotSettings> plotYAxes;
friend QDataStream& operator<<(QDataStream& stream, const MainWindow::BrowseDataTableSettings& object)
{
stream << object.sortOrderIndex;
stream << static_cast<int>(object.sortOrderMode);
stream << object.columnWidths;
stream << object.filterValues;
stream << object.displayFormats;
stream << object.showRowid;
stream << object.encoding;
stream << object.plotXAxis;
stream << object.plotYAxes;
return stream;
}
friend QDataStream& operator>>(QDataStream& stream, MainWindow::BrowseDataTableSettings& object)
{
stream >> object.sortOrderIndex;
int sortordermode;
stream >> sortordermode;
object.sortOrderMode = static_cast<Qt::SortOrder>(sortordermode);
stream >> object.columnWidths;
stream >> object.filterValues;
stream >> object.displayFormats;
stream >> object.showRowid;
stream >> object.encoding;
// Versions pre 3.10.0 didn't store the following information in their project files.
// To be absolutely sure that nothing strange happens when we read past the stream for
// those cases, check for the end of the stream here.
if(stream.atEnd())
return stream;
stream >> object.plotXAxis;
stream >> object.plotYAxes;
return stream;
}
};
enum Tabs
{
StructureTab,
BrowseTab,
PragmaTab,
ExecuteTab
};
private:
struct PragmaValues
{
int autovacuum;
int automatic_index;
int checkpoint_fullsync;
int foreign_keys;
int fullfsync;
int ignore_check_constraints;
QString journal_mode;
int journal_size_limit;
QString locking_mode;
int max_page_count;
int page_size;
int recursive_triggers;
int secure_delete;
int synchronous;
int temp_store;
int user_version;
int wal_autocheckpoint;
} pragmaValues;
enum PlotColumns
{
PlotColumnField = 0,
PlotColumnX = 1,
PlotColumnY = 2,
PlotColumnDummy = 3
};
Ui::MainWindow* ui;
SqliteTableModel* m_browseTableModel;
SqliteTableModel* m_currentTabTableModel;
SqliteTableModel* m_currentPlotModel;
QMenu *popupTableMenu;
QMenu *recentFilesMenu;
QMenu *popupSaveSqlFileMenu;
QMenu* popupBrowseDataHeaderMenu;
QLabel* statusEncodingLabel;
QLabel* statusEncryptionLabel;
QLabel* statusReadOnlyLabel;
DbStructureModel* dbStructureModel;
enum { MaxRecentFiles = 5 };
QAction *recentFileActs[MaxRecentFiles];
QAction *recentSeparatorAct;
QMap<QString, BrowseDataTableSettings> browseTableSettings;
EditDialog* editDock;
QIntValidator* gotoValidator;
DBBrowserDB db;
QString defaultBrowseTableEncoding;
RemoteDatabase m_remoteDb;
QNetworkAccessManager* m_NetworkManager;
void init();
void clearCompleterModelsFields();
void updateRecentFileActions();
void setCurrentFile(const QString& fileName);
void addToRecentFilesMenu(const QString& filename);
void activateFields(bool enable = true);
void loadExtensionsFromSettings();
protected:
void closeEvent(QCloseEvent *);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void resizeEvent(QResizeEvent *event);
void keyPressEvent(QKeyEvent* event);
public slots:
bool fileOpen(const QString& fileName = QString(), bool dontAddToRecentFiles = false);
void logSql(const QString &sql, int msgtype);
void dbState(bool dirty);
void refresh();
void jumpToRow(const QString& table, QString column, const QByteArray& value);
void switchToBrowseDataTab(QString tableToBrowse = QString());
void populateStructure();
private slots:
void createTreeContextMenu(const QPoint & qPoint);
void changeTreeSelection();
void fileNew();
void populateTable();
void clearTableBrowser();
bool fileClose();
void addRecord();
void deleteRecord();
void selectTableLine( int lineToSelect );
void navigatePrevious();
void navigateNext();
void navigateBegin();
void navigateEnd();
void navigateGoto();
void setRecordsetLabel();
void createTable();
void createIndex();
void compact();
void deleteObject();
void editTable();
void helpWhatsThis();
void helpAbout();
void updateRecordText(const QPersistentModelIndex& idx, const QByteArray& text, bool isBlob);
void toggleEditDock(bool visible);
void dataTableSelectionChanged(const QModelIndex& index);
void doubleClickTable(const QModelIndex& index);
void executeQuery();
void importTableFromCSV();
void exportTableToCSV();
void exportTableToJson();
void fileSave();
void fileRevert();
void on_actionOpen_Remote_triggered();
void on_actionSave_Remote_triggered();
void exportDatabaseToSQL();
void importDatabaseFromSQL();
void openPreferences();
void openRecentFile();
void loadPragmas();
void updatePragmaUi();
void savePragmas();
void mainTabSelected( int tabindex );
void browseTableHeaderClicked(int logicalindex);
unsigned int openSqlTab(bool resetCounter = false);
void closeSqlTab(int index, bool force = false);
void openSqlFile();
void saveSqlFile();
void saveSqlFileAs();
void loadExtension();
void reloadSettings();
void httpresponse(QNetworkReply* reply);
void updatePlot(SqliteTableModel* model, bool update = true, bool keepOrResetSelection = true);
void on_treePlotColumns_itemChanged(QTreeWidgetItem *item, int column);
void on_treePlotColumns_itemDoubleClicked(QTreeWidgetItem *item, int column);
void on_butSavePlot_clicked();
void on_actionWiki_triggered();
void on_actionBug_report_triggered();
void on_actionSqlCipherFaq_triggered();
void on_actionWebsite_triggered();
void updateBrowseDataColumnWidth(int section, int /*old_size*/, int new_size);
bool loadProject(QString filename = QString());
void saveProject();
void fileAttach();
void updateFilter(int column, const QString& value);
void editEncryption();
void on_buttonClearFilters_clicked();
void copyCurrentCreateStatement();
void on_comboLineType_currentIndexChanged(int index);
void on_comboPointShape_currentIndexChanged(int index);
void showDataColumnPopupMenu(const QPoint& pos);
void showRecordPopupMenu(const QPoint& pos);
void editDataColumnDisplayFormat();
void showRowidColumn(bool show);
void browseDataSetTableEncoding(bool forAllTables = false);
void browseDataSetDefaultTableEncoding();
void browseDataFetchAllData();
};
#endif
You can’t perform that action at this time.
