mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
Merge pull request #14765 from howard-stearns/artist-stocking-inventory
Case 20657: artist stocking inventory
This commit is contained in:
commit
d7d6ff53ca
4 changed files with 69 additions and 40 deletions
|
@ -33,15 +33,19 @@ Rectangle {
|
||||||
property bool balanceReceived: false;
|
property bool balanceReceived: false;
|
||||||
property bool availableUpdatesReceived: false;
|
property bool availableUpdatesReceived: false;
|
||||||
property bool itemInfoReceived: false;
|
property bool itemInfoReceived: false;
|
||||||
|
property bool dataReady: itemInfoReceived && ownershipStatusReceived && balanceReceived && availableUpdatesReceived;
|
||||||
property string baseItemName: "";
|
property string baseItemName: "";
|
||||||
property string itemName;
|
property string itemName;
|
||||||
property string itemId;
|
property string itemId;
|
||||||
property string itemHref;
|
property string itemHref;
|
||||||
property string itemAuthor;
|
property string itemAuthor;
|
||||||
property int itemEdition: -1;
|
property int itemEdition: -1;
|
||||||
|
property bool hasSomethingToTradeIn: alreadyOwned && (itemEdition > 0); // i.e., don't trade in your artist's proof
|
||||||
|
property bool isTradingIn: isUpdating && hasSomethingToTradeIn;
|
||||||
|
property bool isStocking: availability === 'not for sale' && creator === Account.username;
|
||||||
property string certificateId;
|
property string certificateId;
|
||||||
property double balanceAfterPurchase;
|
property double balanceAfterPurchase;
|
||||||
property bool alreadyOwned: false;
|
property bool alreadyOwned: false; // Including proofs
|
||||||
property int itemPrice: -1;
|
property int itemPrice: -1;
|
||||||
property bool isCertified;
|
property bool isCertified;
|
||||||
property string itemType: "unknown";
|
property string itemType: "unknown";
|
||||||
|
@ -56,6 +60,8 @@ Rectangle {
|
||||||
property string referrer;
|
property string referrer;
|
||||||
property bool isInstalled;
|
property bool isInstalled;
|
||||||
property bool isUpdating;
|
property bool isUpdating;
|
||||||
|
property string availability: "available";
|
||||||
|
property string creator: "";
|
||||||
property string baseAppURL;
|
property string baseAppURL;
|
||||||
property int currentUpdatesPage: 1;
|
property int currentUpdatesPage: 1;
|
||||||
// Style
|
// Style
|
||||||
|
@ -434,7 +440,7 @@ Rectangle {
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: itemPreviewImage.right;
|
anchors.left: itemPreviewImage.right;
|
||||||
anchors.leftMargin: 12;
|
anchors.leftMargin: 12;
|
||||||
anchors.right: itemPriceContainer.left;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 8;
|
anchors.rightMargin: 8;
|
||||||
height: 30;
|
height: 30;
|
||||||
// Style
|
// Style
|
||||||
|
@ -449,21 +455,22 @@ Rectangle {
|
||||||
Item {
|
Item {
|
||||||
id: itemPriceContainer;
|
id: itemPriceContainer;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: itemNameText.bottom;
|
||||||
anchors.right: parent.right;
|
anchors.topMargin: 8;
|
||||||
|
anchors.left: itemNameText.left;
|
||||||
height: 30;
|
height: 30;
|
||||||
width: itemPriceTextLabel.width + itemPriceText.width + 20;
|
width: itemPriceText.width + 20;
|
||||||
|
|
||||||
// "HFC" balance label
|
// "HFC" label
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: itemPriceTextLabel;
|
id: itemPriceTextLabel;
|
||||||
visible: !(root.isUpdating && root.itemEdition > 0) && (root.itemPrice > 0);
|
visible: !isTradingIn && (root.itemPrice > 0);
|
||||||
text: hifi.glyphs.hfc;
|
text: hifi.glyphs.hfc;
|
||||||
// Size
|
// Size
|
||||||
size: 30;
|
size: 30;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.right: itemPriceText.left;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 4;
|
//anchors.rightMargin: 4;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 0;
|
anchors.topMargin: 0;
|
||||||
width: paintedWidth;
|
width: paintedWidth;
|
||||||
|
@ -473,13 +480,15 @@ Rectangle {
|
||||||
}
|
}
|
||||||
FiraSansSemiBold {
|
FiraSansSemiBold {
|
||||||
id: itemPriceText;
|
id: itemPriceText;
|
||||||
text: (root.isUpdating && root.itemEdition > 0) ? "FREE\nUPDATE" : ((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE"));
|
text: isTradingIn ? "FREE\nUPDATE" :
|
||||||
|
(isStocking ? "Free for creator" :
|
||||||
|
((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE")));
|
||||||
// Text size
|
// Text size
|
||||||
size: (root.isUpdating && root.itemEdition > 0) ? 20 : 26;
|
size: isTradingIn ? 20 : 26;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.right: parent.right;
|
anchors.left: itemPriceTextLabel.visible ? itemPriceTextLabel.right : parent.left;
|
||||||
anchors.rightMargin: 16;
|
anchors.leftMargin: 4;
|
||||||
width: paintedWidth;
|
width: paintedWidth;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
|
@ -571,7 +580,7 @@ Rectangle {
|
||||||
// "View in Inventory" button
|
// "View in Inventory" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: viewInMyPurchasesButton;
|
id: viewInMyPurchasesButton;
|
||||||
visible: false;
|
visible: isCertified && dataReady && (isUpdating ? !hasSomethingToTradeIn : alreadyOwned);
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
anchors.top: buyTextContainer.visible ? buyTextContainer.bottom : checkoutActionButtonsContainer.top;
|
anchors.top: buyTextContainer.visible ? buyTextContainer.bottom : checkoutActionButtonsContainer.top;
|
||||||
|
@ -592,8 +601,8 @@ Rectangle {
|
||||||
// "Buy" button
|
// "Buy" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: buyButton;
|
id: buyButton;
|
||||||
visible: !((root.itemType === "avatar" || root.itemType === "app") && viewInMyPurchasesButton.visible)
|
visible: isTradingIn || !alreadyOwned || isStocking || !(root.itemType === "avatar" || root.itemType === "app");
|
||||||
enabled: (root.balanceAfterPurchase >= 0 && ownershipStatusReceived && balanceReceived && availableUpdatesReceived) || (!root.isCertified) || root.isUpdating;
|
enabled: (root.balanceAfterPurchase >= 0 && dataReady) || (!root.isCertified) || root.isUpdating;
|
||||||
color: viewInMyPurchasesButton.visible ? hifi.buttons.white : hifi.buttons.blue;
|
color: viewInMyPurchasesButton.visible ? hifi.buttons.white : hifi.buttons.blue;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
anchors.top: viewInMyPurchasesButton.visible ? viewInMyPurchasesButton.bottom :
|
anchors.top: viewInMyPurchasesButton.visible ? viewInMyPurchasesButton.bottom :
|
||||||
|
@ -602,10 +611,15 @@ Rectangle {
|
||||||
height: 50;
|
height: 50;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
text: (root.isUpdating && root.itemEdition > 0) ? "CONFIRM UPDATE" : (((root.isCertified) ? ((ownershipStatusReceived && balanceReceived && availableUpdatesReceived) ?
|
text: isTradingIn ?
|
||||||
((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") : "--") : "Get Item"));
|
"CONFIRM UPDATE" :
|
||||||
|
(((root.isCertified) ?
|
||||||
|
(dataReady ?
|
||||||
|
((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") :
|
||||||
|
"--") :
|
||||||
|
"Get Item"));
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.isUpdating && root.itemEdition > 0) {
|
if (isTradingIn) {
|
||||||
// If we're updating an app, the existing app needs to be uninstalled.
|
// If we're updating an app, the existing app needs to be uninstalled.
|
||||||
// This call will fail/return `false` if the app isn't installed, but that's OK.
|
// This call will fail/return `false` if the app isn't installed, but that's OK.
|
||||||
if (root.itemType === "app") {
|
if (root.itemType === "app") {
|
||||||
|
@ -1063,7 +1077,11 @@ Rectangle {
|
||||||
buyButton.color = hifi.buttons.red;
|
buyButton.color = hifi.buttons.red;
|
||||||
root.shouldBuyWithControlledFailure = true;
|
root.shouldBuyWithControlledFailure = true;
|
||||||
} else {
|
} else {
|
||||||
buyButton.text = (root.isCertified ? ((ownershipStatusReceived && balanceReceived && availableUpdatesReceived) ? (root.alreadyOwned ? "Buy Another" : "Buy"): "--") : "Get Item");
|
buyButton.text = (root.isCertified ?
|
||||||
|
(dataReady ?
|
||||||
|
(root.alreadyOwned ? "Buy Another" : "Buy") :
|
||||||
|
"--") :
|
||||||
|
"Get Item");
|
||||||
buyButton.color = hifi.buttons.blue;
|
buyButton.color = hifi.buttons.blue;
|
||||||
root.shouldBuyWithControlledFailure = false;
|
root.shouldBuyWithControlledFailure = false;
|
||||||
}
|
}
|
||||||
|
@ -1091,6 +1109,8 @@ Rectangle {
|
||||||
root.itemPrice = result.data.cost;
|
root.itemPrice = result.data.cost;
|
||||||
root.itemAuthor = result.data.creator;
|
root.itemAuthor = result.data.creator;
|
||||||
root.itemType = result.data.item_type || "unknown";
|
root.itemType = result.data.item_type || "unknown";
|
||||||
|
root.availability = result.data.availability;
|
||||||
|
root.creator = result.data.creator;
|
||||||
if (root.itemType === "unknown") {
|
if (root.itemType === "unknown") {
|
||||||
root.itemHref = result.data.review_url;
|
root.itemHref = result.data.review_url;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1139,7 +1159,7 @@ Rectangle {
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
function canBuyAgain() {
|
function canBuyAgain() {
|
||||||
return (root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet" || root.itemType === "unknown");
|
return root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet" || root.itemType === "unknown" || isStocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleContentSets() {
|
function handleContentSets() {
|
||||||
|
@ -1185,29 +1205,23 @@ Rectangle {
|
||||||
|
|
||||||
function refreshBuyUI() {
|
function refreshBuyUI() {
|
||||||
if (root.isCertified) {
|
if (root.isCertified) {
|
||||||
if (root.ownershipStatusReceived && root.balanceReceived && root.availableUpdatesReceived) {
|
if (dataReady) {
|
||||||
buyText.text = "";
|
buyText.text = "";
|
||||||
|
|
||||||
// If the user IS on the checkout page for the updated version of an owned item...
|
// If the user IS on the checkout page for the updated version of an owned item...
|
||||||
if (root.isUpdating) {
|
if (root.isUpdating) {
|
||||||
// If the user HAS already selected a specific edition to update...
|
// If the user HAS already selected a specific edition to update...
|
||||||
if (root.itemEdition > 0) {
|
if (hasSomethingToTradeIn) {
|
||||||
buyText.text = "By pressing \"Confirm Update\", you agree to trade in your old item for the updated item that replaces it.";
|
buyText.text = "By pressing \"Confirm Update\", you agree to trade in your old item for the updated item that replaces it.";
|
||||||
buyTextContainer.color = "#FFFFFF";
|
buyTextContainer.color = "#FFFFFF";
|
||||||
buyTextContainer.border.color = "#FFFFFF";
|
buyTextContainer.border.color = "#FFFFFF";
|
||||||
// Else if the user HAS NOT selected a specific edition to update...
|
// Else if the user HAS NOT selected a specific edition to update...
|
||||||
} else {
|
} else {
|
||||||
viewInMyPurchasesButton.visible = true;
|
|
||||||
|
|
||||||
handleBuyAgainLogic();
|
handleBuyAgainLogic();
|
||||||
}
|
}
|
||||||
// If the user IS NOT on the checkout page for the updated verison of an owned item...
|
// If the user IS NOT on the checkout page for the updated verison of an owned item...
|
||||||
// (i.e. they are checking out an item "normally")
|
// (i.e. they are checking out an item "normally")
|
||||||
} else {
|
} else {
|
||||||
if (root.alreadyOwned) {
|
|
||||||
viewInMyPurchasesButton.visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleBuyAgainLogic();
|
handleBuyAgainLogic();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -121,7 +121,7 @@ Rectangle {
|
||||||
marketplaceItem.description = result.data.description;
|
marketplaceItem.description = result.data.description;
|
||||||
marketplaceItem.attributions = result.data.attributions;
|
marketplaceItem.attributions = result.data.attributions;
|
||||||
marketplaceItem.license = result.data.license;
|
marketplaceItem.license = result.data.license;
|
||||||
marketplaceItem.available = result.data.availability === "available";
|
marketplaceItem.availability = result.data.availability;
|
||||||
marketplaceItem.created_at = result.data.created_at;
|
marketplaceItem.created_at = result.data.created_at;
|
||||||
marketplaceItemScrollView.contentHeight = marketplaceItemContent.height;
|
marketplaceItemScrollView.contentHeight = marketplaceItemContent.height;
|
||||||
itemsList.visible = false;
|
itemsList.visible = false;
|
||||||
|
@ -539,7 +539,7 @@ Rectangle {
|
||||||
creator: model.creator
|
creator: model.creator
|
||||||
category: model.primary_category
|
category: model.primary_category
|
||||||
price: model.cost
|
price: model.cost
|
||||||
available: model.availability === "available"
|
availability: model.availability
|
||||||
isLoggedIn: root.isLoggedIn;
|
isLoggedIn: root.isLoggedIn;
|
||||||
|
|
||||||
onShowItem: {
|
onShowItem: {
|
||||||
|
@ -711,7 +711,7 @@ Rectangle {
|
||||||
topMargin: 10;
|
topMargin: 10;
|
||||||
leftMargin: 15;
|
leftMargin: 15;
|
||||||
}
|
}
|
||||||
height: visible ? childrenRect.height : 0
|
height: visible ? 36 : 0
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: sortText
|
id: sortText
|
||||||
|
@ -733,8 +733,9 @@ Rectangle {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
leftMargin: 20
|
leftMargin: 20
|
||||||
}
|
}
|
||||||
|
|
||||||
width: root.isLoggedIn ? 342 : 262
|
width: root.isLoggedIn ? 342 : 262
|
||||||
height: 36
|
height: parent.height
|
||||||
|
|
||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
|
@ -33,11 +33,11 @@ Rectangle {
|
||||||
property string creator: ""
|
property string creator: ""
|
||||||
property var categories: []
|
property var categories: []
|
||||||
property int price: 0
|
property int price: 0
|
||||||
|
property string availability: "unknown"
|
||||||
property var attributions: []
|
property var attributions: []
|
||||||
property string description: ""
|
property string description: ""
|
||||||
property string license: ""
|
property string license: ""
|
||||||
property string posted: ""
|
property string posted: ""
|
||||||
property bool available: false
|
|
||||||
property string created_at: ""
|
property string created_at: ""
|
||||||
property bool isLoggedIn: false;
|
property bool isLoggedIn: false;
|
||||||
property int edition: -1;
|
property int edition: -1;
|
||||||
|
@ -264,9 +264,15 @@ Rectangle {
|
||||||
}
|
}
|
||||||
height: 50
|
height: 50
|
||||||
|
|
||||||
text: root.edition >= 0 ? "UPGRADE FOR FREE" : (root.available ? (root.price ? root.price : "FREE") : "UNAVAILABLE (not for sale)")
|
property bool isNFS: availability === "not for sale" // Note: server will say "sold out" or "invalidated" before it says NFS
|
||||||
enabled: root.edition >= 0 || root.available
|
property bool isMine: creator === Account.username
|
||||||
buttonGlyph: root.available ? (root.price ? hifi.glyphs.hfc : "") : ""
|
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") : availability)
|
||||||
|
enabled: isAvailable
|
||||||
|
buttonGlyph: isAvailable ? (costToMe ? hifi.glyphs.hfc : "") : ""
|
||||||
color: hifi.buttons.blue
|
color: hifi.buttons.blue
|
||||||
|
|
||||||
onClicked: root.buy();
|
onClicked: root.buy();
|
||||||
|
|
|
@ -34,7 +34,7 @@ Rectangle {
|
||||||
property string creator: ""
|
property string creator: ""
|
||||||
property string category: ""
|
property string category: ""
|
||||||
property int price: 0
|
property int price: 0
|
||||||
property bool available: false
|
property string availability: "unknown"
|
||||||
property bool isLoggedIn: false;
|
property bool isLoggedIn: false;
|
||||||
|
|
||||||
signal buy()
|
signal buy()
|
||||||
|
@ -299,8 +299,16 @@ Rectangle {
|
||||||
bottomMargin: 10
|
bottomMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
text: root.price ? root.price : "FREE"
|
property bool isNFS: availability === "not for sale" // Note: server will say "sold out" or "invalidated" before it says NFS
|
||||||
buttonGlyph: root.price ? hifi.glyphs.hfc : ""
|
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") : availability)
|
||||||
|
enabled: isAvailable
|
||||||
|
buttonGlyph: isAvailable ? (costToMe ? hifi.glyphs.hfc : "") : ""
|
||||||
|
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
|
|
||||||
onClicked: root.buy();
|
onClicked: root.buy();
|
||||||
|
|
Loading…
Reference in a new issue