Switched DatabaseWindow to using the form designer.
This commit is contained in:
parent
03b4194193
commit
7300865c77
4 changed files with 604 additions and 437 deletions
|
|
@ -9,6 +9,9 @@
|
|||
#include <QMainWindow>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class DatabaseWindow;
|
||||
}
|
||||
namespace Pgsql {
|
||||
class Connection;
|
||||
}
|
||||
|
|
@ -53,56 +56,13 @@ protected:
|
|||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
private:
|
||||
QTabWidget *m_tabWidget = nullptr;
|
||||
QToolBar *m_mainToolBar = nullptr;
|
||||
Ui::DatabaseWindow *ui;
|
||||
|
||||
ConnectionConfig m_config;
|
||||
std::shared_ptr<OpenDatabase> m_database;
|
||||
|
||||
MasterController *m_masterController;
|
||||
|
||||
// Standard menu's
|
||||
QMenu *m_fileMenu = nullptr;
|
||||
|
||||
// Standard actions
|
||||
QAction *actionAbout = nullptr;
|
||||
QAction *actionCancelQuery = nullptr;
|
||||
QAction *actionClose = nullptr;
|
||||
QAction *actionCopy = nullptr;
|
||||
QAction *actionCopyAsCString = nullptr;
|
||||
QAction *actionCopyAsRawCppString = nullptr;
|
||||
QAction *actionExecuteQuery = nullptr;
|
||||
QAction *actionExplain = nullptr;
|
||||
QAction *actionExplainAnalyze = nullptr;
|
||||
QAction *actionExportData = nullptr;
|
||||
QAction *actionGenerateCode = nullptr;
|
||||
QAction *actionInspectInformationSchema = nullptr; ///< Create or switch to pgcatalog tab
|
||||
QAction *actionInspectPgCatalog = nullptr; ///< Create or switch to pgcatalog tab
|
||||
QAction *actionInspectUserSchemas = nullptr; ///< Create or switch to pgcatalog tab
|
||||
QAction *actionServerInspector = nullptr;
|
||||
QAction *actionNewSql = nullptr;
|
||||
QAction *actionOpenSql = nullptr;
|
||||
QAction *actionPasteLangString = nullptr;
|
||||
QAction *actionRefreshCatalog = nullptr;
|
||||
QAction *actionRefreshCrud = nullptr;
|
||||
QAction *actionSaveSql = nullptr;
|
||||
QAction *actionSaveSqlAs = nullptr;
|
||||
QAction *actionSaveCopyOfSqlAs = nullptr;
|
||||
QAction *actionShowConnectionManager = nullptr;
|
||||
|
||||
QMenu *menuEdit = nullptr;
|
||||
QMenu *menuFile = nullptr;
|
||||
QMenu *menuHelp = nullptr;
|
||||
QMenu *menuQuery = nullptr;
|
||||
QMenu *menuCatalog = nullptr;
|
||||
QMenu *menuCrud = nullptr;
|
||||
QMenu *menuWindow = nullptr;
|
||||
|
||||
void createActions();
|
||||
void initMenus();
|
||||
|
||||
QAction* seperator();
|
||||
|
||||
void newCreateTablePage();
|
||||
void newCrudPage(Oid tableoid);
|
||||
void newCatalogInspectorPage(QString caption, NamespaceFilter filter);
|
||||
|
|
@ -115,41 +75,37 @@ private:
|
|||
/// If it has it invokes this method using reflection.
|
||||
static void InvokeCopyIfPresent(QWidget *w);
|
||||
|
||||
QAction* createAction(QString icon, QString caption, void (DatabaseWindow::*func)());
|
||||
QAction* createAction(QString caption, void (DatabaseWindow::*func)());
|
||||
|
||||
private slots:
|
||||
void catalogLoaded(OpenDatabase::OpenDatabaseSPtr db);
|
||||
void tableSelected(Oid tableoid);
|
||||
void mainTabCloseRequested(int index);
|
||||
void currentMainTabChanged(int index);
|
||||
|
||||
void actionAbout_triggered();
|
||||
void actionCancelQuery_triggered();
|
||||
void actionClose_triggered();
|
||||
void actionCopy_triggered();
|
||||
void actionCopyAsCString_triggered();
|
||||
void actionCopyAsRawCppString_triggered();
|
||||
void actionExecuteQuery_triggered();
|
||||
void actionExplain_triggered();
|
||||
void actionExplainAnalyze_triggered();
|
||||
void actionExportData_triggered();
|
||||
void actionGenerateCode_triggered();
|
||||
void actionInspectInformationSchema_triggered();
|
||||
void actionInspectPgCatalog_triggered();
|
||||
void actionInspectUserSchemas_triggered();
|
||||
void actionServerInspector_triggered();
|
||||
void actionNewSql_triggered();
|
||||
void actionOpenSql_triggered();
|
||||
void actionPasteLangString_triggered();
|
||||
void actionRefreshCatalog_triggered();
|
||||
void actionRefreshCrud_triggered();
|
||||
void actionSaveSql_triggered();
|
||||
void actionSaveSqlAs_triggered();
|
||||
void actionSaveCopyOfSqlAs_triggered();
|
||||
void actionShowConnectionManager_triggered();
|
||||
void m_tabWidget_tabCloseRequested(int index);
|
||||
void m_tabWidget_currentChanged(int index);
|
||||
void on_actionAbout_triggered();
|
||||
void on_actionCancel_query_triggered();
|
||||
void on_actionClose_triggered();
|
||||
void on_actionCopy_triggered();
|
||||
void on_actionCopy_as_C_string_triggered();
|
||||
void on_actionCopy_as_raw_C_string_triggered();
|
||||
void on_actionExecute_query_triggered();
|
||||
void on_actionExplain_triggered();
|
||||
void on_actionExplain_analyze_triggered();
|
||||
void on_actionExport_data_triggered();
|
||||
void on_actionGenerate_code_triggered();
|
||||
void on_actionInspect_information_schema_triggered();
|
||||
void on_actionInspect_pg_catalog_triggered();
|
||||
void on_actionInspect_user_schemas_triggered();
|
||||
void on_actionInspect_server_triggered();
|
||||
void on_actionNew_Query_triggered();
|
||||
void on_actionOpen_Query_triggered();
|
||||
void on_actionSave_Query_triggered();
|
||||
void on_actionPaste_lang_string_triggered();
|
||||
void on_actionRefreshCatalog_triggered();
|
||||
void on_actionRefreshCrud_triggered();
|
||||
void on_actionSave_query_as_triggered();
|
||||
void on_actionSave_copy_of_query_as_triggered();
|
||||
void on_actionShow_connection_manager_triggered();
|
||||
|
||||
// IDatabaseWindow interface
|
||||
public:
|
||||
virtual void setTitleForWidget(QWidget *widget, QString title, QString hint) override;
|
||||
virtual void setIconForWidget(QWidget *widget, QIcon icon) override;
|
||||
|
|
@ -160,6 +116,24 @@ public:
|
|||
protected:
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
virtual void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
|
||||
template <typename T, class... Params>
|
||||
void CallOnActiveQueryTool(T (QueryTool::*Func)(Params...), Params... args)
|
||||
{
|
||||
auto query_tool = GetActiveQueryTool();
|
||||
if (query_tool)
|
||||
(query_tool->*Func)(&args...);
|
||||
}
|
||||
|
||||
template <typename T, class... Params>
|
||||
void CallOnActiveCrud(T (CrudTab::*Func)(Params...), Params... args)
|
||||
{
|
||||
auto crud = GetActiveCrud();
|
||||
if (crud)
|
||||
(crud->*Func)(&args...);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue