Made a step in removing knowledge of DatabaseWindow from QueryTab as an effort to move

in the direction of a plugin system.

DatabaseWindow now passes a Context to QueryTab and other pages that give those pages an
API for passing information up the system without knowing anything about the sytem.
This commit is contained in:
eelke 2018-12-29 18:59:54 +01:00
parent f6ea2ce0a6
commit 2a7e505dbf
13 changed files with 220 additions and 113 deletions

View file

@ -8,7 +8,7 @@
#include "tuplesresultwidget.h"
#include <QWidget>
#include "PlgPage.h"
#include "PluginContentWidget.h"
#include <memory>
namespace Ui {
@ -22,7 +22,6 @@ namespace Pgsql {
class QTableView;
class QTabWidget;
class DatabaseWindow;
class SqlSyntaxHighlighter;
class ExplainRoot;
class QueryResultModel;
@ -32,11 +31,11 @@ class OpenDatabase;
class QueryParamListController;
class PgDatabaseCatalog;
class QueryTab : public PlgPage {
class QueryTab : public PluginContentWidget {
Q_OBJECT
public:
QueryTab(DatabaseWindow *win, QWidget *parent = nullptr);
~QueryTab();
QueryTab(IPluginContentWidgetContext *context, QWidget *parent = nullptr);
~QueryTab() override;
void setConfig(const ConnectionConfig &config, std::shared_ptr<PgDatabaseCatalog>cat);
@ -69,7 +68,6 @@ private:
using ResultTabContainer = std::vector<TuplesResultWidget*>;
Ui::QueryTab *ui;
DatabaseWindow *m_win;
SqlSyntaxHighlighter* highlighter;
ConnectionConfig m_config;
StopWatch m_stopwatch;
@ -101,8 +99,8 @@ private:
void explain_ready(ExplainRoot::SPtr explain);
void query_ready(Expected<std::shared_ptr<Pgsql::Result>> dbres, qint64 elapsedms);
QTabWidget *getTabWidget();
void setTabCaption(const QString &caption, const QString &tooltip);
//QTabWidget *getTabWidget();
//void setTabCaption(const QString &caption, const QString &tooltip);
void clearResult();
void markError(const Pgsql::ErrorDetails &details);