diff options
-rw-r--r-- | src/libs/extensionsystem/pluginspec.cpp | 7 | ||||
-rw-r--r-- | src/libs/extensionsystem/pluginspec.h | 1 | ||||
-rw-r--r-- | src/libs/extensionsystem/pluginview.cpp | 17 |
3 files changed, 19 insertions, 6 deletions
diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 3d259dea77..aba11235c1 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -265,6 +265,11 @@ QRegExp PluginSpec::platformSpecification() const return d->platformSpecification; } +bool PluginSpec::isAvailableForHostPlatform() const +{ + return d->platformSpecification.isEmpty() || d->platformSpecification.exactMatch(PluginManager::platformName()); +} + /*! Returns whether the plugin has its experimental flag set. */ @@ -307,7 +312,7 @@ bool PluginSpec::isEffectivelyEnabled() const || d->forceDisabled) { return false; } - return d->platformSpecification.isEmpty() || d->platformSpecification.exactMatch(PluginManager::platformName()); + return isAvailableForHostPlatform(); } /*! diff --git a/src/libs/extensionsystem/pluginspec.h b/src/libs/extensionsystem/pluginspec.h index 15e561742d..62a1b4fd99 100644 --- a/src/libs/extensionsystem/pluginspec.h +++ b/src/libs/extensionsystem/pluginspec.h @@ -92,6 +92,7 @@ public: QString url() const; QString category() const; QRegExp platformSpecification() const; + bool isAvailableForHostPlatform() const; bool isExperimental() const; bool isDisabledByDefault() const; bool isEnabledInSettings() const; diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp index 883633dd5e..cf48a9d744 100644 --- a/src/libs/extensionsystem/pluginview.cpp +++ b/src/libs/extensionsystem/pluginview.cpp @@ -234,15 +234,19 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr ++checkedCount; } - if (!m_whitelist.contains(spec->name())) { + if (!spec->isAvailableForHostPlatform()) { + pluginItem->setData(C_LOAD, Qt::CheckStateRole, Qt::Unchecked); + pluginItem->setFlags(Qt::ItemIsSelectable); + pluginItem->setToolTip(C_LOAD, tr("Plugin is not vailable for this platform.")); + } else if (!m_whitelist.contains(spec->name())) { pluginItem->setData(C_LOAD, Qt::CheckStateRole, state); + pluginItem->setToolTip(C_LOAD, tr("Load on startup")); } else { pluginItem->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked); pluginItem->setFlags(Qt::ItemIsSelectable); + pluginItem->setToolTip(C_LOAD, tr("Plugin is required.")); } - pluginItem->setToolTip(C_LOAD, tr("Load on Startup")); - m_specToItem.insert(spec, pluginItem); if (parentItem) @@ -336,7 +340,10 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column) PluginSpec *spec = collection->plugins().at(i); QTreeWidgetItem *child = m_specToItem.value(spec); - if (!m_whitelist.contains(spec->name())) { + if (!spec->isAvailableForHostPlatform()) { + child->setData(C_LOAD, Qt::CheckStateRole, Qt::Unchecked); + child->setFlags(Qt::ItemIsSelectable); + } else if (!m_whitelist.contains(spec->name())) { spec->setEnabled(loadOnStartup); Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked); child->setData(C_LOAD, Qt::CheckStateRole, state); @@ -372,7 +379,7 @@ void PluginView::updatePluginDependencies() } } QTreeWidgetItem *childItem = m_specToItem.value(spec); - childItem->setDisabled(disableIndirectly); + childItem->setDisabled(disableIndirectly || !spec->isAvailableForHostPlatform()); if (disableIndirectly == spec->isDisabledIndirectly()) continue; |