DatabaseWindow no longer has to pass the config to QueryTab, QueryTab can now init itself from the supplied context.
This commit is contained in:
parent
2a7e505dbf
commit
a54a063c13
3 changed files with 8 additions and 15 deletions
|
|
@ -30,13 +30,16 @@ QueryTab::QueryTab(IPluginContentWidgetContext *context_, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_config = context()->getDatabase()->config();
|
||||
m_catalog = context()->getDatabase()->catalog();
|
||||
|
||||
connect(&m_dbConnection, &ASyncDBConnection::onStateChanged, this, &QueryTab::connectionStateChanged);
|
||||
connect(&m_dbConnection, &ASyncDBConnection::onNotice, this, &QueryTab::receiveNotice);
|
||||
|
||||
ui->queryEdit->setFont(UserConfiguration::instance()->codeFont());
|
||||
|
||||
highlighter = new SqlSyntaxHighlighter(ui->queryEdit->document());
|
||||
auto open_database = context()-> getDatabase();
|
||||
auto open_database = context()->getDatabase();
|
||||
if (open_database) {
|
||||
auto cat = open_database->catalog();
|
||||
highlighter->setTypes(*cat->types());
|
||||
|
|
@ -49,6 +52,8 @@ QueryTab::QueryTab(IPluginContentWidgetContext *context_, QWidget *parent)
|
|||
&QueryParamListController::on_addParam);
|
||||
connect(ui->removeButton, &QPushButton::clicked, m_queryParamListController,
|
||||
&QueryParamListController::on_removeParam);
|
||||
|
||||
context()->QueueTask([this]() { startConnect(); });
|
||||
}
|
||||
|
||||
QueryTab::~QueryTab()
|
||||
|
|
@ -58,14 +63,6 @@ QueryTab::~QueryTab()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void QueryTab::setConfig(const ConnectionConfig &config,
|
||||
std::shared_ptr<PgDatabaseCatalog> cat)
|
||||
{
|
||||
m_config = config;
|
||||
m_catalog = cat;
|
||||
context()->QueueTask([this]() { startConnect(); });
|
||||
}
|
||||
|
||||
bool QueryTab::canClose()
|
||||
{
|
||||
bool can_close;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue