Split all connection related controller functionality off into seperate ConnectionController.

This commit is contained in:
eelke 2019-08-19 10:05:05 +02:00
parent 8c13bdc2ef
commit 35d1e75d35
8 changed files with 103 additions and 61 deletions

View file

@ -76,12 +76,9 @@ void DatabaseWindow::newCrudPage(Oid tableoid)
void DatabaseWindow::newCodeGenPage(QString query, std::shared_ptr<const Pgsql::Result> dbres)
{
// TODO should this call be this direct or should it go through module system
// yes it should otherwise context cannot properly setup toolbar and menu!!!
// auto cgtab = new CodeGenerator(context(), pluginModule(), this);
// cgtab->Init(m_database->catalog(), query, dbres);
// addPage(cgtab, "Codegen");
//
auto cgtab = new CodeGenerator(this);
cgtab->Init(m_database->catalog(), query, dbres);
addPage(cgtab, "Codegen");
}
QueryTool *DatabaseWindow::GetActiveQueryTool()
@ -325,12 +322,11 @@ void DatabaseWindow::catalogLoaded()
try {
m_database = loadWatcher.future().result();
for (auto f : { "user", "pg_catalog", "information_schema" }) {
// TODO open inspector windows
}
newCreateTablePage();
// for (auto f : { "user", "pg_catalog", "information_schema" }) {
// // TODO open inspector windows
// }
// newCreateTablePage();
on_actionNewSql_triggered();
} catch (const OpenDatabaseException &ex) {
QMessageBox::critical(this, "Error reading database", ex.text());
close();
@ -444,6 +440,7 @@ void DatabaseWindow::on_actionGenerateCode_triggered()
auto query_tool = GetActiveQueryTool();
if (query_tool) {
query_tool->generateCode();
//newCodeGenPage
}
}
@ -511,7 +508,7 @@ void DatabaseWindow::on_actionSaveCopyOfSqlAs_triggered()
void DatabaseWindow::on_actionShowConnectionManager_triggered()
{
m_masterController->showConnectionManager();
m_masterController->connectionController()->showConnectionManager();
}
void DatabaseWindow::on_m_tabWidget_tabCloseRequested(int index)