forked from qt-creator/qt-creator
ExtensionManager: Display the compatibility version extensions
Fixes: QTCREATORBUG-31198 Change-Id: I0a715bd4d5a8981fba294bb4556fc31fccf6150b Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -399,6 +399,8 @@ private:
|
||||
QMovie m_imageMovie;
|
||||
QLabel *m_tagsTitle;
|
||||
TagList *m_tags;
|
||||
QLabel *m_compatVersionTitle;
|
||||
QLabel *m_compatVersion;
|
||||
QLabel *m_platformsTitle;
|
||||
QLabel *m_platforms;
|
||||
QLabel *m_dependenciesTitle;
|
||||
@@ -441,6 +443,8 @@ ExtensionManagerWidget::ExtensionManagerWidget()
|
||||
|
||||
m_tagsTitle = sectionTitle(h6TF, Tr::tr("Tags"));
|
||||
m_tags = new TagList;
|
||||
m_compatVersionTitle = sectionTitle(h6TF, Tr::tr("Compatibility"));
|
||||
m_compatVersion = tfLabel(contentTF, false);
|
||||
m_platformsTitle = sectionTitle(h6TF, Tr::tr("Platforms"));
|
||||
m_platforms = tfLabel(contentTF, false);
|
||||
m_dependenciesTitle = sectionTitle(h6TF, Tr::tr("Dependencies"));
|
||||
@@ -455,6 +459,7 @@ ExtensionManagerWidget::ExtensionManagerWidget()
|
||||
sectionTitle(h6CapitalTF, Tr::tr("Extension details")),
|
||||
Column {
|
||||
Column { m_tagsTitle, m_tags, spXxs },
|
||||
Column { m_compatVersionTitle, m_compatVersion, spXxs },
|
||||
Column { m_platformsTitle, m_platforms, spXxs },
|
||||
Column { m_dependenciesTitle, m_dependencies, spXxs },
|
||||
Column { m_packExtensionsTitle, m_packExtensions, spXxs },
|
||||
@@ -610,6 +615,13 @@ void ExtensionManagerWidget::updateView(const QModelIndex ¤t)
|
||||
m_tagsTitle->setVisible(hasTags);
|
||||
m_tags->setVisible(hasTags);
|
||||
|
||||
const QString compatVersion = current.data(RoleCompatVersion).toString();
|
||||
const bool hasCompatVersion = !compatVersion.isEmpty();
|
||||
if (hasCompatVersion)
|
||||
m_compatVersion->setText(compatVersion);
|
||||
m_compatVersionTitle->setVisible(hasCompatVersion);
|
||||
m_compatVersion->setVisible(hasCompatVersion);
|
||||
|
||||
const QStringList platforms = current.data(RolePlatforms).toStringList();
|
||||
const bool hasPlatforms = !platforms.isEmpty();
|
||||
if (hasPlatforms)
|
||||
|
||||
@@ -53,6 +53,7 @@ struct Description {
|
||||
};
|
||||
|
||||
struct Extension {
|
||||
QString compatVersion;
|
||||
QString copyright;
|
||||
Description description;
|
||||
int downloadCount = -1;
|
||||
@@ -166,6 +167,7 @@ static Extension extensionFromJson(const QJsonObject &obj)
|
||||
const Description description = descriptionFromJson(descriptionObj);
|
||||
|
||||
const Extension extension = {
|
||||
.compatVersion = obj.value("compatibility").toString(),
|
||||
.copyright = obj.value("copyright").toString(),
|
||||
.description = description,
|
||||
.downloadCount = obj.value("download_count").toInt(-1),
|
||||
@@ -234,6 +236,7 @@ static Extension extensionFromPluginSpec(const PluginSpec *pluginSpec)
|
||||
: QStringList(platformsPattern);
|
||||
|
||||
const Extension extension = {
|
||||
.compatVersion = pluginSpec->compatVersion(),
|
||||
.copyright = pluginSpec->copyright(),
|
||||
.description = description,
|
||||
.id = {},
|
||||
@@ -311,6 +314,8 @@ static QVariant dataFromExtension(const Extension &extension, int role)
|
||||
case Qt::DisplayRole:
|
||||
case RoleName:
|
||||
return extension.name;
|
||||
case RoleCompatVersion:
|
||||
return extension.compatVersion;
|
||||
case RoleCopyright:
|
||||
return !extension.copyright.isEmpty() ? extension.copyright : QVariant();
|
||||
case RoleDependencies:
|
||||
|
||||
@@ -25,6 +25,7 @@ enum ItemType {
|
||||
|
||||
enum Role {
|
||||
RoleName = Qt::UserRole,
|
||||
RoleCompatVersion,
|
||||
RoleCopyright,
|
||||
RoleDependencies,
|
||||
RoleDescriptionImages,
|
||||
|
||||
Reference in New Issue
Block a user