pgLab/mainwindow.h

90 lines
1.8 KiB
C
Raw Normal View History

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "asyncdbconnection.h"
#include "connectionconfig.h"
#include "tsqueue.h"
#include <QLabel>
#include <QMainWindow>
#include <QSocketNotifier>
#include <memory>
2016-12-27 21:22:49 +01:00
#include <future>
#include "PgsqlConn.h"
#include <chrono>
#include <deque>
#include <mutex>
//class ExplainRoot;
//class QueryResultModel;
//class QueryExplainModel;
namespace Ui {
class MainWindow;
}
namespace Pgsql {
class Connection;
}
class QueryTab;
class QCloseEvent;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void setConfig(const ConnectionConfig &config);
/* 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.
*/
void QueueTask(TSQueue::t_Callable c);
private:
TSQueue m_taskQueue;
QLabel *m_timeElapsedLabel;
std::chrono::duration<float, std::milli> elapsedTime;
ConnectionConfig m_config;
std::unique_ptr<QTimer> m_timer;
std::chrono::time_point<std::chrono::steady_clock> m_startTime;
void startTimer();
void endTimer();
Ui::MainWindow *ui;
QueryTab *GetActiveQueryTab();
void closeEvent(QCloseEvent *event);
void showEvent(QShowEvent *event);
void newSqlPage();
private slots:
void processCallableQueue();
void updateTimer();
void on_actionLoad_SQL_triggered();
void on_actionSave_SQL_triggered();
void on_actionExport_data_triggered();
void on_actionClose_triggered();
void on_actionAbout_triggered();
void on_actionExecute_SQL_triggered();
void on_actionExplain_Analyze_triggered();
void on_actionCancel_triggered();
void on_actionSave_SQL_as_triggered();
void on_actionSave_copy_of_SQL_as_triggered();
void on_actionNew_SQL_triggered();
};
#endif // MAINWINDOW_H