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

@ -33,7 +33,11 @@ class MasterController;
class QCloseEvent;
class OpenDatabase;
class PgClass;
class PlgPage;
class PluginContentWidget;
namespace DatabaseWindow_details {
class DatabaseWindowContentContext;
}
/** This is the class for windows that handle tasks for a specific database/catalog
*
@ -51,15 +55,18 @@ public:
void newCrudPage(const PgClass &table);
void newCodeGenPage(QString query, std::shared_ptr<const Pgsql::Result> dbres);
void setTabCaptionForWidget(QWidget *widget, const QString &caption, const QString &hint);
void setTabIcon(QWidget *widget, const QString &iconname);
private:
Ui::MainWindow *ui;
DatabaseWindow_details::DatabaseWindowContentContext *m_context;
ConnectionConfig m_config;
std::shared_ptr<OpenDatabase> m_database;
MasterController *m_masterController;
PlgPage *m_previousPage = nullptr; ///< tracks which pages buttons were previously being displayed
PluginContentWidget *m_previousPage = nullptr; ///< tracks which pages buttons were previously being displayed
class QLoad : public QueuedBackgroundTask {
public:
@ -99,12 +106,12 @@ private:
void catalogLoaded();
/// Called when a newly created page is added to the QTabWidget
void addPage(PlgPage* page, QString caption);
void addPage(PluginContentWidget* page, QString caption);
/// Called when a page is completely removed from the QTabWidget
void removePage(PlgPage *page);
void removePage(PluginContentWidget *page);
void addToolBarButtonsForPage(PlgPage *page);
void removeToolBarButtonsForPage(PlgPage *page);
void addToolBarButtonsForPage(PluginContentWidget *page);
void removeToolBarButtonsForPage(PluginContentWidget *page);
//class PageData
private slots: