All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions
Qtilities::ExtensionSystem::Interfaces::IPlugin Class Reference

Interface used to communicate with plugins. More...

#include <IPlugin.h>

Inheritance diagram for Qtilities::ExtensionSystem::Interfaces::IPlugin:
Inheritance graph
[legend]

List of all members.

Public Types

enum  PluginState { Functional = 0, IncompatibleState = 1, ErrorState = 2, InActive = 4 }
 The possible states in which a plugin can be. More...

Public Member Functions

void addErrorMessage (const QString &error_string)
 Adds a error message to list of error associated with the plugin.
void addErrorMessages (const QStringList &error_strings)
 Adds error messages to list of error associated with the plugin.
void addPluginState (PluginState state)
 Adds a PluginState the PluginStateFlags of the plugin.
QStringList errorMessages () const
 Gets the error messages associated with the plugin.
virtual void finalize ()
 This function is called before a plugin is unloaded in the system.
bool hasErrors () const
 Indicates if there are errors messages associated with this plugin.
virtual bool initialize (const QStringList &arguments, QStringList *error_strings)=0
 This function is called when the plugin is loaded.
virtual bool initializeDependencies (QStringList *error_strings)=0
 This function is called when all the plugins in the system were loaded and initialized.
virtual QtilitiesCategory pluginCategory () const =0
 The category of the plugin.
virtual QString pluginCopyright () const =0
 The copyright information of the plugin.
virtual QString pluginDescription () const =0
 A description for the plugin.
QString pluginFileName () const
 Gets the plugin file name.
virtual QString pluginLicense () const =0
 The licensing details of the plugin.
virtual QString pluginName () const =0
 The name of the plugin.
virtual QString pluginPublisher () const =0
 The name of the plugin's publisher.
virtual QString pluginPublisherContact () const =0
 The contact details (in the form of an email address) of the plugin's publisher.
virtual QString pluginPublisherWebsite () const =0
 The website of the plugin's publisher.
PluginStateFlags pluginState () const
 Gets the plugin state.
QString pluginStateString () const
 Function which returns a string associated with a the plugin's state.
virtual VersionInformation pluginVersionInformation () const =0
 The version information of the plugin.
void setPluginFileName (const QString &file_name)
 Sets the plugin file name.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
virtual QObject * objectBase ()=0
 Returns the QObject* base of the interface.
virtual const QObject * objectBase () const =0
 Returns a const QObject* base of the interface.
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.

Detailed Description

Interface used to communicate with plugins.


Member Enumeration Documentation

The possible states in which a plugin can be.

Enumerator:
Functional 

The plugin is fully functional and no errors were reported during initialization and dependency initialization.

IncompatibleState 

The plugin is loaded, but indicated that it is incompatible with the current version of the application it was loaded in. See errorMsg() for a list of error messages.

ErrorState 

The plugin is loaded, but errors occured. See errorMsg() for a list of error messages.

InActive 

The plugin was loaded but not initialized.

See also:
ExtensionSystemCore::setInactivePlugins().

Member Function Documentation

virtual void Qtilities::ExtensionSystem::Interfaces::IPlugin::finalize ( )
inlinevirtual

This function is called before a plugin is unloaded in the system.

If your plugin needs to do something before it is unloaded (save settings for example), do it in here.

Reimplemented in Qtilities::Plugins::Template::PluginTemplate, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Help::HelpPlugin, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Debug::DebugPlugin, and Qtilities::Plugins::SessionLog::SessionLogPlugin.

virtual bool Qtilities::ExtensionSystem::Interfaces::IPlugin::initialize ( const QStringList &  arguments,
QStringList *  error_strings 
)
pure virtual

This function is called when the plugin is loaded.

Use this implementation to register objects in the global object pool. Typically one plugin will look for objects in other plugins which implements a specific interface. These objects, the ones implementing the interfaces, must be added to the global object pool in this function.

Parameters:
argumentsA list of possible arguments to be sent to the plugin during initialization.
error_stringsPlugins can add error/warning strings to this list when they detect errors.
Returns:
True if the plugin was successfully initialized, false otherwise.

Implemented in Qtilities::Plugins::Template::PluginTemplate, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Help::HelpPlugin, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Debug::DebugPlugin, and Qtilities::Plugins::SessionLog::SessionLogPlugin.

virtual bool Qtilities::ExtensionSystem::Interfaces::IPlugin::initializeDependencies ( QStringList *  error_strings)
pure virtual

This function is called when all the plugins in the system were loaded and initialized.

If you have an object which looks for specific interfaces in the global object pool, do the search here.

Parameters:
error_stringsPlugins can add error/warning strings to this list when they detect errors.
Returns:
True if dependancies were successfully initialized, false otherwise.

Implemented in Qtilities::Plugins::Template::PluginTemplate, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Help::HelpPlugin, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Debug::DebugPlugin, and Qtilities::Plugins::SessionLog::SessionLogPlugin.

virtual VersionInformation Qtilities::ExtensionSystem::Interfaces::IPlugin::pluginVersionInformation ( ) const
pure virtual

The version information of the plugin.

If your plugin does not depend on the application it is used in, you can return an empty list of supported versions (this is the default) to let the extension system know not to check the compatibility of your plugin.

Here is an example implementation of this function:

// Create a version information object with the version of the plugin:
VersionInformation version_info(1,0,1);
// Next add a compatible application version:
VersionNumber compatible_version(1,0,0);
// Add it as a compatible version to our version information for this plugin:
version_info << compatible_version;
// Return the version information object:
return version_info;

Implemented in Qtilities::Plugins::Template::PluginTemplate, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Help::HelpPlugin, Qtilities::Plugins::ProjectManagement::ProjectManagementPlugin, Qtilities::Plugins::Debug::DebugPlugin, and Qtilities::Plugins::SessionLog::SessionLogPlugin.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé