Moving things from the application specific DatabaseWindow to generic LMainWindow (Leon framework)
To achieve flexibility the getDatabase call on the context which was application specific to has been replaced with a type based object registry.
This commit is contained in:
parent
4a78330153
commit
fd603a7434
5 changed files with 137 additions and 99 deletions
|
|
@ -31,8 +31,9 @@ QueryTab::QueryTab(IPluginContentWidgetContext *context_, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_config = context()->getDatabase()->config();
|
||||
m_catalog = context()->getDatabase()->catalog();
|
||||
auto db = context()->getObject<OpenDatabase>();
|
||||
m_config = db->config();
|
||||
m_catalog = db->catalog();
|
||||
|
||||
connect(&m_dbConnection, &ASyncDBConnection::onStateChanged, this, &QueryTab::connectionStateChanged);
|
||||
connect(&m_dbConnection, &ASyncDBConnection::onNotice, this, &QueryTab::receiveNotice);
|
||||
|
|
@ -40,7 +41,7 @@ QueryTab::QueryTab(IPluginContentWidgetContext *context_, QWidget *parent)
|
|||
ui->queryEdit->setFont(UserConfiguration::instance()->codeFont());
|
||||
|
||||
highlighter = new SqlSyntaxHighlighter(ui->queryEdit->document());
|
||||
auto open_database = context()->getDatabase();
|
||||
auto open_database = context()->getObject<OpenDatabase>();
|
||||
if (open_database) {
|
||||
auto cat = open_database->catalog();
|
||||
highlighter->setTypes(*cat->types());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue