pgLab/pglab/plugin_support/PluginRegister.h
eelke dc8a052544 Basic concept of MenuAction is working
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)
2019-01-01 11:15:16 +01:00

34 lines
668 B
C++

#ifndef PLUGINREGISTER_H
#define PLUGINREGISTER_H
#include <memory>
#include <map>
#include <mutex>
#include <QString>
class QAction;
class PluginModule;
class PluginRegister {
public:
using PluginModuleSPtr = std::shared_ptr<PluginModule>;
using ModuleMap = std::map<QString, PluginModuleSPtr>;
static PluginRegister* getInstance();
PluginRegister();
void registerModule(PluginModuleSPtr module);
void initModules();
const ModuleMap& modules() const{ return m_moduleMap; }
const PluginModule* findModule(const QString &module_ident) const;
private:
ModuleMap m_moduleMap;
static PluginRegister* s_pluginRegister;
};
#endif // PLUGINREGISTER_H