Loads every bar-widget plugin into a Registry<IBarWidgetFactory> and keeps it in step with the plugins on disk. More...
#include <PhosphorRegistry/PluginLoader.h>
Signals | |
| void | rescanCompleted () |
| After every scan, whether or not anything changed. | |
| void | pluginLoaded (const QString &id) |
| A plugin's factory was registered. | |
| void | pluginUnloaded (const QString &id) |
| The catalog withdrew a plugin this loader had registered. | |
Public Member Functions | |
| PluginLoader (Registry< IBarWidgetFactory > *registry, const QList< PluginSearchPath > &searchPaths=QList< PluginSearchPath >(), QObject *parent=nullptr) | |
searchPaths highest priority first. | |
| ~PluginLoader () override | |
| void | scanAndLoad () |
| The first scan: find, load and register every plugin, and arm the watch. | |
| void | rescanNow () |
| Rescan now instead of waiting for the watch. | |
| QStringList | loadedPluginIds () const |
| The ids of the plugins currently registered, sorted. | |
| PluginCatalog & | catalog () |
| const PluginCatalog & | catalog () const |
Static Public Member Functions | |
| static PluginSeam | barWidgetSeam () |
| The bar-widget seam: plugins in <root>/bar-widget/, IID PhosphorRegistryBarWidgetPlugin_iid, ApiVersion 1. | |
Loads every bar-widget plugin into a Registry<IBarWidgetFactory> and keeps it in step with the plugins on disk.
Discovery, vetting, overrides and live reload come from a PluginCatalog over the bar-widget seam (see barWidgetSeam). A plugin's root object implements IBarWidgetPlugin. Every bar-widget plugin is loaded as soon as it comes on offer, because the bar needs every factory to lay itself out. A plugin whose id the registry already holds is not loaded at all.
A plugin the catalog withdraws (its file is gone or now refused) is unregistered and pluginUnloaded is emitted. Its library stays mapped (PluginCatalog never unloads), so widgets it already created keep working until their parents delete them. A plugin whose library failed to load is tried again once its file changes. One that loaded but handed out no usable factory keeps its loaded code until the next start.
The Registry must outlive the loader. GUI thread only.
|
explicit |
searchPaths highest priority first.
Empty means PluginCatalog::defaultSearchPaths for the bar-widget seam.
|
override |
|
staticnodiscard |
The bar-widget seam: plugins in <root>/bar-widget/, IID PhosphorRegistryBarWidgetPlugin_iid, ApiVersion 1.
|
nodiscard |
|
nodiscard |
|
nodiscard |
The ids of the plugins currently registered, sorted.
|
signal |
A plugin's factory was registered.
|
signal |
The catalog withdrew a plugin this loader had registered.
Its factory is unregistered, unless another owner has since replaced it.
|
signal |
After every scan, whether or not anything changed.
| void PhosphorRegistry::PluginLoader::rescanNow | ( | ) |
Rescan now instead of waiting for the watch.
Called from a slot that a running scan reached, the rescan runs once that scan has finished.
| void PhosphorRegistry::PluginLoader::scanAndLoad | ( | ) |
The first scan: find, load and register every plugin, and arm the watch.
It runs synchronously, so connect to the registry first to see these registrations. A second call rescans, like rescanNow.