Support 'hidden' plugins

Plugins can be hidden in the "About Plugins" view by default. Users can
still make them all visible, but the default view can be made less noisy
by hiding plugins that only exist as a base for other plugins.
Plugins that can not run on the current platform are hidden by default
as well.

Change-Id: Iaf2f751c4ea4b3afc605bbbea6611eea042e62c7
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2017-01-04 06:23:32 +01:00
parent b29513aa5b
commit 284fa63be2
8 changed files with 91 additions and 11 deletions

View File

@@ -277,6 +277,11 @@ bool PluginSpec::isRequired() const
return d->required;
}
bool PluginSpec::isHiddenByDefault() const
{
return d->hiddenByDefault;
}
/*!
Returns whether the plugin has its experimental flag set.
*/
@@ -482,6 +487,7 @@ namespace {
const char PLUGIN_VERSION[] = "Version";
const char PLUGIN_COMPATVERSION[] = "CompatVersion";
const char PLUGIN_REQUIRED[] = "Required";
const char PLUGIN_HIDDEN_BY_DEFAULT[] = "HiddenByDefault";
const char PLUGIN_EXPERIMENTAL[] = "Experimental";
const char PLUGIN_DISABLED_BY_DEFAULT[] = "DisabledByDefault";
const char VENDOR[] = "Vendor";
@@ -692,6 +698,12 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &metaData)
required = value.toBool(false);
qCDebug(pluginLog) << "required =" << required;
value = pluginInfo.value(QLatin1String(PLUGIN_HIDDEN_BY_DEFAULT));
if (!value.isUndefined() && !value.isBool())
return reportError(msgValueIsNotABool(PLUGIN_HIDDEN_BY_DEFAULT));
hiddenByDefault = value.toBool(false);
qCDebug(pluginLog) << "hiddenByDefault =" << hiddenByDefault;
value = pluginInfo.value(QLatin1String(PLUGIN_EXPERIMENTAL));
if (!value.isUndefined() && !value.isBool())
return reportError(msgValueIsNotABool(PLUGIN_EXPERIMENTAL));