update for marketplace-in-qml, and make specific to username

This commit is contained in:
Howard Stearns 2019-02-15 10:58:09 -08:00
parent 8a6f2b221b
commit 490ef3542e
3 changed files with 25 additions and 11 deletions

View file

@ -120,7 +120,7 @@ Rectangle {
marketplaceItem.description = result.data.description;
marketplaceItem.attributions = result.data.attributions;
marketplaceItem.license = result.data.license;
marketplaceItem.available = result.data.availability === "available";
marketplaceItem.availability = result.data.availability;
marketplaceItem.created_at = result.data.created_at;
marketplaceItemScrollView.contentHeight = marketplaceItemContent.height;
itemsList.visible = false;
@ -532,7 +532,7 @@ Rectangle {
creator: model.creator
category: model.primary_category
price: model.cost
available: model.availability === "available"
availability: model.availability
isLoggedIn: root.isLoggedIn;
onShowItem: {
@ -704,7 +704,7 @@ Rectangle {
topMargin: 10;
leftMargin: 15;
}
height: visible ? childrenRect.height : 0
height: visible ? 36 : 0
RalewayRegular {
id: sortText
@ -727,7 +727,7 @@ Rectangle {
leftMargin: 20
}
width: root.isLoggedIn ? 322 : 242
height: 36
height: parent.height
radius: 4
border.width: 1

View file

@ -33,11 +33,11 @@ Rectangle {
property string creator: ""
property var categories: []
property int price: 0
property string availability: "unknown"
property var attributions: []
property string description: ""
property string license: ""
property string posted: ""
property bool available: false
property string created_at: ""
property bool isLoggedIn: false;
property int edition: -1;
@ -264,9 +264,15 @@ Rectangle {
}
height: 50
text: root.edition >= 0 ? "UPGRADE FOR FREE" : (root.available ? (root.price ? root.price : "FREE") : "UNAVAILABLE (not for sale)")
enabled: root.edition >= 0 || root.available
buttonGlyph: root.available ? (root.price ? hifi.glyphs.hfc : "") : ""
property bool isNFS: availability === "not for sale" // Note: server will say "sold out" or "invalidated" before it says NFS
property bool isMine: creator === Account.username
property bool isUpgrade: root.edition >= 0
property int costToMe: ((isMine && isNFS) || isUpgrade) ? 0 : price
property bool isAvailable: costToMe >= 0
text: isUpgrade ? "UPGRADE FOR FREE" : (isAvailable ? (costToMe || "FREE") : ("UNAVAILABLE (" + availibility + ")"))
enabled: isAvailable
buttonGlyph: isAvailable ? (costToMe ? hifi.glyphs.hfc : "") : ""
color: hifi.buttons.blue
onClicked: root.buy();

View file

@ -34,7 +34,7 @@ Rectangle {
property string creator: ""
property string category: ""
property int price: 0
property bool available: false
property string availability: "unknown"
property bool isLoggedIn: false;
signal buy()
@ -299,8 +299,16 @@ Rectangle {
bottomMargin: 10
}
text: root.price ? root.price : "FREE"
buttonGlyph: root.price ? hifi.glyphs.hfc : ""
property bool isNFS: availability === "not for sale" // Note: server will say "sold out" or "invalidated" before it says NFS
property bool isMine: creator === Account.username
property bool isUpgrade: root.edition >= 0
property int costToMe: ((isMine && isNFS) || isUpgrade) ? 0 : price
property bool isAvailable: costToMe >= 0
text: isUpgrade ? "UPGRADE FOR FREE" : (isAvailable ? (costToMe || "FREE") : ("UNAVAILABLE (" + availibility + ")"))
enabled: isAvailable
buttonGlyph: isAvailable ? (costToMe ? hifi.glyphs.hfc : "") : ""
color: hifi.buttons.blue;
onClicked: root.buy();