forked from qt-creator/qt-creator
Doc: edit extensionsystem documentation
Use standard wording and fix some and style issues. Change-Id: I6c226f8b8600833666f1da34f1f1e71cb333f30a Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -86,19 +86,20 @@ enum { debugLeaks = 0 };
|
|||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
\section1 Plugins
|
\section1 Plugins
|
||||||
Plugins consist of an xml descriptor file, and of a library that contains a Qt plugin
|
Plugins consist of an XML descriptor file, and of a library that contains a Qt plugin
|
||||||
(declared via Q_EXPORT_PLUGIN) that must derive from the IPlugin class.
|
(declared via Q_EXPORT_PLUGIN) that must derive from the IPlugin class.
|
||||||
The plugin manager is used to set a list of file system directories to search for
|
The plugin manager is used to set a list of file system directories to search for
|
||||||
plugins, retrieve information about the state of these plugins, and to load them.
|
plugins, retrieve information about the state of these plugins, and to load them.
|
||||||
|
|
||||||
Usually the application creates a PluginManager instance and initiates the loading.
|
Usually, the application creates a PluginManager instance and initiates the
|
||||||
|
loading.
|
||||||
\code
|
\code
|
||||||
ExtensionSystem::PluginManager *manager = new ExtensionSystem::PluginManager();
|
ExtensionSystem::PluginManager *manager = new ExtensionSystem::PluginManager();
|
||||||
manager->setPluginPaths(QStringList() << "plugins"); // 'plugins' and subdirs will be searched for plugins
|
manager->setPluginPaths(QStringList() << "plugins"); // 'plugins' and subdirs will be searched for plugins
|
||||||
manager->loadPlugins(); // try to load all the plugins
|
manager->loadPlugins(); // try to load all the plugins
|
||||||
\endcode
|
\endcode
|
||||||
Additionally it is possible to directly access to the plugin specifications
|
Additionally, it is possible to directly access the plugin specifications
|
||||||
(the information in the descriptor file), and the plugin instances (via PluginSpec),
|
(the information in the descriptor file), the plugin instances (via PluginSpec),
|
||||||
and their state.
|
and their state.
|
||||||
|
|
||||||
\section1 Object Pool
|
\section1 Object Pool
|
||||||
@@ -198,26 +199,28 @@ enum { debugLeaks = 0 };
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void PluginManager::objectAdded(QObject *obj)
|
\fn void PluginManager::objectAdded(QObject *obj)
|
||||||
Signal that \a obj has been added to the object pool.
|
Signals that \a obj has been added to the object pool.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void PluginManager::aboutToRemoveObject(QObject *obj)
|
\fn void PluginManager::aboutToRemoveObject(QObject *obj)
|
||||||
Signal that \a obj will be removed from the object pool.
|
Signals that \a obj will be removed from the object pool.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void PluginManager::pluginsChanged()
|
\fn void PluginManager::pluginsChanged()
|
||||||
Signal that the list of available plugins has changed.
|
Signals that the list of available plugins has changed.
|
||||||
|
|
||||||
\sa plugins()
|
\sa plugins()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn T *PluginManager::getObject() const
|
\fn T *PluginManager::getObject()
|
||||||
Retrieve the object of a given type from the object pool.
|
|
||||||
This method is aware of Aggregation::Aggregate, i.e. it uses
|
Retrieves the object of a given type from the object pool.
|
||||||
the Aggregation::query methods instead of qobject_cast to
|
|
||||||
|
This method is aware of Aggregation::Aggregate. That is, it uses
|
||||||
|
the \c Aggregation::query methods instead of \c qobject_cast to
|
||||||
determine the type of an object.
|
determine the type of an object.
|
||||||
If there are more than one object of the given type in
|
If there are more than one object of the given type in
|
||||||
the object pool, this method will choose an arbitrary one of them.
|
the object pool, this method will choose an arbitrary one of them.
|
||||||
@@ -226,10 +229,12 @@ enum { debugLeaks = 0 };
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QList<T *> PluginManager::getObjects() const
|
\fn QList<T *> PluginManager::getObjects()
|
||||||
Retrieve all objects of a given type from the object pool.
|
|
||||||
This method is aware of Aggregation::Aggregate, i.e. it uses
|
Retrieves all objects of a given type from the object pool.
|
||||||
the Aggregation::query methods instead of qobject_cast to
|
|
||||||
|
This method is aware of Aggregation::Aggregate. That is, it uses
|
||||||
|
the \c Aggregation::query methods instead of \c qobject_cast to
|
||||||
determine the type of an object.
|
determine the type of an object.
|
||||||
|
|
||||||
\sa addObject()
|
\sa addObject()
|
||||||
@@ -246,7 +251,7 @@ static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two)
|
|||||||
PluginManager *PluginManager::m_instance = 0;
|
PluginManager *PluginManager::m_instance = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get the unique plugin manager instance.
|
Gets the unique plugin manager instance.
|
||||||
*/
|
*/
|
||||||
PluginManager *PluginManager::instance()
|
PluginManager *PluginManager::instance()
|
||||||
{
|
{
|
||||||
@@ -254,7 +259,7 @@ PluginManager *PluginManager::instance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Create a plugin manager. Should be done only once per application.
|
Creates a plugin manager. Should be done only once per application.
|
||||||
*/
|
*/
|
||||||
PluginManager::PluginManager()
|
PluginManager::PluginManager()
|
||||||
: d(new PluginManagerPrivate(this))
|
: d(new PluginManagerPrivate(this))
|
||||||
@@ -272,7 +277,9 @@ PluginManager::~PluginManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Add the given object \a obj to the object pool, so it can be retrieved again from the pool by type.
|
Adds the object \a obj to the object pool, so it can be retrieved
|
||||||
|
again from the pool by type.
|
||||||
|
|
||||||
The plugin manager does not do any memory management - added objects
|
The plugin manager does not do any memory management - added objects
|
||||||
must be removed from the pool and deleted manually by whoever is responsible for the object.
|
must be removed from the pool and deleted manually by whoever is responsible for the object.
|
||||||
|
|
||||||
@@ -297,8 +304,10 @@ void PluginManager::removeObject(QObject *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Retrieve the list of all objects in the pool, unfiltered.
|
Retrieves the list of all objects in the pool, unfiltered.
|
||||||
Usually clients do not need to call this.
|
|
||||||
|
Usually, clients do not need to call this function.
|
||||||
|
|
||||||
\sa PluginManager::getObject()
|
\sa PluginManager::getObject()
|
||||||
\sa PluginManager::getObjects()
|
\sa PluginManager::getObjects()
|
||||||
*/
|
*/
|
||||||
@@ -388,7 +397,8 @@ void PluginManager::setFileExtension(const QString &extension)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Define the user specific settings to use for information about enabled/disabled plugins.
|
Defines the user specific settings to use for information about enabled and
|
||||||
|
disabled plugins.
|
||||||
Needs to be set before the plugin search path is set with setPluginPaths().
|
Needs to be set before the plugin search path is set with setPluginPaths().
|
||||||
*/
|
*/
|
||||||
void PluginManager::setSettings(QSettings *settings)
|
void PluginManager::setSettings(QSettings *settings)
|
||||||
@@ -397,7 +407,8 @@ void PluginManager::setSettings(QSettings *settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Define the global (user-independent) settings to use for information about default disabled plugins.
|
Defines the global (user-independent) settings to use for information about
|
||||||
|
default disabled plugins.
|
||||||
Needs to be set before the plugin search path is set with setPluginPaths().
|
Needs to be set before the plugin search path is set with setPluginPaths().
|
||||||
*/
|
*/
|
||||||
void PluginManager::setGlobalSettings(QSettings *settings)
|
void PluginManager::setGlobalSettings(QSettings *settings)
|
||||||
@@ -406,7 +417,8 @@ void PluginManager::setGlobalSettings(QSettings *settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the user specific settings used for information about enabled/disabled plugins.
|
Returns the user specific settings used for information about enabled and
|
||||||
|
disabled plugins.
|
||||||
*/
|
*/
|
||||||
QSettings *PluginManager::settings()
|
QSettings *PluginManager::settings()
|
||||||
{
|
{
|
||||||
@@ -427,7 +439,7 @@ void PluginManager::writeSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The arguments left over after parsing (Neither startup nor plugin
|
The arguments left over after parsing (that were neither startup nor plugin
|
||||||
arguments). Typically, this will be the list of files to open.
|
arguments). Typically, this will be the list of files to open.
|
||||||
*/
|
*/
|
||||||
QStringList PluginManager::arguments()
|
QStringList PluginManager::arguments()
|
||||||
@@ -457,7 +469,7 @@ QHash<QString, PluginCollection *> PluginManager::pluginCollections()
|
|||||||
static const char argumentKeywordC[] = ":arguments";
|
static const char argumentKeywordC[] = ":arguments";
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Serialize plugin options and arguments for sending in a single string
|
Serializes plugin options and arguments for sending in a single string
|
||||||
via QtSingleApplication:
|
via QtSingleApplication:
|
||||||
":myplugin|-option1|-option2|:arguments|argument1|argument2",
|
":myplugin|-option1|-option2|:arguments|argument1|argument2",
|
||||||
as a list of lists started by a keyword with a colon. Arguments are last.
|
as a list of lists started by a keyword with a colon. Arguments are last.
|
||||||
@@ -591,7 +603,7 @@ static inline void formatOption(QTextStream &str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Format the startup options of the plugin manager for command line help.
|
Formats the startup options of the plugin manager for command line help.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
|
void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
|
||||||
@@ -616,7 +628,7 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Format the plugin options of the plugin specs for command line help.
|
Formats the plugin options of the plugin specs for command line help.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
|
void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
|
||||||
@@ -636,7 +648,7 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Format the version of the plugin specs for command line help.
|
Formats the version of the plugin specs for command line help.
|
||||||
*/
|
*/
|
||||||
void PluginManager::formatPluginVersions(QTextStream &str)
|
void PluginManager::formatPluginVersions(QTextStream &str)
|
||||||
{
|
{
|
||||||
@@ -743,7 +755,8 @@ QString PluginManager::testDataDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Create a profiling entry showing the elapsed time if profiling is activated.
|
Creates a profiling entry showing the elapsed time if profiling is
|
||||||
|
activated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PluginManager::profilingReport(const char *what, const PluginSpec *spec)
|
void PluginManager::profilingReport(const char *what, const PluginSpec *spec)
|
||||||
@@ -1313,7 +1326,7 @@ void PluginManagerPrivate::profilingSummary() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieves one object with a given name from the object pool.
|
Retrieves one object with \a name from the object pool.
|
||||||
\sa addObject()
|
\sa addObject()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1329,7 +1342,8 @@ QObject *PluginManager::getObjectByName(const QString &name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Retrieves one object inheriting a class with a given name from the object pool.
|
Retrieves one object inheriting a class with \a className from the object
|
||||||
|
pool.
|
||||||
\sa addObject()
|
\sa addObject()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -66,8 +66,9 @@
|
|||||||
\brief The PluginDependency class contains the name and required compatible
|
\brief The PluginDependency class contains the name and required compatible
|
||||||
version number of a plugin's dependency.
|
version number of a plugin's dependency.
|
||||||
|
|
||||||
This reflects the data of a dependency tag in the plugin's xml description file.
|
This reflects the data of a dependency tag in the plugin's XML description
|
||||||
The name and version are used to resolve the dependency, i.e. a plugin with the given name and
|
file. The name and version are used to resolve the dependency. That is,
|
||||||
|
a plugin with the given name and
|
||||||
plugin \c {compatibility version <= dependency version <= plugin version} is searched for.
|
plugin \c {compatibility version <= dependency version <= plugin version} is searched for.
|
||||||
|
|
||||||
See also ExtensionSystem::IPlugin for more information about plugin dependencies and
|
See also ExtensionSystem::IPlugin for more information about plugin dependencies and
|
||||||
@@ -115,14 +116,15 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum ExtensionSystem::PluginSpec::State
|
\enum ExtensionSystem::PluginSpec::State
|
||||||
|
The State enum indicates the states the plugin goes through while
|
||||||
|
it is being loaded.
|
||||||
|
|
||||||
The plugin goes through several steps while being loaded.
|
|
||||||
The state gives a hint on what went wrong in case of an error.
|
The state gives a hint on what went wrong in case of an error.
|
||||||
|
|
||||||
\value Invalid
|
\value Invalid
|
||||||
Starting point: Even the xml description file was not read.
|
Starting point: Even the XML description file was not read.
|
||||||
\value Read
|
\value Read
|
||||||
The xml description file has been successfully read, and its
|
The XML description file has been successfully read, and its
|
||||||
information is available via the PluginSpec.
|
information is available via the PluginSpec.
|
||||||
\value Resolved
|
\value Resolved
|
||||||
The dependencies given in the description file have been
|
The dependencies given in the description file have been
|
||||||
@@ -236,7 +238,8 @@ QString PluginSpec::description() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The plugin url where you can find more information about the plugin. This is valid after the PluginSpec::Read state is reached.
|
The plugin URL where you can find more information about the plugin.
|
||||||
|
This is valid after the PluginSpec::Read state is reached.
|
||||||
*/
|
*/
|
||||||
QString PluginSpec::url() const
|
QString PluginSpec::url() const
|
||||||
{
|
{
|
||||||
@@ -253,7 +256,7 @@ QString PluginSpec::category() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if the plugin has its experimental flag set.
|
Returns whether the plugin has its experimental flag set.
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isExperimental() const
|
bool PluginSpec::isExperimental() const
|
||||||
{
|
{
|
||||||
@@ -261,7 +264,7 @@ bool PluginSpec::isExperimental() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if the plugin is disabled by default.
|
Returns whether the plugin is disabled by default.
|
||||||
This might be because the plugin is experimental, or because
|
This might be because the plugin is experimental, or because
|
||||||
the plugin manager's settings define it as disabled by default.
|
the plugin manager's settings define it as disabled by default.
|
||||||
*/
|
*/
|
||||||
@@ -271,10 +274,12 @@ bool PluginSpec::isDisabledByDefault() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if the plugin should be loaded at startup. True by default
|
Returns whether the plugin should be loaded at startup. True by default.
|
||||||
|
|
||||||
The user can change it from the Plugin settings.
|
The user can change it from the Plugin settings.
|
||||||
Note: That this function returns true even if a plugin is disabled because
|
|
||||||
of a not loaded dependencies, or a error in loading.
|
\note This function returns true even if a plugin is disabled because its
|
||||||
|
dependencies were not loaded, or an error occurred during loading it.
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isEnabledInSettings() const
|
bool PluginSpec::isEnabledInSettings() const
|
||||||
{
|
{
|
||||||
@@ -282,7 +287,7 @@ bool PluginSpec::isEnabledInSettings() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if the plugin is loaded at startup.
|
Returns whether the plugin is loaded at startup.
|
||||||
\see PluginSpec::isEnabled
|
\see PluginSpec::isEnabled
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isEffectivelyEnabled() const
|
bool PluginSpec::isEffectivelyEnabled() const
|
||||||
@@ -301,7 +306,7 @@ bool PluginSpec::isDisabledIndirectly() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if the plugin is enabled via the -load option on the command line.
|
Returns whether the plugin is enabled via the -load option on the command line.
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isForceEnabled() const
|
bool PluginSpec::isForceEnabled() const
|
||||||
{
|
{
|
||||||
@@ -309,7 +314,7 @@ bool PluginSpec::isForceEnabled() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if the plugin is disabled via the -noload option on the command line.
|
Returns whether the plugin is disabled via the -noload option on the command line.
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isForceDisabled() const
|
bool PluginSpec::isForceDisabled() const
|
||||||
{
|
{
|
||||||
@@ -334,7 +339,7 @@ PluginSpec::PluginArgumentDescriptions PluginSpec::argumentDescriptions() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The absolute path to the directory containing the plugin xml description file
|
The absolute path to the directory containing the plugin XML description file
|
||||||
this PluginSpec corresponds to.
|
this PluginSpec corresponds to.
|
||||||
*/
|
*/
|
||||||
QString PluginSpec::location() const
|
QString PluginSpec::location() const
|
||||||
@@ -343,7 +348,7 @@ QString PluginSpec::location() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The absolute path to the plugin xml description file (including the file name)
|
The absolute path to the plugin XML description file (including the file name)
|
||||||
this PluginSpec corresponds to.
|
this PluginSpec corresponds to.
|
||||||
*/
|
*/
|
||||||
QString PluginSpec::filePath() const
|
QString PluginSpec::filePath() const
|
||||||
@@ -352,7 +357,7 @@ QString PluginSpec::filePath() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Command line arguments specific to that plugin. Set at startup
|
Command line arguments specific to the plugin. Set at startup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QStringList PluginSpec::arguments() const
|
QStringList PluginSpec::arguments() const
|
||||||
@@ -361,7 +366,7 @@ QStringList PluginSpec::arguments() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the command line arguments specific to that plugin to \a arguments.
|
Sets the command line arguments specific to the plugin to \a arguments.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PluginSpec::setArguments(const QStringList &arguments)
|
void PluginSpec::setArguments(const QStringList &arguments)
|
||||||
@@ -370,7 +375,7 @@ void PluginSpec::setArguments(const QStringList &arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Adds \a argument to the command line arguments specific to that plugin.
|
Adds \a argument to the command line arguments specific to the plugin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PluginSpec::addArgument(const QString &argument)
|
void PluginSpec::addArgument(const QString &argument)
|
||||||
@@ -405,7 +410,7 @@ QString PluginSpec::errorString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns if this plugin can be used to fill in a dependency of the given
|
Returns whether this plugin can be used to fill in a dependency of the given
|
||||||
\a pluginName and \a version.
|
\a pluginName and \a version.
|
||||||
|
|
||||||
\sa PluginSpec::dependencies()
|
\sa PluginSpec::dependencies()
|
||||||
|
@@ -45,9 +45,9 @@
|
|||||||
\brief The PluginView class implements a widget that shows a list of all
|
\brief The PluginView class implements a widget that shows a list of all
|
||||||
plugins and their state.
|
plugins and their state.
|
||||||
|
|
||||||
This can be embedded e.g. in a dialog in the application that
|
This class can be embedded for example in a dialog in the application that
|
||||||
uses the plugin manager.
|
uses the plugin manager.
|
||||||
The class also provides notifications for interactions with the list.
|
The class also provides notifications for interaction with the list.
|
||||||
|
|
||||||
\sa ExtensionSystem::PluginDetailsView
|
\sa ExtensionSystem::PluginDetailsView
|
||||||
\sa ExtensionSystem::PluginErrorView
|
\sa ExtensionSystem::PluginErrorView
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\fn void PluginView::pluginActivated(ExtensionSystem::PluginSpec *spec)
|
\fn void PluginView::pluginActivated(ExtensionSystem::PluginSpec *spec)
|
||||||
The plugin list entry corresponding to \a spec has been activated,
|
The plugin list entry corresponding to \a spec has been activated,
|
||||||
e.g. by a double-click.
|
for example by a double-click.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using namespace ExtensionSystem;
|
using namespace ExtensionSystem;
|
||||||
|
Reference in New Issue
Block a user