Go to the documentation of this file.00001 #ifndef SERVEREDITOR_H
00002 #define SERVEREDITOR_H
00003
00004 #include <QWidget>
00005 #include <QtSql>
00006 #include <QtGui>
00007 #include "textedit.h"
00008 #include <QSyntaxHighlighter>
00009 #include "highlighter.h"
00010 #include "queryresults.h"
00011 #include "columnlist.h"
00012 #include "explaintable.h"
00013 #include <Qsci/qsciscintilla.h>
00014 #include <Qsci/qscilexer.h>
00015 #include <Qsci/qscilexersql.h>
00016 #include <Qsci/qsciapis.h>
00017 namespace Ui {
00018 class ServerEditor;
00019 }
00020
00026 class ServerEditor : public QWidget
00027 {
00028 Q_OBJECT
00029
00030 public:
00031 explicit ServerEditor(QWidget *parent = 0);
00032 ~ServerEditor();
00034 QSqlDatabase db;
00035
00037 QAbstractItemModel *modelFromFile(const QString& fileName);
00038
00040 QsciScintilla *queryEditor;
00041
00043 QCompleter *comp;
00044
00047 Highlighter *highlighter;
00048
00050 QStringList dbList;
00051
00053 QString currentDb;
00054
00056 QSqlTableModel *tableModel;
00057
00059 QString currentTable;
00060
00062 QString lastQueryError;
00063
00065 QString currentView;
00066 signals:
00069 void dbListChanged(QStringList newDbList);
00070
00073 void currentDbChanged(QString newDbName);
00074
00078 void callPopupMenu(QString tag);
00079
00081 void tableSelected(bool);
00082
00084 void viewSelected(bool);
00085 private:
00086 Ui::ServerEditor *ui;
00087 QIcon ico_db;
00088 QIcon ico_folder;
00089 QIcon ico_table;
00090 QIcon ico_view;
00091 QIcon ico_proc;
00092 QIcon ico_col;
00093 QIcon ico_key;
00094 QIcon ico_key2;
00095 QIcon ico_gears;
00096 QIcon ico_vars;
00097 QGraphicsScene *scene;
00098 QStringList sceneObjects;
00099 QString sceneQuery;
00100 bool variablesLoaded;
00101 bool processesLoaded;
00102 QsciAPIs* apis;
00103 QsciLexerSQL* lex;
00104
00105 public slots:
00109 void refreshDbList();
00110
00112 void addNewDb(QString dbName);
00113
00115 void setCurrentDb(QString dbName);
00116
00119 void executeQuery(QString query);
00120
00124 void parseLargeQuery(QString query);
00125
00127 bool runQuery(QString query);
00128
00130 void executeTypedQuery();
00131
00133 void addTableToScene();
00134
00137 void reloadCurrentDb();
00138
00143 void selectTable(QString dbName, QString tableName);
00144
00146 void insertObjectToScene(QString, QString);
00147
00150 void buildSceneQuery();
00151
00153 void closeQueryTab(int);
00154
00156 void newQuery(QString);
00157
00159 void reloadServerInformation();
00160
00162 void dropView();
00163
00165 void renameTable();
00166
00168 void truncateTable();
00169
00171 void dropTable();
00172
00177 void openSQLFile();
00178
00180 void dropDb();
00181
00183 void truncateDb();
00184
00186 void emptyDb();
00187
00191 void runSQLFile();
00192 private slots:
00193 void on_cmdReloadProcesses_clicked();
00194 void on_cmdReloadVariables_clicked();
00195 void on_tabWidget_currentChanged(int index);
00196 void on_cmdExecuteSceneQuery_clicked();
00197 void on_trvServerExplorer_itemDoubleClicked(QTreeWidgetItem* item, int column);
00198 void on_graphicsView_customContextMenuRequested(QPoint pos);
00199 void on_trvServerExplorer_customContextMenuRequested(QPoint pos);
00200 void on_trvServerExplorer_itemClicked(QTreeWidgetItem* item, int column);
00201 void on_trvServerExplorer_itemChanged(QTreeWidgetItem* item, int column);
00202 void on_trvServerExplorer_itemExpanded(QTreeWidgetItem* item);
00203 void sceneItemDoubleClicked(QString, QString, QString);
00204 void postMessage(QString);
00205 };
00206
00207 #endif // SERVEREDITOR_H