forked from qt-creator/qt-creator
About Plugins: Disable plugins that are not available on platform
Change-Id: I8e64b363a74823001f5ca65d9174e2a403bc3dca Task-number: QTCREATORBUG-10570 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -265,6 +265,11 @@ QRegExp PluginSpec::platformSpecification() const
|
|||||||
return d->platformSpecification;
|
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.
|
Returns whether the plugin has its experimental flag set.
|
||||||
*/
|
*/
|
||||||
@@ -307,7 +312,7 @@ bool PluginSpec::isEffectivelyEnabled() const
|
|||||||
|| d->forceDisabled) {
|
|| d->forceDisabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return d->platformSpecification.isEmpty() || d->platformSpecification.exactMatch(PluginManager::platformName());
|
return isAvailableForHostPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ public:
|
|||||||
QString url() const;
|
QString url() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QRegExp platformSpecification() const;
|
QRegExp platformSpecification() const;
|
||||||
|
bool isAvailableForHostPlatform() const;
|
||||||
bool isExperimental() const;
|
bool isExperimental() const;
|
||||||
bool isDisabledByDefault() const;
|
bool isDisabledByDefault() const;
|
||||||
bool isEnabledInSettings() const;
|
bool isEnabledInSettings() const;
|
||||||
|
|||||||
@@ -234,15 +234,19 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr
|
|||||||
++checkedCount;
|
++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->setData(C_LOAD, Qt::CheckStateRole, state);
|
||||||
|
pluginItem->setToolTip(C_LOAD, tr("Load on startup"));
|
||||||
} else {
|
} else {
|
||||||
pluginItem->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked);
|
pluginItem->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked);
|
||||||
pluginItem->setFlags(Qt::ItemIsSelectable);
|
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);
|
m_specToItem.insert(spec, pluginItem);
|
||||||
|
|
||||||
if (parentItem)
|
if (parentItem)
|
||||||
@@ -336,7 +340,10 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
|
|||||||
PluginSpec *spec = collection->plugins().at(i);
|
PluginSpec *spec = collection->plugins().at(i);
|
||||||
QTreeWidgetItem *child = m_specToItem.value(spec);
|
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);
|
spec->setEnabled(loadOnStartup);
|
||||||
Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked);
|
Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked);
|
||||||
child->setData(C_LOAD, Qt::CheckStateRole, state);
|
child->setData(C_LOAD, Qt::CheckStateRole, state);
|
||||||
@@ -372,7 +379,7 @@ void PluginView::updatePluginDependencies()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QTreeWidgetItem *childItem = m_specToItem.value(spec);
|
QTreeWidgetItem *childItem = m_specToItem.value(spec);
|
||||||
childItem->setDisabled(disableIndirectly);
|
childItem->setDisabled(disableIndirectly || !spec->isAvailableForHostPlatform());
|
||||||
|
|
||||||
if (disableIndirectly == spec->isDisabledIndirectly())
|
if (disableIndirectly == spec->isDisabledIndirectly())
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user