From a0199c58841cbeee79ef5c9b8b176b61d43e133a Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Mon, 11 Feb 2019 12:27:02 -0800 Subject: [PATCH 1/3] Case 21119, 21120 Case 21119 - text filter doesn't change as you type in new (qml) marketplace Case 21120 - text filter doesn't clear in new (qml) marketplace --- .../hifi/commerce/marketplace/Marketplace.qml | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml b/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml index 0d42cb599e..0f02e46529 100644 --- a/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml +++ b/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml @@ -316,23 +316,28 @@ Rectangle { font.pixelSize: hifi.fontSizes.textFieldInput placeholderText: "Search Marketplace" + Timer { + id: keypressTimer + running: false + repeat: false + interval: 300 + onTriggered: searchField.accepted() + + } + // workaround for https://bugreports.qt.io/browse/QTBUG-49297 Keys.onPressed: { switch (event.key) { case Qt.Key_Return: case Qt.Key_Enter: event.accepted = true; + searchField.text = ""; - // emit accepted signal manually - if (acceptableInput) { - searchField.accepted(); - searchField.forceActiveFocus(); - } + getMarketplaceItems(); + searchField.forceActiveFocus(); break; - case Qt.Key_Backspace: - if (searchField.text === "") { - primaryFilter_index = -1; - } + default: + keypressTimer.restart(); break; } } From 4f8de7ed0bd912fda1a3124103a8b0718ab42509 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Mon, 11 Feb 2019 12:48:04 -0800 Subject: [PATCH 2/3] Case 21123, Case - marketplace license display has weird crud in it (new qml version) --- .../qml/hifi/commerce/marketplace/Marketplace.qml | 2 ++ .../hifi/commerce/marketplace/MarketplaceItem.qml | 2 +- .../qml/hifi/commerce/marketplace/licenses/Popv1.txt | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 interface/resources/qml/hifi/commerce/marketplace/licenses/Popv1.txt diff --git a/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml b/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml index 0f02e46529..65fe35d4ee 100644 --- a/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml +++ b/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml @@ -1130,6 +1130,8 @@ Rectangle { fill: parent } + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + RalewayRegular { id: licenseText diff --git a/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml b/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml index 0a57e56099..2c7a50033c 100644 --- a/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml +++ b/interface/resources/qml/hifi/commerce/marketplace/MarketplaceItem.qml @@ -520,7 +520,7 @@ Rectangle { } else if (root.license === "Attribution-NonCommercial-NoDerivs (CC BY-NC-ND)") { url = "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.txt" } else if (root.license === "Proof of Provenance License (PoP License)") { - url = "https://digitalassetregistry.com/PoP-License/v1/" + url = "licenses/Popv1.txt" } if(url) { showLicense(url) diff --git a/interface/resources/qml/hifi/commerce/marketplace/licenses/Popv1.txt b/interface/resources/qml/hifi/commerce/marketplace/licenses/Popv1.txt new file mode 100644 index 0000000000..1f44fc19e6 --- /dev/null +++ b/interface/resources/qml/hifi/commerce/marketplace/licenses/Popv1.txt @@ -0,0 +1,12 @@ + +

Proof of Provenance License (PoP License) v1.0

+
+

+ Subject to the terms and conditions of this license, the Copyright Holder grants a worldwide, non-exclusive, non-sublicensable, non-transferable (except by transfer of the Certificate or beneficial ownership thereof) license (i) to the Certificate Holder to display ONE COPY of the Item at a time across any and all virtual worlds WITHOUT MODIFICATION; (ii) to any party to view and interact with the Item as displayed by the Certificate Holder. Redistributions of source code must retain the all copyright notices. Notwithstanding the foregoing, modification of the Item may be permitted pursuant to terms provided in the Certificate. +

+

+ THE ITEM IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR A CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ITEM, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +

+

+ Reference to the “Certificate” means the Proof of Provenance Certificate containing a hash of the code used to generate the Item; ‘Item’ means the visual representation produced by the execution of the code hashed in the Certificate (which term includes the code itself); and “Certificate Holder” means a single holder of the private key for the Certificate. +

From a82221d2a5a086493ffe3e5948bbb502bdbc93a2 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Tue, 12 Feb 2019 13:20:47 -0800 Subject: [PATCH 3/3] Case 21118 - descending sorts don't work in new (qml) marketplace --- .../hifi/commerce/marketplace/Marketplace.qml | 40 ++++++---- .../hifi/commerce/marketplace/SortButton.qml | 76 ++++++++++--------- interface/src/commerce/QmlMarketplace.cpp | 8 +- interface/src/commerce/QmlMarketplace.h | 7 +- 4 files changed, 72 insertions(+), 59 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml b/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml index 65fe35d4ee..cdb8368296 100644 --- a/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml +++ b/interface/resources/qml/hifi/commerce/marketplace/Marketplace.qml @@ -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 diff --git a/interface/resources/qml/hifi/commerce/marketplace/SortButton.qml b/interface/resources/qml/hifi/commerce/marketplace/SortButton.qml index 37ad2735ce..e876842d89 100644 --- a/interface/resources/qml/hifi/commerce/marketplace/SortButton.qml +++ b/interface/resources/qml/hifi/commerce/marketplace/SortButton.qml @@ -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(); } diff --git a/interface/src/commerce/QmlMarketplace.cpp b/interface/src/commerce/QmlMarketplace.cpp index 23ba418a2d..8197b20275 100644 --- a/interface/src/commerce/QmlMarketplace.cpp +++ b/interface/src/commerce/QmlMarketplace.cpp @@ -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"); } diff --git a/interface/src/commerce/QmlMarketplace.h b/interface/src/commerce/QmlMarketplace.h index 5794d4f53c..76b3d41449 100644 --- a/interface/src/commerce/QmlMarketplace.h +++ b/interface/src/commerce/QmlMarketplace.h @@ -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();