Module can register action Window adds this action to its menu Clicking the menu item for the action has the expected result But menu structure still needs work (everything is now put into one dropdown menu)
40 lines
947 B
C++
40 lines
947 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;
|
|
}
|