mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 19:59:20 +02:00
Merge branch 'QmlMarketplace' of https://github.com/roxanneskelly/hifi into QmlMarketplace
This commit is contained in:
commit
fb524f8900
6 changed files with 101 additions and 69 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
|
||||
|
@ -316,23 +317,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;
|
||||
}
|
||||
}
|
||||
|
@ -498,6 +504,7 @@ Rectangle {
|
|||
"",
|
||||
"",
|
||||
root.sortString,
|
||||
root.isAscending,
|
||||
WalletScriptingInterface.limitedCommerce,
|
||||
marketBrowseModel.currentPageToRetrieve,
|
||||
marketBrowseModel.itemsPerPage
|
||||
|
@ -726,7 +733,7 @@ Rectangle {
|
|||
top: parent.top
|
||||
leftMargin: 20
|
||||
}
|
||||
width: root.isLoggedIn ? 322 : 242
|
||||
width: root.isLoggedIn ? 342 : 262
|
||||
height: 36
|
||||
|
||||
radius: 4
|
||||
|
@ -737,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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,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"
|
||||
|
@ -794,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;
|
||||
|
@ -802,7 +815,7 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
highlight: Rectangle {
|
||||
width: 80
|
||||
width: 85
|
||||
height: parent.height
|
||||
|
||||
color: hifi.colors.faintGray
|
||||
|
@ -1125,6 +1138,8 @@ Rectangle {
|
|||
fill: parent
|
||||
}
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
|
||||
RalewayRegular {
|
||||
id: licenseText
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
<h2>Proof of Provenance License (PoP License) v1.0</h2>
|
||||
<br>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p><i>
|
||||
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.
|
||||
</i></p>
|
|
@ -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