diff --git a/doc/qtcreatordev/src/plugin-metadata.qdoc b/doc/qtcreatordev/src/plugin-metadata.qdoc index 4af331c0bae..5501e4d3172 100644 --- a/doc/qtcreatordev/src/plugin-metadata.qdoc +++ b/doc/qtcreatordev/src/plugin-metadata.qdoc @@ -59,6 +59,13 @@ 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 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 \li Required \li Boolean diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index cd26e814647..4f7c07d551a 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -320,9 +320,17 @@ bool PluginSpec::isExperimental() const 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. - 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. */ bool PluginSpec::isEnabledByDefault() const @@ -575,6 +583,7 @@ namespace { const char PLUGIN_REQUIRED[] = "Required"; const char PLUGIN_EXPERIMENTAL[] = "Experimental"; const char PLUGIN_DISABLED_BY_DEFAULT[] = "DisabledByDefault"; + const char PLUGIN_DEPRECATED[] = "Deprecated"; const char PLUGIN_SOFTLOADABLE[] = "SoftLoadable"; const char VENDOR[] = "Vendor"; const char COPYRIGHT[] = "Copyright"; @@ -797,13 +806,19 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData) experimental = value.toBool(false); 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)); if (!value.isUndefined() && !value.isBool()) return reportError(msgValueIsNotABool(PLUGIN_DISABLED_BY_DEFAULT)); enabledByDefault = !value.toBool(false); qCDebug(pluginLog) << "enabledByDefault =" << enabledByDefault; - if (experimental) + if (experimental || deprecated) enabledByDefault = false; enabledBySettings = enabledByDefault; diff --git a/src/libs/extensionsystem/pluginspec.h b/src/libs/extensionsystem/pluginspec.h index 68cebae9b67..8db6bb44114 100644 --- a/src/libs/extensionsystem/pluginspec.h +++ b/src/libs/extensionsystem/pluginspec.h @@ -94,6 +94,7 @@ public: bool isAvailableForHostPlatform() const; bool isRequired() const; bool isExperimental() const; + bool isDeprecated() const; bool isEnabledByDefault() const; bool isEnabledBySettings() const; bool isEffectivelyEnabled() const; diff --git a/src/libs/extensionsystem/pluginspec_p.h b/src/libs/extensionsystem/pluginspec_p.h index d171265b13c..61832213cad 100644 --- a/src/libs/extensionsystem/pluginspec_p.h +++ b/src/libs/extensionsystem/pluginspec_p.h @@ -56,6 +56,7 @@ public: bool required = false; bool experimental = false; bool enabledByDefault = true; + bool deprecated = false; QString vendor; QString copyright; QString license; diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp index 4551278bd7e..40738be487f 100644 --- a/src/libs/extensionsystem/pluginview.cpp +++ b/src/libs/extensionsystem/pluginview.cpp @@ -96,9 +96,15 @@ public: { switch (column) { 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()) : m_spec->name(); + } if (role == SortRole) return m_spec->name(); if (role == Qt::ToolTipRole) {