Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
PluginManager Class Reference

Manages plugins and their associated functionality. More...

#include <plugin_manager.h>

Inheritance diagram for PluginManager:

Classes

struct  Plugin

Public Member Functions

 PluginManager (maki::PipelineActionRegistry *registry, Pipeline *pipeline, QObject *parent=nullptr)
 Constructs a new PluginManager object.
virtual ~PluginManager ()
 Destructs the PluginManager object.
VoidResult start (const PluginSettings &settings, HostServices *services)
 Starts the plugin manager and populates the menu, combo box, and services.
maki::IPlugin * currentPlugin () const
 Retrieves the currently selected plugin.
maki::IPlugin * pluginByLanguage (const QString &language) const
 Retrieves a plugin by its language.
void settingsChanged (const PluginSettings &settings, HostServices *services)
 Updates the plugins when a setting changes.
VoidResult reloadPlugin (const QString &pluginName, HostServices *services)
 Reloads a given plugin.

Private Member Functions

VoidResult loadPlugin (const QDir &pluginDir, const maki::Manifest &path, HostServices *services, PluginSettings::Status status)
 Loads a plugin from a directory and populates the menu, combo box, and services.
bool setPlugin (const QString &language)
 Sets the current plugin based on a language identifier.
Result< maki::Manifest > getPluginManifest (const QDir &path) const
 Retrieves the manifest of a plugin from a directory.
VoidResult loadPluginLibraryDir (const maki::Manifest &manifest)
 Loads a plugin library directory.
VoidResult installPlugin (const maki::Manifest &manifest)
 Run the plugin installation steps.
int getPluginIndex (const QString &pluginName) const
 Retrieves the index of a plugin in the manager's list by name.
VoidResult deregisterPlugin (const Plugin &plugin)
 Deregisters a plugin from the manager and updates the menu and combo box.

Private Attributes

QVector< Plugin > mPlugins
 Pointer to the currently selected plugin.
maki::PipelineActionRegistry * mRegistry
 List of all plugins managed by this manager.
Pipeline * mPipeline
 Holds information regarding the current generation pipeline.
QString mProgressId
 Pipeline responsible for installation processes.
bool mIsRunning
 Holds the id of the progress widget.

Detailed Description

Manages plugins and their associated functionality.

Constructor & Destructor Documentation

◆ PluginManager()

PluginManager::PluginManager ( maki::PipelineActionRegistry * registry,
Pipeline * pipeline,
QObject * parent = nullptr )

Constructs a new PluginManager object.

Parameters
parentThe parent QObject.

Member Function Documentation

◆ currentPlugin()

maki::IPlugin * PluginManager::currentPlugin ( ) const

Retrieves the currently selected plugin.

Returns
The current maki::IPlugin pointer.

◆ deregisterPlugin()

VoidResult PluginManager::deregisterPlugin ( const Plugin & plugin)
private

Deregisters a plugin from the manager and updates the menu and combo box.

Parameters
pluginThe Plugin object to deregister.
menuThe QMenu to update.
comboBoxThe QComboBox to update.

◆ getPluginIndex()

int PluginManager::getPluginIndex ( const QString & pluginName) const
private

Retrieves the index of a plugin in the manager's list by name.

Parameters
pluginNameThe name of the plugin to find.
Returns
The index of the plugin if found; -1 otherwise.

◆ getPluginManifest()

Result< maki::Manifest > PluginManager::getPluginManifest ( const QDir & path) const
private

Retrieves the manifest of a plugin from a directory.

Parameters
pathThe QDir object representing the plugin directory.
Returns
A Result<Manifest> containing the manifest or an error if not found.

◆ installPlugin()

VoidResult PluginManager::installPlugin ( const maki::Manifest & manifest)
private

Run the plugin installation steps.

Parameters
manifestThe Manifest object containing the plugin information.
Returns
A VoidResult indicating success or failure.

◆ loadPlugin()

VoidResult PluginManager::loadPlugin ( const QDir & pluginDir,
const maki::Manifest & path,
HostServices * services,
PluginSettings::Status status )
private

Loads a plugin from a directory and populates the menu, combo box, and services.

Parameters
pluginDirThe QDir object representing the plugin directory.
pathThe Manifest object containing the plugin information.
menuThe QMenu to populate with plugins.
comboBoxThe QComboBox to populate with plugin options.
servicesThe HostServices object for plugin interaction.
Returns
A VoidResult indicating success or failure.

◆ loadPluginLibraryDir()

VoidResult PluginManager::loadPluginLibraryDir ( const maki::Manifest & manifest)
private

Loads a plugin library directory.

Parameters
manifestThe Manifest object containing the plugin information.
Returns
A VoidResult indicating success or failure.

◆ pluginByLanguage()

maki::IPlugin * PluginManager::pluginByLanguage ( const QString & language) const

Retrieves a plugin by its language.

Parameters
languageThe language of the plugin to retrieve.
Returns
The corresponding maki::IPlugin pointer, or nullptr if not found.

◆ reloadPlugin()

VoidResult PluginManager::reloadPlugin ( const QString & pluginName,
HostServices * services )

Reloads a given plugin.

Parameters
pluginNameThe name of the plugin to be reloaded.
menuThe QMenu to populate with plugins.
comboBoxThe QComboBox to populate with plugin options.
servicesThe HostServices object for plugin interaction.
Returns
A VoidResult indicating success or failure.

◆ setPlugin()

bool PluginManager::setPlugin ( const QString & language)
private

Sets the current plugin based on a language identifier.

Parameters
languageThe language identifier for the plugin to set.
Returns
true if the plugin was successfully set, false otherwise.

◆ start()

VoidResult PluginManager::start ( const PluginSettings & settings,
HostServices * services )

Starts the plugin manager and populates the menu, combo box, and services.

Parameters
menuThe QMenu to populate with plugins.
comboBoxThe QComboBox to populate with plugin options.
servicesThe HostServices object for plugin interaction.
Returns
A VoidResult indicating success or failure.

The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/system/plugin_manager.h
  • /__w/maki/maki/app/system/plugin_manager.cpp