3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 14:55:30 +02:00

Merge pull request from roxanneskelly/Case20393

Case20393 - Add item counts to interface categories
This commit is contained in:
Shannon Romano 2019-03-19 17:53:30 -07:00 committed by GitHub
commit 4ac25121e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 26 deletions
interface
resources/qml/hifi/commerce/marketplace
src/avatar

View file

@ -87,22 +87,11 @@ Rectangle {
console.log("Failed to get Marketplace Categories", result.data.message);
} else {
categoriesModel.clear();
categoriesModel.append({
id: -1,
name: "Everything"
});
categoriesModel.append({
id: -1,
name: "Stand-alone Optimized"
});
categoriesModel.append({
id: -1,
name: "Stand-alone Compatible"
});
result.data.items.forEach(function(category) {
result.data.categories.forEach(function(category) {
categoriesModel.append({
id: category.id,
name: category.name
name: category.name,
count: category.count
});
});
}
@ -397,12 +386,12 @@ Rectangle {
Rectangle {
anchors {
left: parent.left;
bottom: parent.bottom;
top: parent.top;
topMargin: 100;
left: parent.left
bottom: parent.bottom
top: parent.top
topMargin: 100
}
width: parent.width/3
width: parent.width*2/3
color: hifi.colors.white
@ -436,20 +425,49 @@ Rectangle {
border.color: hifi.colors.blueHighlight
border.width: 0
RalewayRegular {
RalewaySemiBold {
id: categoriesItemText
anchors.leftMargin: 15
anchors.fill:parent
anchors.top:parent.top
anchors.bottom: parent.bottom
anchors.left: categoryItemCount.right
elide: Text.ElideRight
text: model.name
color: categoriesItemDelegate.ListView.isCurrentItem ? hifi.colors.blueHighlight : hifi.colors.baseGray
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
size: 14
}
Rectangle {
id: categoryItemCount
anchors {
top: parent.top
bottom: parent.bottom
topMargin: 7
bottomMargin: 7
leftMargin: 10
rightMargin: 10
left: parent.left
}
width: childrenRect.width
color: hifi.colors.faintGray
radius: height/2
RalewaySemiBold {
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 50
text: model.count
color: hifi.colors.lightGrayText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
size: 16
}
}
}
MouseArea {
anchors.fill: parent
z: 10
@ -486,9 +504,9 @@ Rectangle {
parent: categoriesListView.parent
anchors {
top: categoriesListView.top;
bottom: categoriesListView.bottom;
left: categoriesListView.right;
top: categoriesListView.top
bottom: categoriesListView.bottom
left: categoriesListView.right
}
contentItem.opacity: 1

View file

@ -87,7 +87,7 @@ void MarketplaceItemUploader::doGetCategories() {
if (error == QNetworkReply::NoError) {
auto doc = QJsonDocument::fromJson(reply->readAll());
auto extractCategoryID = [&doc]() -> std::pair<bool, int> {
auto items = doc.object()["data"].toObject()["items"];
auto items = doc.object()["data"].toObject()["categories"];
if (!items.isArray()) {
qWarning() << "Categories parse error: data.items is not an array";
return { false, 0 };