Add <platform> element to pluginspec-files.

The <platform> element may contain a regular expression
matching the names of the platforms on which the plugin works.

Task-number: QTCREATORBUG-9002
Change-Id: Ic816cfed69a5dd2c4112c976843b9106ba2cbd22
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Friedemann Kleint
2013-08-28 16:29:08 +02:00
parent 54a114e639
commit 1d56d718cd
9 changed files with 310 additions and 176 deletions

View File

@@ -252,6 +252,16 @@ QString PluginSpec::category() const
return d->category;
}
/*!
A QRegExp matching the platforms this plugin works on. An empty pattern implies all platforms.
\since 3.0
*/
QRegExp PluginSpec::platformSpecification() const
{
return d->platformSpecification;
}
/*!
Returns if the plugin has its experimental flag set.
*/
@@ -287,9 +297,12 @@ bool PluginSpec::isEnabledInSettings() const
*/
bool PluginSpec::isEffectivelyEnabled() const
{
return !d->disabledIndirectly
&& (d->enabledInSettings || d->forceEnabled)
&& !d->forceDisabled;
if (d->disabledIndirectly
|| (!d->enabledInSettings && !d->forceEnabled)
|| d->forceDisabled) {
return false;
}
return d->platformSpecification.isEmpty() || d->platformSpecification.exactMatch(PluginManager::platformName());
}
/*!
@@ -450,6 +463,7 @@ namespace {
const char DESCRIPTION[] = "description";
const char URL[] = "url";
const char CATEGORY[] = "category";
const char PLATFORM[] = "platform";
const char DEPENDENCYLIST[] = "dependencyList";
const char DEPENDENCY[] = "dependency";
const char DEPENDENCY_NAME[] = "name";
@@ -647,7 +661,16 @@ void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader)
url = reader.readElementText().trimmed();
else if (element == QLatin1String(CATEGORY))
category = reader.readElementText().trimmed();
else if (element == QLatin1String(DEPENDENCYLIST))
else if (element == QLatin1String(PLATFORM)) {
const QString platformSpec = reader.readElementText().trimmed();
if (!platformSpec.isEmpty()) {
platformSpecification.setPattern(platformSpec);
if (!platformSpecification.isValid())
reader.raiseError(QLatin1String("Invalid platform specification \"")
+ platformSpec + QLatin1String("\": ")
+ platformSpecification.errorString());
}
} else if (element == QLatin1String(DEPENDENCYLIST))
readDependencies(reader);
else if (element == QLatin1String(ARGUMENTLIST))
readArgumentDescriptions(reader);