summaryrefslogtreecommitdiff
path: root/src/libs/extensionsystem/pluginspec.cpp
diff options
context:
space:
mode:
authorcon <qtc-committer@nokia.com>2010-03-30 16:54:29 +0200
committercon <qtc-committer@nokia.com>2010-03-30 18:42:12 +0200
commit89416bed3d4526a2edd176cbaf7509be109bf6c2 (patch)
treee0759056c8324e592258062d1d041d886e495688 /src/libs/extensionsystem/pluginspec.cpp
parent3319797d2039288a5ea8c3ecc067dd608d6a669c (diff)
downloadqt-creator-89416bed3d4526a2edd176cbaf7509be109bf6c2.tar.gz
Support an "experimental" attribute in plugin specs.
A flag that marks a plugin to be experimental, that should not be loaded by default.
Diffstat (limited to 'src/libs/extensionsystem/pluginspec.cpp')
-rw-r--r--src/libs/extensionsystem/pluginspec.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp
index 6f48996d86..ce4f95b6dd 100644
--- a/src/libs/extensionsystem/pluginspec.cpp
+++ b/src/libs/extensionsystem/pluginspec.cpp
@@ -237,8 +237,17 @@ QString PluginSpec::category() const
}
/*!
- \fn bool PluginSpec::loadOnStartup() const
- True if the plugin is loaded at startup. True by default - the user can change it from the Plugin settings.
+ \fn bool PluginSpec::isExperimental() const
+ Returns if the plugin has its experimental flag set.
+*/
+bool PluginSpec::isExperimental() const
+{
+ return d->experimental;
+}
+
+/*!
+ \fn bool PluginSpec::isEnabled() const
+ Returns if the plugin is loaded at startup. True by default - the user can change it from the Plugin settings.
*/
bool PluginSpec::isEnabled() const
{
@@ -416,6 +425,7 @@ namespace {
const char * const PLUGIN_NAME = "name";
const char * const PLUGIN_VERSION = "version";
const char * const PLUGIN_COMPATVERSION = "compatVersion";
+ const char * const PLUGIN_EXPERIMENTAL = "experimental";
const char * const VENDOR = "vendor";
const char * const COPYRIGHT = "copyright";
const char * const LICENSE = "license";
@@ -569,6 +579,14 @@ void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader)
} else if (compatVersion.isEmpty()) {
compatVersion = version;
}
+ QString experimentalString = reader.attributes().value(PLUGIN_EXPERIMENTAL).toString();
+ experimental = (experimentalString.compare(QLatin1String("true"), Qt::CaseInsensitive) == 0);
+ if (!experimentalString.isEmpty() && !experimental
+ && experimentalString.compare(QLatin1String("false"), Qt::CaseInsensitive) != 0) {
+ reader.raiseError(msgInvalidFormat(PLUGIN_EXPERIMENTAL));
+ return;
+ }
+ enabled = !experimental;
while (!reader.atEnd()) {
reader.readNext();
switch (reader.tokenType()) {