diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-03-01 14:59:40 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-03-02 12:33:32 +0000 |
commit | 8673aae986a3028f5f9dacd15dd77f0d35d2c281 (patch) | |
tree | 2f20464835374056947ed562b6129aae4c29a80b /src/libs/extensionsystem/plugindetailsview.cpp | |
parent | e4c8d094490d68b13a9f44204b6c4c8087ed7cdf (diff) |
Allow plugins to specify a "revision" to show in addition to the versionv4.5.2
To be used for the version control revision the plugin was built from.
Invent a QTC_PLUGIN_REVISION replacement string for the plugin .json.in
which can be set by the build process.
Task-number: QTCREATORBUG-19951
Change-Id: Id5fd64b5506383e0b7749bcfd34d178baf8fe7af
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/libs/extensionsystem/plugindetailsview.cpp')
-rw-r--r-- | src/libs/extensionsystem/plugindetailsview.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libs/extensionsystem/plugindetailsview.cpp b/src/libs/extensionsystem/plugindetailsview.cpp index 5d51a1e31d..13f24d3889 100644 --- a/src/libs/extensionsystem/plugindetailsview.cpp +++ b/src/libs/extensionsystem/plugindetailsview.cpp @@ -32,6 +32,8 @@ #include <utils/algorithm.h> #include <QDir> +#include <QJsonObject> +#include <QJsonValue> #include <QRegExp> /*! @@ -65,6 +67,16 @@ PluginDetailsView::~PluginDetailsView() delete m_ui; } +// TODO: make API in PluginSpec +static QString getSpecRevision(PluginSpec *spec) +{ + const QJsonObject metaData = spec->metaData(); + const QJsonValue revision = metaData.value("Revision"); + if (revision.isString()) + return revision.toString(); + return QString(); +} + /*! Reads the given \a spec and displays its values in this PluginDetailsView. @@ -72,7 +84,10 @@ PluginDetailsView::~PluginDetailsView() void PluginDetailsView::update(PluginSpec *spec) { m_ui->name->setText(spec->name()); - m_ui->version->setText(spec->version()); + const QString revision = getSpecRevision(spec); + const QString versionString = spec->version() + (revision.isEmpty() ? QString() + : " (" + revision + ")"); + m_ui->version->setText(versionString); m_ui->compatVersion->setText(spec->compatVersion()); m_ui->vendor->setText(spec->vendor()); const QString link = QString::fromLatin1("<a href=\"%1\">%1</a>").arg(spec->url()); |