forked from qt-creator/qt-creator
ExtensionManager: Read more fields from service response
This adds reading of "download_count", "id" and "is_internal". Change-Id: I45382d7c70bbc5f44f9391bf3a87ee354d1809e4 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -38,6 +38,7 @@ struct Plugin
|
||||
{
|
||||
Dependencies dependencies;
|
||||
QString copyright;
|
||||
bool isInternal = false;
|
||||
QString name;
|
||||
QString packageUrl;
|
||||
QString vendor;
|
||||
@@ -54,6 +55,8 @@ struct Description {
|
||||
struct Extension {
|
||||
QString copyright;
|
||||
Description description;
|
||||
int downloadCount = -1;
|
||||
QString id;
|
||||
QString license;
|
||||
QString name;
|
||||
QStringList platforms;
|
||||
@@ -83,6 +86,7 @@ static Plugin pluginFromJson(const QJsonObject &obj)
|
||||
return {
|
||||
.dependencies = dependencies,
|
||||
.copyright = metaDataObj.value("Copyright").toString(),
|
||||
.isInternal = obj.value("is_internal").toBool(false),
|
||||
.name = metaDataObj.value("Name").toString(),
|
||||
.packageUrl = obj.value("url").toString(),
|
||||
.vendor = metaDataObj.value("Vendor").toString(),
|
||||
@@ -158,6 +162,8 @@ static Extension extensionFromJson(const QJsonObject &obj)
|
||||
const Extension extension = {
|
||||
.copyright = obj.value("copyright").toString(),
|
||||
.description = description,
|
||||
.downloadCount = obj.value("download_count").toInt(-1),
|
||||
.id = obj.value("id").toString(),
|
||||
.license = obj.value("license").toString(),
|
||||
.name = obj.value("name").toString(),
|
||||
.platforms = platforms,
|
||||
@@ -318,6 +324,10 @@ static QVariant dataFromExtension(const Extension &extension, int role)
|
||||
return QVariant::fromValue(extension.description.links);
|
||||
case RoleDescriptionText:
|
||||
return QVariant::fromValue(extension.description.text);
|
||||
case RoleDownloadCount:
|
||||
return extension.downloadCount;
|
||||
case RoleId:
|
||||
return extension.id;
|
||||
case RoleItemType:
|
||||
return extension.type;
|
||||
case RoleLicense:
|
||||
|
@@ -30,6 +30,8 @@ enum Role {
|
||||
RoleDescriptionImages,
|
||||
RoleDescriptionLinks,
|
||||
RoleDescriptionText,
|
||||
RoleDownloadCount,
|
||||
RoleId,
|
||||
RoleItemType,
|
||||
RoleLicense,
|
||||
RoleLocation,
|
||||
|
Reference in New Issue
Block a user