diff --git a/src/libs/extensionsystem/mainwindow.ui b/src/libs/extensionsystem/mainwindow.ui deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 958d3760a63ba8145eca24c197578bff903d0b0d..93d4de0fd9cf70736782429c0c4a48f7c55fc5f2 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -48,6 +48,7 @@ #endif static const char * const C_IGNORED_PLUGINS = "Plugins/Ignored"; +static const char * const C_FORCEENABLED_PLUGINS = "Plugins/ForceEnabled"; typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet; @@ -624,12 +625,16 @@ void PluginManagerPrivate::writeSettings() QLatin1String("Nokia"), QLatin1String("QtCreator")); QStringList tempDisabledPlugins; + QStringList tempForceEnabledPlugins; foreach(PluginSpec *spec, pluginSpecs) { - if (!spec->isEnabled()) + if (!spec->isExperimental() && !spec->isEnabled()) tempDisabledPlugins.append(spec->name()); + if (spec->isExperimental() && spec->isEnabled()) + tempForceEnabledPlugins.append(spec->name()); } settings.setValue(QLatin1String(C_IGNORED_PLUGINS), tempDisabledPlugins); + settings.setValue(QLatin1String(C_FORCEENABLED_PLUGINS), tempForceEnabledPlugins); } void PluginManagerPrivate::loadSettings() @@ -638,6 +643,7 @@ void PluginManagerPrivate::loadSettings() QLatin1String("Nokia"), QLatin1String("QtCreator")); disabledPlugins = settings.value(QLatin1String(C_IGNORED_PLUGINS)).toStringList(); + forceEnabledPlugins = settings.value(QLatin1String(C_FORCEENABLED_PLUGINS)).toStringList(); } void PluginManagerPrivate::stopAll() @@ -883,7 +889,9 @@ void PluginManagerPrivate::readPluginPaths() collection = new PluginCollection(spec->category()); pluginCategories.insert(spec->category(), collection); } - if (disabledPlugins.contains(spec->name())) + if (spec->isExperimental() && forceEnabledPlugins.contains(spec->name())) + spec->setEnabled(true); + if (!spec->isExperimental() && disabledPlugins.contains(spec->name())) spec->setEnabled(false); collection->addPlugin(spec); diff --git a/src/libs/extensionsystem/pluginmanager_p.h b/src/libs/extensionsystem/pluginmanager_p.h index 013e7229a6e3d9f9ce52f6ecb4c77a6688213ab5..c9b61f5ca0f02a0439b9bec7c2ba44a34ea0f83b 100644 --- a/src/libs/extensionsystem/pluginmanager_p.h +++ b/src/libs/extensionsystem/pluginmanager_p.h @@ -80,6 +80,7 @@ public: QString extension; QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ? QStringList disabledPlugins; + QStringList forceEnabledPlugins; QStringList arguments; QScopedPointer<QTime> m_profileTimer; diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 6f48996d867f0b747f7b12eca87b95588addd11a..ce4f95b6dd1432b1d9aea784e7633901251e3fdf 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()) { diff --git a/src/libs/extensionsystem/pluginspec.h b/src/libs/extensionsystem/pluginspec.h index 1f4cc06710d706272213d8f73afc3ad2c9951256..42feefad32e4d93c2e7f2b5589b696b546c3c48c 100644 --- a/src/libs/extensionsystem/pluginspec.h +++ b/src/libs/extensionsystem/pluginspec.h @@ -79,6 +79,7 @@ public: QString description() const; QString url() const; QString category() const; + bool isExperimental() const; bool isEnabled() const; // true if loading was not done due to user unselecting this plugin or its dependencies bool isDisabledByDependency() const; diff --git a/src/libs/extensionsystem/pluginspec_p.h b/src/libs/extensionsystem/pluginspec_p.h index 0ca4494b95d47c0aaccb0620e6fdefcc3a4fbe2f..339a5d018c3cf99659162a1db0e7a9db95fbdefe 100644 --- a/src/libs/extensionsystem/pluginspec_p.h +++ b/src/libs/extensionsystem/pluginspec_p.h @@ -62,6 +62,7 @@ public: QString name; QString version; QString compatVersion; + bool experimental; QString vendor; QString copyright; QString license; diff --git a/src/libs/extensionsystem/test/auto/pluginspec/testspecs/simplespec_experimental.xml b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/simplespec_experimental.xml new file mode 100644 index 0000000000000000000000000000000000000000..69fe37c53eec95b5c1dceea79bd00628d40d4bcd --- /dev/null +++ b/src/libs/extensionsystem/test/auto/pluginspec/testspecs/simplespec_experimental.xml @@ -0,0 +1,2 @@ +<plugin name="MyPlugin" version="2.2.3_9" compatVersion="2.0.0" experimental="true"> +</plugin> diff --git a/src/libs/extensionsystem/test/auto/pluginspec/tst_pluginspec.cpp b/src/libs/extensionsystem/test/auto/pluginspec/tst_pluginspec.cpp index ade25cfc5bdf09fe737b3aa51ad811807a8fec63..a33a024b04ef5abc2821a170000f4ac4f9db9748 100644 --- a/src/libs/extensionsystem/test/auto/pluginspec/tst_pluginspec.cpp +++ b/src/libs/extensionsystem/test/auto/pluginspec/tst_pluginspec.cpp @@ -49,6 +49,7 @@ private slots: void isValidVersion(); void versionCompare(); void provides(); + void experimental(); void locationAndPath(); void resolveDependencies(); void loadLibrary(); @@ -67,11 +68,13 @@ void tst_PluginSpec::read() QCOMPARE(spec.name, QString("test")); QCOMPARE(spec.version, QString("1.0.1")); QCOMPARE(spec.compatVersion, QString("1.0.0")); - QCOMPARE(spec.vendor, QString("Trolltech")); - QCOMPARE(spec.copyright, QString("(C) 2007 Trolltech ASA")); + QCOMPARE(spec.experimental, false); + QCOMPARE(spec.enabled, true); + QCOMPARE(spec.vendor, QString("Nokia Corporation")); + QCOMPARE(spec.copyright, QString("(C) 2007 Nokia Corporation")); QCOMPARE(spec.license, QString("This is a default license bla\nblubbblubb\nend of terms")); QCOMPARE(spec.description, QString("This plugin is just a test.\n it demonstrates the great use of the plugin spec.")); - QCOMPARE(spec.url, QString("http://www.trolltech.com")); + QCOMPARE(spec.url, QString("http://qt.noki.com")); PluginDependency dep1; dep1.name = QString("SomeOtherPlugin"); dep1.version = QString("2.3.0_2"); @@ -178,6 +181,14 @@ void tst_PluginSpec::provides() QVERIFY(spec.provides("MyPlugin", "2")); } +void tst_PluginSpec::experimental() +{ + Internal::PluginSpecPrivate spec(0); + QVERIFY(spec.read("testspecs/simplespec_experimental.xml")); + QCOMPARE(spec.experimental, true); + QCOMPARE(spec.enabled, false); +} + void tst_PluginSpec::locationAndPath() { Internal::PluginSpecPrivate spec(0); @@ -194,23 +205,23 @@ void tst_PluginSpec::locationAndPath() void tst_PluginSpec::resolveDependencies() { - QSet<PluginSpec *> specs; + QList<PluginSpec *> specs; PluginSpec *spec1 = Internal::PluginManagerPrivate::createSpec(); - specs.insert(spec1); + specs.append(spec1); Internal::PluginSpecPrivate *spec1Priv = Internal::PluginManagerPrivate::privateSpec(spec1); spec1Priv->read("testdependencies/spec1.xml"); PluginSpec *spec2 = Internal::PluginManagerPrivate::createSpec(); - specs.insert(spec2); + specs.append(spec2); Internal::PluginManagerPrivate::privateSpec(spec2)->read("testdependencies/spec2.xml"); PluginSpec *spec3 = Internal::PluginManagerPrivate::createSpec(); - specs.insert(spec3); + specs.append(spec3); Internal::PluginManagerPrivate::privateSpec(spec3)->read("testdependencies/spec3.xml"); PluginSpec *spec4 = Internal::PluginManagerPrivate::createSpec(); - specs.insert(spec4); + specs.append(spec4); Internal::PluginSpecPrivate *spec4Priv = Internal::PluginManagerPrivate::privateSpec(spec4); spec4Priv->read("testdependencies/spec4.xml"); PluginSpec *spec5 = Internal::PluginManagerPrivate::createSpec(); - specs.insert(spec5); + specs.append(spec5); Internal::PluginManagerPrivate::privateSpec(spec5)->read("testdependencies/spec5.xml"); QVERIFY(spec1Priv->resolveDependencies(specs)); QCOMPARE(spec1Priv->dependencySpecs.size(), 2); @@ -228,7 +239,7 @@ void tst_PluginSpec::loadLibrary() Internal::PluginSpecPrivate *spec = Internal::PluginManagerPrivate::privateSpec(ps); PluginManager *manager = new PluginManager(); QVERIFY(spec->read("testplugin/testplugin.xml")); - QVERIFY(spec->resolveDependencies(QSet<PluginSpec *>())); + QVERIFY(spec->resolveDependencies(QList<PluginSpec *>())); QVERIFY(spec->loadLibrary()); QVERIFY(qobject_cast<MyPlugin::MyPluginImpl*>(spec->plugin) != 0); QCOMPARE(spec->state, PluginSpec::Loaded); @@ -243,7 +254,7 @@ void tst_PluginSpec::initializePlugin() Internal::PluginSpecPrivate spec(0); MyPlugin::MyPluginImpl *impl; QVERIFY(spec.read("testplugin/testplugin.xml")); - QVERIFY(spec.resolveDependencies(QSet<PluginSpec *>())); + QVERIFY(spec.resolveDependencies(QList<PluginSpec *>())); QVERIFY(spec.loadLibrary()); impl = qobject_cast<MyPlugin::MyPluginImpl*>(spec.plugin); QVERIFY(impl != 0); @@ -259,7 +270,7 @@ void tst_PluginSpec::initializeExtensions() Internal::PluginSpecPrivate spec(0); MyPlugin::MyPluginImpl *impl; QVERIFY(spec.read("testplugin/testplugin.xml")); - QVERIFY(spec.resolveDependencies(QSet<PluginSpec *>())); + QVERIFY(spec.resolveDependencies(QList<PluginSpec *>())); QVERIFY(spec.loadLibrary()); impl = qobject_cast<MyPlugin::MyPluginImpl*>(spec.plugin); QVERIFY(impl != 0);