Manages the lifecycle of dynamically loaded QWidget-based plugins.
More...
#include <DesktopPluginServer.h>
|
void | pluginLoaded (const QString &pluginName, const QString &pluginPath) |
| Signal emitted when a plugin has been successfully loaded.
|
|
void | pluginFailed (const QString &pluginName, const QString &pluginPath, const QString &pluginErrorString) |
| Signal emitted when a plugin fails to load.
|
|
void | pluginUnloaded (const QString &pluginName) |
| Signal emitted when a plugin has been successfully unloaded.
|
|
void | pluginUnloadedFailed (const QString &pluginName, const QString &pluginErrorString) |
| Signal emitted when a plugin fails to unload.
|
|
void | server_ready () |
| server ready
|
|
void | server_unload () |
| server unloaded
|
|
void | server_dead () |
| server dead
|
|
|
bool | enabled { true } |
| is enabled
|
|
Manages the lifecycle of dynamically loaded QWidget-based plugins.
This class extends DesktopServerBase and provides functionalities to load, unload, and manage plugins that expose QWidget instances. It can monitor a specified directory for new or removed plugin DLLs and automatically manage them.
It emits signals to notify about the success or failure of plugin operations.
◆ DesktopWidgetPluginServer()
DesktopWidgetPluginServer::DesktopWidgetPluginServer |
( |
const QString & |
monitoring_dll, |
|
|
DesktopMainWindow * |
parent |
|
) |
| |
|
explicit |
Constructs a DesktopWidgetPluginServer instance.
- Parameters
-
monitoring_dll | The path to the directory or specific DLL to monitor for plugins. |
parent | A pointer to the DesktopMainWindow instance that this server is associated with. This window might be the parent for the loaded widgets. |
◆ ~DesktopWidgetPluginServer()
DesktopWidgetPluginServer::~DesktopWidgetPluginServer |
( |
| ) |
|
|
override |
Destroys the DesktopWidgetPluginServer object.
- This destructor ensures all loaded plugins are properly unloaded and resources are released.
◆ hooked_window()
◆ insertPlugin()
void DesktopWidgetPluginServer::insertPlugin |
( |
const QString & |
pluginName, |
|
|
const QString & |
plugin_path |
|
) |
| |
Inserts (loads) a plugin into the server.
- This method attempts to load a plugin from the given path and associates it with a unique plugin name. If the plugin is successfully loaded, the
pluginLoaded
signal is emitted. Otherwise, pluginFailed
is emitted. - Parameters
-
pluginName | A unique name to identify the plugin. |
plugin_path | The absolute file path to the plugin (DLL/shared library). |
◆ pluginFailed
void DesktopWidgetPluginServer::pluginFailed |
( |
const QString & |
pluginName, |
|
|
const QString & |
pluginPath, |
|
|
const QString & |
pluginErrorString |
|
) |
| |
|
signal |
Signal emitted when a plugin fails to load.
- Parameters
-
pluginName | The name of the plugin that failed to load. |
pluginPath | The file path of the plugin that failed. |
pluginErrorString | A descriptive string detailing the error. |
◆ pluginLoaded
void DesktopWidgetPluginServer::pluginLoaded |
( |
const QString & |
pluginName, |
|
|
const QString & |
pluginPath |
|
) |
| |
|
signal |
Signal emitted when a plugin has been successfully loaded.
- Parameters
-
pluginName | The name of the loaded plugin. |
pluginPath | The file path from which the plugin was loaded. |
◆ pluginUnloaded
void DesktopWidgetPluginServer::pluginUnloaded |
( |
const QString & |
pluginName | ) |
|
|
signal |
Signal emitted when a plugin has been successfully unloaded.
- Parameters
-
pluginName | The name of the unloaded plugin. |
◆ pluginUnloadedFailed
void DesktopWidgetPluginServer::pluginUnloadedFailed |
( |
const QString & |
pluginName, |
|
|
const QString & |
pluginErrorString |
|
) |
| |
|
signal |
Signal emitted when a plugin fails to unload.
- Parameters
-
pluginName | The name of the plugin that failed to unload. |
pluginErrorString | A descriptive string detailing the error. |
◆ queryWidget()
QWidget * DesktopWidgetPluginServer::queryWidget |
( |
const QString & |
pluginName, |
|
|
QWidget * |
expected_parent |
|
) |
| |
Queries and instantiates a QWidget from a loaded plugin.
- This method attempts to create an instance of a widget provided by the specified plugin. The plugin must expose a creatable QWidget.
- Parameters
-
pluginName | The unique name of the plugin from which to query the widget. |
expected_parent | The parent QWidget for the newly created plugin widget. |
- Returns
- A pointer to the newly created QWidget instance, or nullptr if the plugin is not found or the widget cannot be created.
◆ removeAllPlugins()
void DesktopWidgetPluginServer::removeAllPlugins |
( |
| ) |
|
Unloads and removes all currently loaded plugins.
- This method iterates through all managed plugins, unloads them, and clears the internal plugin map.
◆ scanTargetDirent()
void DesktopWidgetPluginServer::scanTargetDirent |
( |
| ) |
|
Scans the target directory for new or updated plugin DLLs.
- This method is typically called to discover plugins that have been added or modified in the
monitoring_dll
path since the last scan or initialization. It will load any new plugins found.
◆ unloadPlugin()
bool DesktopWidgetPluginServer::unloadPlugin |
( |
const QString & |
plugin_name | ) |
|
Unloads a plugin identified by its name.
- This method unloads the specified plugin, removing it from memory. If successful,
pluginUnloaded
is emitted. If unloading fails, pluginUnloadedFailed
is emitted. - Parameters
-
plugin_name | The unique name of the plugin to unload. |
- Returns
- True if the plugin was successfully unloaded, false otherwise.
The documentation for this class was generated from the following files: