pgLab/pglab/plugin_support/PluginModule.cpp
eelke b0cd47ef46 Extended the plugin system to allow for dynamic runtime bindings between modules.
As a test implementation, this allows the TablesPage to open a CrudTab for a table/view without
the need for TablesPage, CrudTab and DatabaseWindow to know anything about each other.
2018-12-31 15:26:36 +01:00

33 lines
787 B
C++

#include "plugin_support/PluginModule.h"
PluginModule::PluginModule(QString name, QString ident)
: m_name(std::move(name))
, m_ident(std::move(ident))
{
}
void PluginModule::setDisplayCategory(QString category)
{
m_displayCategory = std::move(category);
}
void PluginModule::registerAction(QAction *action, MenuLocation menu_location, ToolbarLocation toolbar_location)
{
}
void PluginModule::registerModuleAction(QString module_action, ModuleAction action)
{
m_moduleActions.emplace(
std::move(module_action),
std::move(action)
);
}
const PluginModule::ModuleAction* PluginModule::findModuleAction(const QString &module_action) const
{
auto res = m_moduleActions.find(module_action);
if (res == m_moduleActions.end())
return nullptr;
return &res->second;
}