diff options
author | Daniel Teske <daniel.teske@digia.com> | 2013-02-12 13:19:15 +0100 |
---|---|---|
committer | Daniel Teske <daniel.teske@digia.com> | 2013-02-19 15:09:47 +0100 |
commit | d3aaa769321649ab888354c0ecabbc9798cce662 (patch) | |
tree | 8a8d861d1379a4e876ddc03117ef32e97c1afd5f /src/libs/extensionsystem/pluginspec.cpp | |
parent | 16b6079895b32a6a7797d2e03ddc59b9965331ab (diff) |
PluginManager: Implement -load %plugin% option
This loads a plugin that is disabled by default.
Change-Id: Ibbc9849c417519904fe1e69a46f93a7cc1c7edc8
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/libs/extensionsystem/pluginspec.cpp')
-rw-r--r-- | src/libs/extensionsystem/pluginspec.cpp | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 0bb767100c..87a70d09c2 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -295,9 +295,20 @@ bool PluginSpec::isEnabledInSettings() const } /*! + \fn bool PluginSpec::isEffectivelyEnabled() const + Returns if the plugin is loaded at startup. + \see PluginSpec::isEnabled +*/ +bool PluginSpec::isEffectivelyEnabled() const +{ + return !d->disabledIndirectly + && (d->enabledInSettings || d->forceEnabled) + && !d->forceDisabled; +} + +/*! \fn bool PluginSpec::isDisabledIndirectly() const - Returns true if loading was not done due to user unselecting this plugin or its dependencies, - or if command-line parameter -noload was used. + Returns true if loading was not done due to user unselecting this plugin or its dependencies. */ bool PluginSpec::isDisabledIndirectly() const { @@ -305,6 +316,24 @@ bool PluginSpec::isDisabledIndirectly() const } /*! + \fn bool PluginSpec::isForceEnabled() const + Returns if the plugin is enabled via the -load option on the command line. +*/ +bool PluginSpec::isForceEnabled() const +{ + return d->forceEnabled; +} + +/*! + \fn bool PluginSpec::isForceDisabled() const + Returns if the plugin is disabled via the -noload option on the command line. +*/ +bool PluginSpec::isForceDisabled() const +{ + return d->forceDisabled; +} + +/*! \fn QList<PluginDependency> PluginSpec::dependencies() const The plugin dependencies. This is valid after the PluginSpec::Read state is reached. */ @@ -473,6 +502,8 @@ PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec) disabledByDefault(false), enabledInSettings(true), disabledIndirectly(false), + forceEnabled(false), + forceDisabled(false), plugin(0), state(PluginSpec::Invalid), hasError(false), @@ -544,6 +575,20 @@ void PluginSpec::setDisabledIndirectly(bool value) d->disabledIndirectly = value; } +void PluginSpec::setForceEnabled(bool value) +{ + d->forceEnabled = value; + if (value) + d->forceDisabled = false; +} + +void PluginSpec::setForceDisabled(bool value) +{ + if (value) + d->forceEnabled = false; + d->forceDisabled = value; +} + /*! \fn bool PluginSpecPrivate::reportError(const QString &err) \internal @@ -903,7 +948,7 @@ void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled() if (it.key().type == PluginDependency::Optional) continue; PluginSpec *dependencySpec = it.value(); - if (dependencySpec->isDisabledIndirectly() || !dependencySpec->isEnabledInSettings()) { + if (!dependencySpec->isEffectivelyEnabled()) { disabledIndirectly = true; break; } |