2016-12-26 16:06:55 +01:00
|
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
2017-01-06 07:23:40 +01:00
|
|
|
|
#include "asyncdbconnection.h"
|
2017-01-15 21:01:40 +01:00
|
|
|
|
#include "connectionconfig.h"
|
2017-01-03 07:22:36 +01:00
|
|
|
|
#include "tsqueue.h"
|
2017-01-08 15:16:16 +01:00
|
|
|
|
#include <QLabel>
|
2016-12-26 16:06:55 +01:00
|
|
|
|
#include <QMainWindow>
|
2016-12-27 15:41:11 +01:00
|
|
|
|
#include <QSocketNotifier>
|
2016-12-26 16:06:55 +01:00
|
|
|
|
#include <memory>
|
2016-12-27 21:22:49 +01:00
|
|
|
|
#include <future>
|
2016-12-27 15:41:11 +01:00
|
|
|
|
#include "PgsqlConn.h"
|
2017-01-16 18:56:07 +01:00
|
|
|
|
#include <chrono>
|
2017-01-15 21:01:40 +01:00
|
|
|
|
#include <deque>
|
|
|
|
|
|
#include <mutex>
|
2016-12-26 16:06:55 +01:00
|
|
|
|
|
2017-01-21 18:16:57 +01:00
|
|
|
|
//class ExplainRoot;
|
|
|
|
|
|
//class QueryResultModel;
|
|
|
|
|
|
//class QueryExplainModel;
|
2016-12-26 16:06:55 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
|
class MainWindow;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-12-27 15:41:11 +01:00
|
|
|
|
namespace Pgsql {
|
|
|
|
|
|
class Connection;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-01-21 08:09:12 +01:00
|
|
|
|
class QueryTab;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
class MasterController;
|
2017-01-19 17:48:44 +01:00
|
|
|
|
class QCloseEvent;
|
2017-02-04 11:55:49 +01:00
|
|
|
|
class OpenDatabase;
|
2016-12-30 10:14:26 +01:00
|
|
|
|
|
2016-12-26 16:06:55 +01:00
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
2017-02-01 18:01:02 +01:00
|
|
|
|
explicit MainWindow(MasterController *master, QWidget *parent);
|
2016-12-26 16:06:55 +01:00
|
|
|
|
~MainWindow();
|
|
|
|
|
|
|
2017-01-15 21:01:40 +01:00
|
|
|
|
void setConfig(const ConnectionConfig &config);
|
2016-12-30 10:14:26 +01:00
|
|
|
|
/* Meant to be called from other threads to pass a code block
|
|
|
|
|
|
* that has to be executed in the context of the thread of the window.
|
|
|
|
|
|
*/
|
2017-01-03 07:22:36 +01:00
|
|
|
|
void QueueTask(TSQueue::t_Callable c);
|
2016-12-30 10:14:26 +01:00
|
|
|
|
|
2017-02-04 11:55:49 +01:00
|
|
|
|
OpenDatabase* getDatabase() { return m_database; }
|
2016-12-26 16:06:55 +01:00
|
|
|
|
private:
|
2017-01-25 06:54:21 +01:00
|
|
|
|
|
2017-01-22 08:50:41 +01:00
|
|
|
|
Ui::MainWindow *ui;
|
2017-01-21 18:16:57 +01:00
|
|
|
|
|
2017-01-22 08:50:41 +01:00
|
|
|
|
TSQueue m_taskQueue;
|
2017-01-15 21:01:40 +01:00
|
|
|
|
ConnectionConfig m_config;
|
2017-02-04 11:55:49 +01:00
|
|
|
|
OpenDatabase *m_database;
|
2017-01-15 21:01:40 +01:00
|
|
|
|
|
2017-02-01 18:01:02 +01:00
|
|
|
|
MasterController *m_masterController;
|
|
|
|
|
|
|
2017-01-08 15:16:16 +01:00
|
|
|
|
|
2017-01-21 18:16:57 +01:00
|
|
|
|
QueryTab *GetActiveQueryTab();
|
2016-12-26 16:06:55 +01:00
|
|
|
|
|
2017-01-19 17:48:44 +01:00
|
|
|
|
void closeEvent(QCloseEvent *event);
|
2017-01-21 08:09:12 +01:00
|
|
|
|
void showEvent(QShowEvent *event);
|
2017-01-22 08:50:41 +01:00
|
|
|
|
QueryTab *newSqlPage();
|
2017-01-25 06:54:21 +01:00
|
|
|
|
|
2016-12-26 16:06:55 +01:00
|
|
|
|
private slots:
|
2016-12-27 15:41:11 +01:00
|
|
|
|
|
2016-12-30 10:14:26 +01:00
|
|
|
|
void processCallableQueue();
|
2017-01-08 15:16:16 +01:00
|
|
|
|
|
2017-01-09 07:39:09 +01:00
|
|
|
|
void on_actionLoad_SQL_triggered();
|
|
|
|
|
|
void on_actionSave_SQL_triggered();
|
|
|
|
|
|
void on_actionExport_data_triggered();
|
|
|
|
|
|
void on_actionClose_triggered();
|
|
|
|
|
|
void on_actionAbout_triggered();
|
2017-01-15 21:01:40 +01:00
|
|
|
|
void on_actionExecute_SQL_triggered();
|
|
|
|
|
|
void on_actionExplain_Analyze_triggered();
|
|
|
|
|
|
void on_actionCancel_triggered();
|
2017-01-21 08:09:12 +01:00
|
|
|
|
void on_actionSave_SQL_as_triggered();
|
2017-01-21 08:19:47 +01:00
|
|
|
|
void on_actionSave_copy_of_SQL_as_triggered();
|
2017-01-21 18:16:57 +01:00
|
|
|
|
void on_actionNew_SQL_triggered();
|
2017-01-22 08:50:41 +01:00
|
|
|
|
void on_tabWidget_tabCloseRequested(int index);
|
2017-01-25 06:54:21 +01:00
|
|
|
|
void on_actionExplain_triggered();
|
2017-02-01 18:01:02 +01:00
|
|
|
|
void on_actionShow_connection_manager_triggered();
|
2017-02-04 11:55:49 +01:00
|
|
|
|
void on_actionCopy_triggered();
|
2017-02-05 08:23:06 +01:00
|
|
|
|
void on_actionCopy_as_C_string_triggered();
|
2016-12-26 16:06:55 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|