pgLab/pglab/plugin_support/PluginModule.cpp
eelke f4f2474a81 Moved definition of widget instance actions to the module so other parts of the system can no about them.
The plugin system will create the Action objects and bind them to the specified slots of the
specific widget instances.
2019-01-05 19:58:23 +01:00

41 lines
948 B
C++

#include "plugin_support/PluginModule.h"
#include <QDebug>
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::registerMenuAction(MenuAction action)
{
qDebug() << "registerMenuAction " << action.text();
m_menuActions.emplace_back(std::move(action));
}
const PluginModule::MenuActionList& PluginModule::menuActions() const
{
return m_menuActions;
}
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;
}