|
Albert
|
#include <albert/pluginloader.h>
Asynchronous plugin loader.
Turns a physical plugin into a logical plugin instance.
Errors are intentionally not logged. Thats the responsibility of the plugin implementation. On errors, implementations are expected to throw a localized message and print english logs using their logging category.
Implementations have to set current_loader before calling the constructor of the plugin instance. This avoids injection mechanisms and therefore reduces boilerplate for PluginInstance implementations.
Implementations have to emit finished(), when the loading process finished. On success instance() returns a valid PluginInstance. info contains additional information. On error instance() returns a nullptr, i.e. the plugin failed to load, info is an error message.
Inherits QObject.
Public Member Functions | |
| virtual QString | path () const =0 |
| Returns the path to the plugin. | |
| virtual const PluginMetadata & | metadata () const =0 |
| Returns the plugin metadata. | |
| virtual void | load ()=0 |
| Starts asynchronous loading process of the plugin. | |
| virtual void | unload ()=0 |
| Unloads the plugin. | |
| virtual albert::PluginInstance * | instance ()=0 |
Returns the PluginInstance if the plugin is loaded, else nullptr. | |
Static Public Attributes | |
| static thread_local PluginLoader * | current_loader |
| The static injection pointer. | |
Signals | |
| void | finished (QString info) |
| Emitted when the loading process finished. | |