aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/extensionsystem/pluginspec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/extensionsystem/pluginspec.cpp')
-rw-r--r--src/libs/extensionsystem/pluginspec.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp
index 2158b99ac27..d2515760493 100644
--- a/src/libs/extensionsystem/pluginspec.cpp
+++ b/src/libs/extensionsystem/pluginspec.cpp
@@ -559,18 +559,17 @@ QString PluginSpec::errorString() const
}
/*!
- Returns whether this plugin can be used to fill in a dependency of the given
- \a pluginName and \a pluginVersion.
+ Returns whether the plugin \a spec can be used to fill the \a dependency of this plugin.
- \sa PluginSpec::dependencies()
+ \sa PluginSpec::dependencies()
*/
-bool PluginSpec::provides(const QString &pluginName, const QString &pluginVersion) const
+bool PluginSpec::provides(PluginSpec *spec, const PluginDependency &dependency) const
{
- if (QString::compare(pluginName, name(), Qt::CaseInsensitive) != 0)
+ if (QString::compare(dependency.name, spec->name(), Qt::CaseInsensitive) != 0)
return false;
- return (versionCompare(version(), pluginVersion) >= 0)
- && (versionCompare(compatVersion(), pluginVersion) <= 0);
+ return (versionCompare(spec->version(), dependency.version) >= 0)
+ && (versionCompare(spec->compatVersion(), dependency.version) <= 0);
}
/*!
@@ -627,10 +626,14 @@ void PluginSpec::setEnabledIndirectly(bool value)
}
void PluginSpec::setForceDisabled(bool value)
{
+ if (value)
+ d->forceEnabled = false;
d->forceDisabled = value;
}
void PluginSpec::setForceEnabled(bool value)
{
+ if (value)
+ d->forceDisabled = false;
d->forceEnabled = value;
}
@@ -840,11 +843,9 @@ Utils::expected_str<void> PluginSpecPrivate::readMetaData(const QJsonObject &dat
value = metaData.value(QLatin1String(PLUGIN_DISABLED_BY_DEFAULT));
if (!value.isUndefined() && !value.isBool())
return reportError(msgValueIsNotABool(PLUGIN_DISABLED_BY_DEFAULT));
- enabledByDefault = !value.toBool(false);
+ enabledByDefault = !value.toBool(experimental || deprecated);
qCDebug(pluginLog) << "enabledByDefault =" << enabledByDefault;
- if (experimental || deprecated)
- enabledByDefault = false;
enabledBySettings = enabledByDefault;
value = metaData.value(QLatin1String(PLUGIN_SOFTLOADABLE));
@@ -1073,8 +1074,8 @@ bool PluginSpec::resolveDependencies(const PluginSpecs &specs)
QHash<PluginDependency, PluginSpec *> resolvedDependencies;
for (const PluginDependency &dependency : d->dependencies) {
- PluginSpec *const found = findOrDefault(specs, [&dependency](PluginSpec *spec) {
- return spec->provides(dependency.name, dependency.version);
+ PluginSpec *const found = findOrDefault(specs, [this, &dependency](PluginSpec *spec) {
+ return provides(spec, dependency);
});
if (!found) {
if (dependency.type == PluginDependency::Required) {