pgLab/mainwindow.h

90 lines
1.7 KiB
C
Raw Normal View History

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "asyncdbconnection.h"
#include "tsqueue.h"
#include <QMainWindow>
#include <QSocketNotifier>
#include <memory>
2016-12-27 21:22:49 +01:00
#include <future>
#include "PgsqlConn.h"
class ExplainRoot;
class QueryResultModel;
class QueryExplainModel;
class SqlHighlighter;
namespace Ui {
class MainWindow;
}
namespace Pgsql {
class Connection;
}
#include <deque>
#include <mutex>
class TaskQueue {
public:
private:
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
/* 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;
std::unique_ptr<Ui::MainWindow> ui;
std::unique_ptr<SqlHighlighter> highlighter;
ASyncDBConnection m_dbConnection;
void connectionStateChanged(ASyncDBConnection::State state);
// std::unique_ptr<Pgsql::Connection> connection;
// std::unique_ptr<QueryResultModel> resultModel;
// std::unique_ptr<QueryExplainModel> explainModel;
// Pgsql::Canceller queryCancel;
2016-12-27 21:22:49 +01:00
2016-12-27 21:22:49 +01:00
// struct {
// std::unique_ptr<QSocketNotifier> notifier;
// PostgresPollingStatusType poll_state;
// } connectingState;
2016-12-27 21:22:49 +01:00
// void processNotice(const PGresult *result);
// void query_ready(Pgsql::Result res);
// void explain_ready(std::shared_ptr<ExplainRoot> explain);
private slots:
void startConnect();
// void performQuery();
// void performExplain();
// void socket_activate_connect(int socket);
// void cancel_query();
// void receiveNotice(Pgsql::ErrorDetails notice);
void processCallableQueue();
};
#endif // MAINWINDOW_H