mirror of
https://github.com/lubosz/overte.git
synced 2025-06-03 18:50:32 +02:00
Merge pull request #15190 from roxanneskelly/Case20393
Case20393 - Add item counts to interface categories
This commit is contained in:
commit
4ac25121e0
2 changed files with 44 additions and 26 deletions
|
@ -87,22 +87,11 @@ Rectangle {
|
||||||
console.log("Failed to get Marketplace Categories", result.data.message);
|
console.log("Failed to get Marketplace Categories", result.data.message);
|
||||||
} else {
|
} else {
|
||||||
categoriesModel.clear();
|
categoriesModel.clear();
|
||||||
categoriesModel.append({
|
result.data.categories.forEach(function(category) {
|
||||||
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) {
|
|
||||||
categoriesModel.append({
|
categoriesModel.append({
|
||||||
id: category.id,
|
id: category.id,
|
||||||
name: category.name
|
name: category.name,
|
||||||
|
count: category.count
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -397,12 +386,12 @@ Rectangle {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left;
|
left: parent.left
|
||||||
bottom: parent.bottom;
|
bottom: parent.bottom
|
||||||
top: parent.top;
|
top: parent.top
|
||||||
topMargin: 100;
|
topMargin: 100
|
||||||
}
|
}
|
||||||
width: parent.width/3
|
width: parent.width*2/3
|
||||||
|
|
||||||
color: hifi.colors.white
|
color: hifi.colors.white
|
||||||
|
|
||||||
|
@ -436,20 +425,49 @@ Rectangle {
|
||||||
border.color: hifi.colors.blueHighlight
|
border.color: hifi.colors.blueHighlight
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
RalewayRegular {
|
RalewaySemiBold {
|
||||||
id: categoriesItemText
|
id: categoriesItemText
|
||||||
|
|
||||||
anchors.leftMargin: 15
|
anchors.leftMargin: 15
|
||||||
anchors.fill:parent
|
anchors.top:parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: categoryItemCount.right
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
text: model.name
|
text: model.name
|
||||||
color: categoriesItemDelegate.ListView.isCurrentItem ? hifi.colors.blueHighlight : hifi.colors.baseGray
|
color: categoriesItemDelegate.ListView.isCurrentItem ? hifi.colors.blueHighlight : hifi.colors.baseGray
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
size: 14
|
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 {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 10
|
z: 10
|
||||||
|
@ -486,9 +504,9 @@ Rectangle {
|
||||||
parent: categoriesListView.parent
|
parent: categoriesListView.parent
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: categoriesListView.top;
|
top: categoriesListView.top
|
||||||
bottom: categoriesListView.bottom;
|
bottom: categoriesListView.bottom
|
||||||
left: categoriesListView.right;
|
left: categoriesListView.right
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem.opacity: 1
|
contentItem.opacity: 1
|
||||||
|
|
|
@ -87,7 +87,7 @@ void MarketplaceItemUploader::doGetCategories() {
|
||||||
if (error == QNetworkReply::NoError) {
|
if (error == QNetworkReply::NoError) {
|
||||||
auto doc = QJsonDocument::fromJson(reply->readAll());
|
auto doc = QJsonDocument::fromJson(reply->readAll());
|
||||||
auto extractCategoryID = [&doc]() -> std::pair<bool, int> {
|
auto extractCategoryID = [&doc]() -> std::pair<bool, int> {
|
||||||
auto items = doc.object()["data"].toObject()["items"];
|
auto items = doc.object()["data"].toObject()["categories"];
|
||||||
if (!items.isArray()) {
|
if (!items.isArray()) {
|
||||||
qWarning() << "Categories parse error: data.items is not an array";
|
qWarning() << "Categories parse error: data.items is not an array";
|
||||||
return { false, 0 };
|
return { false, 0 };
|
||||||
|
|
Loading…
Reference in a new issue