CatalogInspector is normal QWidget now

added actions to open the inspector
This commit is contained in:
eelke 2019-08-15 16:38:01 +02:00
parent edb789ca4a
commit 09ef4cdf6b
4 changed files with 62 additions and 57 deletions

View file

@ -1,7 +1,6 @@
#include "CatalogInspector.h"
#include "OpenDatabase.h"
#include "UserConfiguration.h"
#include "plugin_support/IPluginContentWidgetContext.h"
#include "widgets/CatalogFunctionsPage.h"
#include "widgets/CatalogSequencesPage.h"
#include "widgets/CatalogTablesPage.h"
@ -12,8 +11,8 @@
#include <QVBoxLayout>
#include <unordered_set>
CatalogInspector::CatalogInspector(IPluginContentWidgetContext *context_, PluginModule *module, QWidget *parent)
: PluginContentWidget(context_, module, parent)
CatalogInspector::CatalogInspector(std::shared_ptr<OpenDatabase> open_database, QWidget *parent)
: QWidget(parent)
{
m_tabWidget = new QTabWidget(this);
m_tablesPage = new CatalogTablesPage(this);
@ -27,8 +26,7 @@ CatalogInspector::CatalogInspector(IPluginContentWidgetContext *context_, Plugin
m_tabWidget->addTab(m_functionsPage, "");
m_tabWidget->addTab(m_sequencesPage, "");
auto db = context_->getObject<OpenDatabase>();
setCatalog(db->catalog());
setCatalog(open_database->catalog());
retranslateUi(false);
}
@ -75,32 +73,5 @@ void CatalogInspector::setNamespaceFilter(NamespaceFilter filter)
default:
break;
}
context()->setCaption(this, caption, hint);
// context()->setCaption(this, caption, hint);
}
void CatalogInspectorModule::init()
{
registerModuleAction("open",
[this] (IPluginContentWidgetContext* context,
const ModuleActionParameters &params)
{
moduleAction_open(context, params);
});
}
void CatalogInspectorModule::moduleAction_open(
IPluginContentWidgetContext* context,
const ModuleActionParameters &params
)
{
auto ct = new CatalogInspector(context, this);
context->addContentWidget(ct);
auto nsf = params.at("namespace-filter").toString();
NamespaceFilter filter = NamespaceFilter::User;
if (nsf == "pg_catalog") filter = NamespaceFilter::PgCatalog;
else if (nsf == "information_schema") filter = NamespaceFilter::InformationSchema;
ct->setNamespaceFilter(filter);
}
REGISTER_PLUGIN_MODULE_CAT(CatalogInspectorModule, "Catalog inspector tool",
"pglab.catalog-inspector", "database")