diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index f337e55dc9..2163407e0b 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -75,7 +75,7 @@ Rectangle { onBuyResult: { if (result.status !== 'success') { - failureErrorText.text = "Here's some more info about the error:

" + (result.message); + failureErrorText.text = result.message; root.activeView = "checkoutFailure"; } else { root.activeView = "checkoutSuccess"; @@ -312,12 +312,12 @@ Rectangle { id: itemPriceTextLabel; text: hifi.glyphs.hfc; // Size - size: 36; + size: 30; // Anchors anchors.right: itemPriceText.left; anchors.rightMargin: 4; anchors.top: parent.top; - anchors.topMargin: -4; + anchors.topMargin: 0; width: paintedWidth; height: paintedHeight; // Style @@ -395,7 +395,7 @@ Rectangle { verticalAlignment: Text.AlignTop; } - RalewaySemiBold { + RalewayRegular { id: buyText; // Text size size: 18; @@ -699,7 +699,9 @@ Rectangle { anchors.top: titleBarContainer.bottom; anchors.bottom: root.bottom; anchors.left: parent.left; + anchors.leftMargin: 16; anchors.right: parent.right; + anchors.rightMargin: 16; RalewayRegular { id: failureHeaderText; @@ -708,57 +710,65 @@ Rectangle { size: 24; // Anchors anchors.top: parent.top; - anchors.topMargin: 80; + anchors.topMargin: 40; height: paintedHeight; anchors.left: parent.left; anchors.right: parent.right; // Style color: hifi.colors.black; wrapMode: Text.WordWrap; - // Alignment - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignVCenter; } - RalewayRegular { - id: failureErrorText; - // Text size - size: 16; - // Anchors + Rectangle { + id: failureErrorTextContainer; anchors.top: failureHeaderText.bottom; anchors.topMargin: 35; - height: paintedHeight; anchors.left: parent.left; anchors.right: parent.right; - // Style - color: hifi.colors.black; - wrapMode: Text.WordWrap; - // Alignment - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignVCenter; + height: failureErrorText.height + 30; + radius: 4; + border.width: 2; + border.color: "#F3808F"; + color: "#FFC3CD"; + + AnonymousProRegular { + id: failureErrorText; + // Text size + size: 16; + // Anchors + anchors.top: parent.top; + anchors.topMargin: 15; + anchors.left: parent.left; + anchors.leftMargin: 8; + anchors.right: parent.right; + anchors.rightMargin: 8; + height: paintedHeight; + // Style + color: hifi.colors.black; + wrapMode: Text.Wrap; + verticalAlignment: Text.AlignVCenter; + } } Item { id: backToMarketplaceButtonContainer; // Size width: root.width; - height: 130; + height: 50; // Anchors anchors.left: parent.left; anchors.bottom: parent.bottom; - anchors.bottomMargin: 8; + anchors.bottomMargin: 16; // "Back to Marketplace" button HifiControlsUit.Button { id: backToMarketplaceButton; - color: hifi.buttons.black; + color: hifi.buttons.noneBorderlessGray; colorScheme: hifi.colorSchemes.light; anchors.top: parent.top; - anchors.topMargin: 3; anchors.bottom: parent.bottom; - anchors.bottomMargin: 3; - anchors.right: parent.right; - anchors.rightMargin: 20; - width: parent.width/2 - anchors.rightMargin*2; + anchors.left: parent.left; + anchors.leftMargin: 16; + width: parent.width/2 - anchors.leftMargin*2; text: "Back to Marketplace"; onClicked: { sendToScript({method: 'checkout_continueShopping', itemId: itemId}); @@ -806,7 +816,7 @@ Rectangle { itemId = message.params.itemId; itemNameText.text = message.params.itemName; root.itemPrice = message.params.itemPrice; - itemPriceText.text = root.itemPrice === 0 ? "Free" : root.itemPrice; + itemPriceText.text = root.itemPrice; itemHref = message.params.itemHref; itemPreviewImageUrl = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg"; if (itemHref.indexOf('.json') === -1) { @@ -834,10 +844,10 @@ Rectangle { if (root.purchasesReceived && root.balanceReceived) { if (root.balanceAfterPurchase < 0) { if (root.alreadyOwned) { - buyText.text = "Your Wallet does not have sufficient funds to purchase this item again.
" + - 'View the copy you own in My Purchases'; + buyText.text = "Your Wallet does not have sufficient funds to purchase this item again.
" + + 'View the copy you own in My Purchases
'; } else { - buyText.text = "Your Wallet does not have sufficient funds to purchase this item."; + buyText.text = "Your Wallet does not have sufficient funds to purchase this item."; } buyTextContainer.color = "#FFC3CD"; buyTextContainer.border.color = "#F3808F"; @@ -845,8 +855,8 @@ Rectangle { buyGlyph.size = 54; } else { if (root.alreadyOwned) { - buyText.text = 'You already own this item.
Purchasing it will buy another copy.
View this item in My Purchases'; + buyText.text = 'You already own this item.
Purchasing it will buy another copy.
View this item in My Purchases
'; buyTextContainer.color = "#FFD6AD"; buyTextContainer.border.color = "#FAC07D"; buyGlyph.text = hifi.glyphs.alert; @@ -859,7 +869,7 @@ Rectangle { buyText.text = ""; } } else { - buyText.text = "This Marketplace item isn't an entity. It will not be added to your Purchases."; + buyText.text = "This free item will not be added to your Purchases. Non-entities can't yet be purchased for HFC."; buyTextContainer.color = "#FFD6AD"; buyTextContainer.border.color = "#FAC07D"; buyGlyph.text = hifi.glyphs.alert; diff --git a/interface/src/scripting/WalletScriptingInterface.cpp b/interface/src/scripting/WalletScriptingInterface.cpp index 94f8030fa2..2d94bf46cb 100644 --- a/interface/src/scripting/WalletScriptingInterface.cpp +++ b/interface/src/scripting/WalletScriptingInterface.cpp @@ -13,3 +13,28 @@ WalletScriptingInterface::WalletScriptingInterface() { } + +static const QString CHECKOUT_QML_PATH = qApp->applicationDirPath() + "../../../qml/hifi/commerce/checkout/Checkout.qml"; +void WalletScriptingInterface::buy() { + auto tabletScriptingInterface = DependencyManager::get(); + auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); + + if (!tablet->isPathLoaded(CHECKOUT_QML_PATH)) { + tablet->loadQMLSource(CHECKOUT_QML_PATH); + } + DependencyManager::get()->openTablet(); + + QVariant message = {}; + + + tablet->sendToQml(message); .sendToQml({ + method: 'updateCheckoutQML', params : { + itemId: '0d90d21c-ce7a-4990-ad18-e9d2cf991027', + itemName : 'Test Flaregun', + itemAuthor : 'hifiDave', + itemPrice : 17, + itemHref : 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json', + }, + canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified + }); +} \ No newline at end of file diff --git a/interface/src/scripting/WalletScriptingInterface.h b/interface/src/scripting/WalletScriptingInterface.h index 111a6eea3d..9ff3a0319e 100644 --- a/interface/src/scripting/WalletScriptingInterface.h +++ b/interface/src/scripting/WalletScriptingInterface.h @@ -15,6 +15,9 @@ #include #include +#include "scripting/HMDScriptingInterface.h" +#include + class WalletScriptingInterface : public QObject, public Dependency { Q_OBJECT @@ -27,6 +30,8 @@ public: Q_INVOKABLE uint getWalletStatus() { return _walletStatus; } void setWalletStatus(const uint& status) { _walletStatus = status; } + Q_INVOKABLE void buy(); + signals: void walletStatusChanged(); diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index 082e3ab4c0..326866ee7a 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -192,7 +192,7 @@ var dropDownElement = document.getElementById('user-dropdown'); purchasesElement.id = "purchasesButton"; purchasesElement.setAttribute('href', "#"); - purchasesElement.innerHTML = "MY PURCHASES"; + purchasesElement.innerHTML = "My Purchases"; // FRONTEND WEBDEV RANT: The username dropdown should REALLY not be programmed to be on the same // line as the search bar, overlaid on top of the search bar, floated right, and then relatively bumped up using "top:-50px". purchasesElement.style = "height:100%;margin-top:18px;font-weight:bold;float:right;margin-right:" + (dropDownElement.offsetWidth + 30) + diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 711f94d53e..3e54b22f75 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -60,6 +60,7 @@ var onCommerceScreen = false; var debugCheckout = false; + var debugError = false; function showMarketplace() { if (!debugCheckout) { UserActivityLogger.openedMarketplace(); @@ -71,7 +72,7 @@ itemId: '0d90d21c-ce7a-4990-ad18-e9d2cf991027', itemName: 'Test Flaregun', itemAuthor: 'hifiDave', - itemPrice: 17, + itemPrice: (debugError ? 10 : 17), itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json', }, canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified