Commit dfb4f8aa authored by Eike Ziller's avatar Eike Ziller

About Plugins: Disable plugins that are not available on platform

Change-Id: I8e64b363a74823001f5ca65d9174e2a403bc3dca
Task-number: QTCREATORBUG-10570
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent dbbddd9f
......@@ -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();
}
/*!
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment