The ExtensionSystemCore class is the core of the Qtilities extension system library. More...
#include <ExtensionSystemCore.h>
Public Slots | |
void | handlePluginConfigurationChange (QList< QObject * > active_plugins, QList< QObject * > inactive_plugins) |
Handle plugin configuration changes. |
Signals | |
void | newProgressMessage (const QString &message) |
Progress messages submitted during application startup. | |
void | pluginLoadingCompleted () |
Signal which is emitted when the plugin loading completed. | |
void | pluginLoadingStarted () |
Signal which is emitted when the plugin loading started. | |
void | pluginPathsChanged (const QStringList &plugin_paths) |
Signal which is emitted when the plugin paths changed. |
Public Member Functions | |
QString | activePluginConfigurationFile () const |
Gets the name of the current plugin configuration set's file. | |
QStringList | activePlugins () const |
Function to return the names of all plugins that are loaded and initialized at present. | |
void | addPluginPath (const QString &path) |
Function to add a custom plugin path. | |
QWidget * | configWidget () |
Returns a widget with information about loaded plugins. | |
QStringList | corePlugins () const |
Function to return the names of all core plugins. | |
void | disablePluginActivityControl () |
Disables plugin activity control in the plugin details widget. | |
void | disablePluginActivityDisplay () |
Disables plugin activity display in the plugin details widget. | |
void | enablePluginActivityControl () |
Disables plugin activity control in the plugin details widget. | |
void | enablePluginActivityDisplay () |
Disables plugin activity display in the plugin details widget. | |
QStringList | filteredPlugins () const |
Function to return the file names of all plugins which as not loaded during the initialize() function call. | |
QStringList | filteredPluginsCurrentSet () const |
Function to return the filter expression of the current plugin configuration set. | |
void | finalize () |
Finalizes the plugin manager by unloading and finalizing all plugins. | |
Interfaces::IPlugin * | findPlugin (const QString &plugin_name) const |
Function which finds the plugin with the given plugin_name and returns its plugin interface. If no plugin exists with that name in the set of loaded plugins (active and inactive plugins), null is returned. | |
QStringList | inactivePlugins () const |
Function to return the names of all plugins that are loaded but not initialized at present. | |
QStringList | inactivePluginsCurrentSet () const |
Function to return the filter expression of the current plugin configuration set. | |
void | initialize () |
Initializes the plugin manager by loading all found plugins. | |
bool | isPluginActivityControlEnabled () const |
Indicates if plugin activity can be changed by the user in the plugin details widget. | |
bool | isPluginActivityDisplayEnabled () const |
Indicates if plugin activity is displayed in the plugin details widget. | |
bool | loadPluginConfiguration (QString file_name=QString(), QStringList *inactive_plugins=0, QStringList *filtered_plugins=0) |
Function which loads a plugin configuration file. | |
QStringList | pluginPaths () const |
Function to get the paths from where plugins are loaded. | |
bool | savePluginConfiguration (QString file_name=QString(), QStringList *inactive_plugins=0, QStringList *filtered_plugins=0, Qtilities::ExportVersion version=Qtilities::Qtilities_Latest, QString *errorMsg=0) const |
Function which saves a plugin configuration file for the given parameters. | |
void | setActivePluginConfigurationFile (const QString &file_name) |
Sets the name of the current plugin configuration set's file. | |
void | setCorePlugins (QStringList core_plugins) |
Function to set the names of all plugins which should be handled as core plugins. That is, they cannot be made inactive by an user. | |
void | setFilteredPlugins (QStringList filtered_plugins) |
Function to set the file names of all plugins which should not be loaded during the initialize() function call. | |
void | setInactivePlugins (QStringList inactive_plugins) |
Function to set the names of all plugins that is loaded but not initialized at present. |
The ExtensionSystemCore class is the core of the Qtilities extension system library.
The extension system core class is a singleton which is used to load plugins.
See the Extension System article for more information about the Qtilities extension system.
QString Qtilities::ExtensionSystem::ExtensionSystemCore::activePluginConfigurationFile | ( | ) | const |
Gets the name of the current plugin configuration set's file.
When loadPluginConfiguration() is loaded with a valid file, this function will return the file name that was loaded. Otherwise it will return "App_Path/plugins/default" + qti_def_SUFFIX_PLUGIN_CONFIG.
QStringList Qtilities::ExtensionSystem::ExtensionSystemCore::activePlugins | ( | ) | const |
Function to return the names of all plugins that are loaded and initialized at present.
void Qtilities::ExtensionSystem::ExtensionSystemCore::addPluginPath | ( | const QString & | path | ) |
Function to add a custom plugin path.
By default plugins are loaded only from the /plugins folder in the application directory. Using this function it is possible to add as many paths as you wish to the plugin loading process.
In order for path
to be added it must exist and it should not exist as a custom plugin path yet.
QStringList Qtilities::ExtensionSystem::ExtensionSystemCore::corePlugins | ( | ) | const |
Function to return the names of all core plugins.
QStringList Qtilities::ExtensionSystem::ExtensionSystemCore::filteredPlugins | ( | ) | const |
Function to return the file names of all plugins which as not loaded during the initialize() function call.
void Qtilities::ExtensionSystem::ExtensionSystemCore::finalize | ( | ) |
Finalizes the plugin manager by unloading and finalizing all plugins.
Will call finalize on all plugins in the order that they were loaded. Thus the order can be random.
QStringList Qtilities::ExtensionSystem::ExtensionSystemCore::inactivePlugins | ( | ) | const |
Function to return the names of all plugins that are loaded but not initialized at present.
void Qtilities::ExtensionSystem::ExtensionSystemCore::initialize | ( | ) |
Initializes the plugin manager by loading all found plugins.
Will load all plugins in the specified plugin paths. Once an IPlugin interface is discovered, initialize() will be called on it. When all the plugins in the system are loaded, the initializeDependencies() funciton will be called on each plugin.
When enablePluginActivityControl() is true, the initialize() function will attempt to load the default plugin configuration set in the file specified by activePluginConfigurationFile(). If you want to load a file other than the default configuration file you can set it using setActivePluginConfigurationFile() before calling initialize().
It is important to note that the IPlugin implementations loaded through initialize() should live in the same thread as the extension system core instance. Thus you should not move your plugin to a different thread during its lifetime.
bool Qtilities::ExtensionSystem::ExtensionSystemCore::isPluginActivityControlEnabled | ( | ) | const |
Indicates if plugin activity can be changed by the user in the plugin details widget.
False by default.
bool Qtilities::ExtensionSystem::ExtensionSystemCore::isPluginActivityDisplayEnabled | ( | ) | const |
Indicates if plugin activity is displayed in the plugin details widget.
False by default.
bool Qtilities::ExtensionSystem::ExtensionSystemCore::loadPluginConfiguration | ( | QString | file_name = QString() , |
QStringList * | inactive_plugins = 0 , |
||
QStringList * | filtered_plugins = 0 |
||
) |
Function which loads a plugin configuration file.
Loads a plugin configuration from a file. Before initialization the function can be called with inactive_plugins
= 0 and filtered_plugins
= 0 in order to load the plugin configuration to be used in initialize(). After initialization you must pass proper values for inactive_plugins
and filtered_plugins
in order for the function to work. False will be returned when this requirement is not met. The reason for this is that the extension system's configuration set cannot be changed again after initialization since the plugins would have been loaded at that time.
file_name | When empty the file name in activePluginConfigurationFile() will be used. When empty the default plugin configuration file is used. The default plugin file is located at QtilitiesApplication::applicationSessionPath()/Plugins/default.pconfig. For more information, see Qtilities::CoreGui::QtilitiesApplication::applicationSessionPath(). |
inactive_plugins | The QStringList to be populated with the inactive plugin names found in the input file. When null, the inactive plugins in the extension system's active plugin configuration will be set. See setInactivePlugins() for more information. |
filtered_plugins | The QStringList to be populated with the plugin filter expressions found in the input file. When null, the filtered plugins in the extension system's active plugin configuration will be set. See setFilteredPlugins() for more information. |
|
signal |
Signal which is emitted when the plugin loading completed.
This class was added in Qtilities v1.1.
|
signal |
Signal which is emitted when the plugin loading started.
This class was added in Qtilities v1.1.
QStringList Qtilities::ExtensionSystem::ExtensionSystemCore::pluginPaths | ( | ) | const |
Function to get the paths from where plugins are loaded.
|
signal |
Signal which is emitted when the plugin paths changed.
This class was added in Qtilities v1.3.
bool Qtilities::ExtensionSystem::ExtensionSystemCore::savePluginConfiguration | ( | QString | file_name = QString() , |
QStringList * | inactive_plugins = 0 , |
||
QStringList * | filtered_plugins = 0 , |
||
Qtilities::ExportVersion | version = Qtilities::Qtilities_Latest , |
||
QString * | errorMsg = 0 |
||
) | const |
Function which saves a plugin configuration file for the given parameters.
file_name | When empty the file name in activePluginConfigurationFile() will be used. When empty the default plugin configuration file is used. The default plugin file is located at QtilitiesApplication::applicationSessionPath()/Plugins/default.pconfig. For more information, see Qtilities::CoreGui::QtilitiesApplication::applicationSessionPath(). |
inactive_plugins | The list of plugins which must be inactive plugins in the saved configuration file. When null, extension system's active plugin configuration's inactive plugins will be used. See inactivePlugins() for more information. |
filtered_plugins | The list of plugin filter expressions which must be used the saved configuration file. When null, extension system's active plugin configuration's filtered plugins will be used. See filteredPlugins() for more information. |
void Qtilities::ExtensionSystem::ExtensionSystemCore::setCorePlugins | ( | QStringList | core_plugins | ) |
Function to set the names of all plugins which should be handled as core plugins. That is, they cannot be made inactive by an user.
Sets a list of plugin names which corresponds to the IPlugin::pluginName() implementation of the plugins which should be handled as core plugins. Note that the setInactivePlugins() function checks that you don't set a core plugin as inactive but the setFilteredPlugins() function does not do that. Thus it is possible to filter a core plugin. The developer must make sure this does not happen.
Below is an example of how you can verify that all core plugins loaded successfully:
void Qtilities::ExtensionSystem::ExtensionSystemCore::setFilteredPlugins | ( | QStringList | filtered_plugins | ) |
Function to set the file names of all plugins which should not be loaded during the initialize() function call.
Sets a list of wildcard mode regular expressions which will be evaluated during initialize(). Each plugin file that is found will be checked against this wildcard mode regular expression and if it matches the expression, it will not be loaded. See QRegExp::Wildcard for more information.
void Qtilities::ExtensionSystem::ExtensionSystemCore::setInactivePlugins | ( | QStringList | inactive_plugins | ) |
Function to set the names of all plugins that is loaded but not initialized at present.
Sets a list of plugin names which corresponds to the IPlugin::pluginName() implementation of the plugins which should be inactive on startup.
Qtilities : Reference Documentation | Back to top |
Copyright © 2009-2013, Jaco Naudé
|