forked from qt-creator/qt-creator
PluginManager: Add an "Deprecated" flag for plugins
For plugins that are still provided, but are no longer supported. They are disabled by default and show a "unsupported" hint in the plugin manager (similar to "experimental" plugins). Change-Id: I6ad72fc0043900b5aa919c225ae94850d1d7a443 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -59,6 +59,13 @@
|
|||||||
If set, the respective plugin is not loaded by default but must be explicitly
|
If set, the respective plugin is not loaded by default but must be explicitly
|
||||||
enabled by the user. This should be done for plugins which are not expected
|
enabled by the user. This should be done for plugins which are not expected
|
||||||
to be used by so many people as to justify the additional resource consumption.
|
to be used by so many people as to justify the additional resource consumption.
|
||||||
|
\row
|
||||||
|
\li Deprecated
|
||||||
|
\li Boolean
|
||||||
|
\li Optional. Defaults to \c false.
|
||||||
|
Deprecated plugins are not loaded by default but must be explicitly
|
||||||
|
enabled by the user. This attribute is a hint that the plugin is no longer
|
||||||
|
supported and might negatively affect the user experience.
|
||||||
\row
|
\row
|
||||||
\li Required
|
\li Required
|
||||||
\li Boolean
|
\li Boolean
|
||||||
|
|||||||
@@ -320,9 +320,17 @@ bool PluginSpec::isExperimental() const
|
|||||||
return d->experimental;
|
return d->experimental;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns whether the plugin has its deprecated flag set.
|
||||||
|
*/
|
||||||
|
bool PluginSpec::isDeprecated() const
|
||||||
|
{
|
||||||
|
return d->deprecated;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns whether the plugin is enabled by default.
|
Returns whether the plugin is enabled by default.
|
||||||
A plugin might be disabled because the plugin is experimental, or because
|
A plugin might be disabled because the plugin is experimental or deprecated, or because
|
||||||
the installation settings define it as disabled by default.
|
the installation settings define it as disabled by default.
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isEnabledByDefault() const
|
bool PluginSpec::isEnabledByDefault() const
|
||||||
@@ -575,6 +583,7 @@ namespace {
|
|||||||
const char PLUGIN_REQUIRED[] = "Required";
|
const char PLUGIN_REQUIRED[] = "Required";
|
||||||
const char PLUGIN_EXPERIMENTAL[] = "Experimental";
|
const char PLUGIN_EXPERIMENTAL[] = "Experimental";
|
||||||
const char PLUGIN_DISABLED_BY_DEFAULT[] = "DisabledByDefault";
|
const char PLUGIN_DISABLED_BY_DEFAULT[] = "DisabledByDefault";
|
||||||
|
const char PLUGIN_DEPRECATED[] = "Deprecated";
|
||||||
const char PLUGIN_SOFTLOADABLE[] = "SoftLoadable";
|
const char PLUGIN_SOFTLOADABLE[] = "SoftLoadable";
|
||||||
const char VENDOR[] = "Vendor";
|
const char VENDOR[] = "Vendor";
|
||||||
const char COPYRIGHT[] = "Copyright";
|
const char COPYRIGHT[] = "Copyright";
|
||||||
@@ -797,13 +806,19 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData)
|
|||||||
experimental = value.toBool(false);
|
experimental = value.toBool(false);
|
||||||
qCDebug(pluginLog) << "experimental =" << experimental;
|
qCDebug(pluginLog) << "experimental =" << experimental;
|
||||||
|
|
||||||
|
value = metaData.value(QLatin1String(PLUGIN_DEPRECATED));
|
||||||
|
if (!value.isUndefined() && !value.isBool())
|
||||||
|
return reportError(msgValueIsNotABool(PLUGIN_DEPRECATED));
|
||||||
|
deprecated = value.toBool(false);
|
||||||
|
qCDebug(pluginLog) << "deprecated =" << deprecated;
|
||||||
|
|
||||||
value = metaData.value(QLatin1String(PLUGIN_DISABLED_BY_DEFAULT));
|
value = metaData.value(QLatin1String(PLUGIN_DISABLED_BY_DEFAULT));
|
||||||
if (!value.isUndefined() && !value.isBool())
|
if (!value.isUndefined() && !value.isBool())
|
||||||
return reportError(msgValueIsNotABool(PLUGIN_DISABLED_BY_DEFAULT));
|
return reportError(msgValueIsNotABool(PLUGIN_DISABLED_BY_DEFAULT));
|
||||||
enabledByDefault = !value.toBool(false);
|
enabledByDefault = !value.toBool(false);
|
||||||
qCDebug(pluginLog) << "enabledByDefault =" << enabledByDefault;
|
qCDebug(pluginLog) << "enabledByDefault =" << enabledByDefault;
|
||||||
|
|
||||||
if (experimental)
|
if (experimental || deprecated)
|
||||||
enabledByDefault = false;
|
enabledByDefault = false;
|
||||||
enabledBySettings = enabledByDefault;
|
enabledBySettings = enabledByDefault;
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public:
|
|||||||
bool isAvailableForHostPlatform() const;
|
bool isAvailableForHostPlatform() const;
|
||||||
bool isRequired() const;
|
bool isRequired() const;
|
||||||
bool isExperimental() const;
|
bool isExperimental() const;
|
||||||
|
bool isDeprecated() const;
|
||||||
bool isEnabledByDefault() const;
|
bool isEnabledByDefault() const;
|
||||||
bool isEnabledBySettings() const;
|
bool isEnabledBySettings() const;
|
||||||
bool isEffectivelyEnabled() const;
|
bool isEffectivelyEnabled() const;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public:
|
|||||||
bool required = false;
|
bool required = false;
|
||||||
bool experimental = false;
|
bool experimental = false;
|
||||||
bool enabledByDefault = true;
|
bool enabledByDefault = true;
|
||||||
|
bool deprecated = false;
|
||||||
QString vendor;
|
QString vendor;
|
||||||
QString copyright;
|
QString copyright;
|
||||||
QString license;
|
QString license;
|
||||||
|
|||||||
@@ -96,9 +96,15 @@ public:
|
|||||||
{
|
{
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case NameColumn:
|
case NameColumn:
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole) {
|
||||||
|
if (m_spec->isDeprecated()) {
|
||||||
|
//: %1 is a plugin name
|
||||||
|
return Tr::tr("%1 (deprecated)").arg(m_spec->name());
|
||||||
|
}
|
||||||
|
//: %1 is a plugin name
|
||||||
return m_spec->isExperimental() ? Tr::tr("%1 (experimental)").arg(m_spec->name())
|
return m_spec->isExperimental() ? Tr::tr("%1 (experimental)").arg(m_spec->name())
|
||||||
: m_spec->name();
|
: m_spec->name();
|
||||||
|
}
|
||||||
if (role == SortRole)
|
if (role == SortRole)
|
||||||
return m_spec->name();
|
return m_spec->name();
|
||||||
if (role == Qt::ToolTipRole) {
|
if (role == Qt::ToolTipRole) {
|
||||||
|
|||||||
Reference in New Issue
Block a user