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