mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
Case 21118 - descending sorts don't work in new (qml) marketplace
This commit is contained in:
parent
7204a0c5c8
commit
a82221d2a5
4 changed files with 72 additions and 59 deletions
|
@ -31,8 +31,9 @@ Rectangle {
|
|||
id: root
|
||||
|
||||
property string activeView: "initialize"
|
||||
property int currentSortIndex: 0
|
||||
property int currentSortIndex: 1
|
||||
property string sortString: "recent"
|
||||
property bool isAscending: false
|
||||
property string categoryString: ""
|
||||
property string searchString: ""
|
||||
property bool keyboardEnabled: HMD.active
|
||||
|
@ -503,6 +504,7 @@ Rectangle {
|
|||
"",
|
||||
"",
|
||||
root.sortString,
|
||||
root.isAscending,
|
||||
WalletScriptingInterface.limitedCommerce,
|
||||
marketBrowseModel.currentPageToRetrieve,
|
||||
marketBrowseModel.itemsPerPage
|
||||
|
@ -731,7 +733,7 @@ Rectangle {
|
|||
top: parent.top
|
||||
leftMargin: 20
|
||||
}
|
||||
width: root.isLoggedIn ? 322 : 242
|
||||
width: root.isLoggedIn ? 342 : 262
|
||||
height: 36
|
||||
|
||||
radius: 4
|
||||
|
@ -742,27 +744,27 @@ Rectangle {
|
|||
id: sortModel
|
||||
|
||||
ListElement {
|
||||
name: "Name";
|
||||
glyph: ";"
|
||||
name: "Name"
|
||||
sortString: "alpha"
|
||||
ascending: true
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "Date";
|
||||
glyph: ";";
|
||||
sortString: "recent";
|
||||
name: "Date"
|
||||
sortString: "recent"
|
||||
ascending: false
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "Popular";
|
||||
glyph: ";";
|
||||
sortString: "likes";
|
||||
name: "Popular"
|
||||
sortString: "likes"
|
||||
ascending: false
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "My Likes";
|
||||
glyph: ";";
|
||||
sortString: "my_likes";
|
||||
name: "My Likes"
|
||||
sortString: "my_likes"
|
||||
ascending: false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,10 +790,10 @@ Rectangle {
|
|||
currentIndex: 1;
|
||||
|
||||
delegate: SortButton {
|
||||
width: 80
|
||||
width: 85
|
||||
height: parent.height
|
||||
|
||||
glyph: model.glyph
|
||||
ascending: model.ascending
|
||||
text: model.name
|
||||
|
||||
visible: root.isLoggedIn || model.sortString != "my_likes"
|
||||
|
@ -799,6 +801,12 @@ Rectangle {
|
|||
checked: ListView.isCurrentItem
|
||||
|
||||
onClicked: {
|
||||
if(root.currentSortIndex == index) {
|
||||
ascending = !ascending;
|
||||
} else {
|
||||
ascending = model.ascending;
|
||||
}
|
||||
root.isAscending = ascending;
|
||||
root.currentSortIndex = index;
|
||||
sortListView.positionViewAtIndex(index, ListView.Beginning);
|
||||
sortListView.currentIndex = index;
|
||||
|
@ -807,7 +815,7 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
highlight: Rectangle {
|
||||
width: 80
|
||||
width: 85
|
||||
height: parent.height
|
||||
|
||||
color: hifi.colors.faintGray
|
||||
|
|
|
@ -28,58 +28,60 @@ Item {
|
|||
|
||||
id: root;
|
||||
|
||||
property string ascGlyph: "\u2191"
|
||||
property string descGlyph: "\u2193"
|
||||
property string text: ""
|
||||
property bool ascending: false
|
||||
property bool checked: false
|
||||
signal clicked()
|
||||
|
||||
property string glyph: "";
|
||||
property string text: "";
|
||||
property bool checked: false;
|
||||
signal clicked();
|
||||
|
||||
width: childrenRect.width;
|
||||
height: parent.height;
|
||||
width: childrenRect.width
|
||||
height: parent.height
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left;
|
||||
height: parent.height;
|
||||
width: 2;
|
||||
color: hifi.colors.faintGray;
|
||||
visible: index > 0;
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
height: parent.height
|
||||
width: 2
|
||||
color: hifi.colors.faintGray
|
||||
visible: index > 0
|
||||
}
|
||||
|
||||
HiFiGlyphs {
|
||||
id: buttonGlyph;
|
||||
text: root.glyph;
|
||||
RalewayRegular {
|
||||
id: buttonGlyph
|
||||
text: root.ascending ? root.ascGlyph : root.descGlyph
|
||||
// Size
|
||||
size: 14;
|
||||
size: 14
|
||||
// Anchors
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: 0;
|
||||
anchors.top: parent.top;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
height: parent.height;
|
||||
horizontalAlignment: Text.AlignHCenter;
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 10
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 6
|
||||
anchors.bottom: parent.bottom
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignTop
|
||||
// Style
|
||||
color: hifi.colors.lightGray;
|
||||
color: hifi.colors.lightGray
|
||||
}
|
||||
RalewayRegular {
|
||||
id: buttonText;
|
||||
text: root.text;
|
||||
id: buttonText
|
||||
text: root.text
|
||||
// Text size
|
||||
size: 14;
|
||||
size: 14
|
||||
// Style
|
||||
color: hifi.colors.lightGray;
|
||||
elide: Text.ElideRight;
|
||||
horizontalAlignment: Text.AlignHCenter;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
color: hifi.colors.lightGray
|
||||
elide: Text.ElideRight
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
// Anchors
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: 20;
|
||||
anchors.top: parent.top;
|
||||
height: parent.height;
|
||||
anchors.left: buttonGlyph.right
|
||||
anchors.leftMargin: 5
|
||||
anchors.top: parent.top
|
||||
height: parent.height
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
hoverEnabled: enabled;
|
||||
anchors.fill: parent
|
||||
hoverEnabled: enabled
|
||||
onClicked: {
|
||||
root.clicked();
|
||||
}
|
||||
|
|
|
@ -50,9 +50,10 @@ void QmlMarketplace::getMarketplaceItems(
|
|||
const QString& adminFilter,
|
||||
const QString& adminFilterCost,
|
||||
const QString& sort,
|
||||
const bool isFree,
|
||||
const int& page,
|
||||
const int& perPage) {
|
||||
bool isAscending,
|
||||
bool isFree,
|
||||
int page,
|
||||
int perPage) {
|
||||
|
||||
QString endpoint = "items";
|
||||
QUrlQuery request;
|
||||
|
@ -62,6 +63,7 @@ void QmlMarketplace::getMarketplaceItems(
|
|||
request.addQueryItem("adminFilter", adminFilter);
|
||||
request.addQueryItem("adminFilterCost", adminFilterCost);
|
||||
request.addQueryItem("sort", sort);
|
||||
request.addQueryItem("sort_dir", isAscending ? "asc" : "desc");
|
||||
if (isFree) {
|
||||
request.addQueryItem("isFree", "true");
|
||||
}
|
||||
|
|
|
@ -46,9 +46,10 @@ protected:
|
|||
const QString& adminFilter = QString("published"),
|
||||
const QString& adminFilterCost = QString(),
|
||||
const QString& sort = QString(),
|
||||
const bool isFree = false,
|
||||
const int& page = 1,
|
||||
const int& perPage = 20);
|
||||
bool isAscending = false,
|
||||
bool isFree = false,
|
||||
int page = 1,
|
||||
int perPage = 20);
|
||||
Q_INVOKABLE void getMarketplaceItem(const QString& marketplaceItemId);
|
||||
Q_INVOKABLE void marketplaceItemLike(const QString& marketplaceItemId, const bool like = true);
|
||||
Q_INVOKABLE void getMarketplaceCategories();
|
||||
|
|
Loading…
Reference in a new issue