mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 16:36:18 +02:00
Varied commit - styling changes, beginnings of new Wallet endpoint, etc
This commit is contained in:
parent
2b03e08c96
commit
15c0a21e0e
5 changed files with 78 additions and 37 deletions
|
@ -75,7 +75,7 @@ Rectangle {
|
||||||
|
|
||||||
onBuyResult: {
|
onBuyResult: {
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
failureErrorText.text = "Here's some more info about the error:<br><br>" + (result.message);
|
failureErrorText.text = result.message;
|
||||||
root.activeView = "checkoutFailure";
|
root.activeView = "checkoutFailure";
|
||||||
} else {
|
} else {
|
||||||
root.activeView = "checkoutSuccess";
|
root.activeView = "checkoutSuccess";
|
||||||
|
@ -312,12 +312,12 @@ Rectangle {
|
||||||
id: itemPriceTextLabel;
|
id: itemPriceTextLabel;
|
||||||
text: hifi.glyphs.hfc;
|
text: hifi.glyphs.hfc;
|
||||||
// Size
|
// Size
|
||||||
size: 36;
|
size: 30;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.right: itemPriceText.left;
|
anchors.right: itemPriceText.left;
|
||||||
anchors.rightMargin: 4;
|
anchors.rightMargin: 4;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: -4;
|
anchors.topMargin: 0;
|
||||||
width: paintedWidth;
|
width: paintedWidth;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
|
@ -395,7 +395,7 @@ Rectangle {
|
||||||
verticalAlignment: Text.AlignTop;
|
verticalAlignment: Text.AlignTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewayRegular {
|
||||||
id: buyText;
|
id: buyText;
|
||||||
// Text size
|
// Text size
|
||||||
size: 18;
|
size: 18;
|
||||||
|
@ -699,7 +699,9 @@ Rectangle {
|
||||||
anchors.top: titleBarContainer.bottom;
|
anchors.top: titleBarContainer.bottom;
|
||||||
anchors.bottom: root.bottom;
|
anchors.bottom: root.bottom;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: failureHeaderText;
|
id: failureHeaderText;
|
||||||
|
@ -708,57 +710,65 @@ Rectangle {
|
||||||
size: 24;
|
size: 24;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 80;
|
anchors.topMargin: 40;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.black;
|
color: hifi.colors.black;
|
||||||
wrapMode: Text.WordWrap;
|
wrapMode: Text.WordWrap;
|
||||||
// Alignment
|
|
||||||
horizontalAlignment: Text.AlignHCenter;
|
|
||||||
verticalAlignment: Text.AlignVCenter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewayRegular {
|
Rectangle {
|
||||||
|
id: failureErrorTextContainer;
|
||||||
|
anchors.top: failureHeaderText.bottom;
|
||||||
|
anchors.topMargin: 35;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: failureErrorText.height + 30;
|
||||||
|
radius: 4;
|
||||||
|
border.width: 2;
|
||||||
|
border.color: "#F3808F";
|
||||||
|
color: "#FFC3CD";
|
||||||
|
|
||||||
|
AnonymousProRegular {
|
||||||
id: failureErrorText;
|
id: failureErrorText;
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: failureHeaderText.bottom;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 35;
|
anchors.topMargin: 15;
|
||||||
height: paintedHeight;
|
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 8;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 8;
|
||||||
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.black;
|
color: hifi.colors.black;
|
||||||
wrapMode: Text.WordWrap;
|
wrapMode: Text.Wrap;
|
||||||
// Alignment
|
|
||||||
horizontalAlignment: Text.AlignHCenter;
|
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: backToMarketplaceButtonContainer;
|
id: backToMarketplaceButtonContainer;
|
||||||
// Size
|
// Size
|
||||||
width: root.width;
|
width: root.width;
|
||||||
height: 130;
|
height: 50;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: 8;
|
anchors.bottomMargin: 16;
|
||||||
// "Back to Marketplace" button
|
// "Back to Marketplace" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: backToMarketplaceButton;
|
id: backToMarketplaceButton;
|
||||||
color: hifi.buttons.black;
|
color: hifi.buttons.noneBorderlessGray;
|
||||||
colorScheme: hifi.colorSchemes.light;
|
colorScheme: hifi.colorSchemes.light;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 3;
|
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: 3;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.leftMargin: 16;
|
||||||
anchors.rightMargin: 20;
|
width: parent.width/2 - anchors.leftMargin*2;
|
||||||
width: parent.width/2 - anchors.rightMargin*2;
|
|
||||||
text: "Back to Marketplace";
|
text: "Back to Marketplace";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
sendToScript({method: 'checkout_continueShopping', itemId: itemId});
|
sendToScript({method: 'checkout_continueShopping', itemId: itemId});
|
||||||
|
@ -806,7 +816,7 @@ Rectangle {
|
||||||
itemId = message.params.itemId;
|
itemId = message.params.itemId;
|
||||||
itemNameText.text = message.params.itemName;
|
itemNameText.text = message.params.itemName;
|
||||||
root.itemPrice = message.params.itemPrice;
|
root.itemPrice = message.params.itemPrice;
|
||||||
itemPriceText.text = root.itemPrice === 0 ? "Free" : root.itemPrice;
|
itemPriceText.text = root.itemPrice;
|
||||||
itemHref = message.params.itemHref;
|
itemHref = message.params.itemHref;
|
||||||
itemPreviewImageUrl = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
itemPreviewImageUrl = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
||||||
if (itemHref.indexOf('.json') === -1) {
|
if (itemHref.indexOf('.json') === -1) {
|
||||||
|
@ -834,10 +844,10 @@ Rectangle {
|
||||||
if (root.purchasesReceived && root.balanceReceived) {
|
if (root.purchasesReceived && root.balanceReceived) {
|
||||||
if (root.balanceAfterPurchase < 0) {
|
if (root.balanceAfterPurchase < 0) {
|
||||||
if (root.alreadyOwned) {
|
if (root.alreadyOwned) {
|
||||||
buyText.text = "Your Wallet does not have sufficient funds to purchase this item again.<br>" +
|
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item again.<br>" +
|
||||||
'<font color="' + hifi.colors.blueAccent + '"><a href="#">View the copy you own in My Purchases</a></font>';
|
'<font color="' + hifi.colors.blueAccent + '"><a href="#">View the copy you own in My Purchases</a></font></b>';
|
||||||
} else {
|
} else {
|
||||||
buyText.text = "Your Wallet does not have sufficient funds to purchase this item.";
|
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item.</b>";
|
||||||
}
|
}
|
||||||
buyTextContainer.color = "#FFC3CD";
|
buyTextContainer.color = "#FFC3CD";
|
||||||
buyTextContainer.border.color = "#F3808F";
|
buyTextContainer.border.color = "#F3808F";
|
||||||
|
@ -845,8 +855,8 @@ Rectangle {
|
||||||
buyGlyph.size = 54;
|
buyGlyph.size = 54;
|
||||||
} else {
|
} else {
|
||||||
if (root.alreadyOwned) {
|
if (root.alreadyOwned) {
|
||||||
buyText.text = 'You already own this item.<br>Purchasing it will buy another copy.<br><font color="'
|
buyText.text = '<b>You already own this item.<br>Purchasing it will buy another copy.<br><font color="'
|
||||||
+ hifi.colors.blueAccent + '"><a href="#">View this item in My Purchases</a></font>';
|
+ hifi.colors.blueAccent + '"><a href="#">View this item in My Purchases</a></font></b>';
|
||||||
buyTextContainer.color = "#FFD6AD";
|
buyTextContainer.color = "#FFD6AD";
|
||||||
buyTextContainer.border.color = "#FAC07D";
|
buyTextContainer.border.color = "#FAC07D";
|
||||||
buyGlyph.text = hifi.glyphs.alert;
|
buyGlyph.text = hifi.glyphs.alert;
|
||||||
|
@ -859,7 +869,7 @@ Rectangle {
|
||||||
buyText.text = "";
|
buyText.text = "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buyText.text = "This Marketplace item isn't an entity. It <b>will not</b> be added to your <b>Purchases</b>.";
|
buyText.text = "This free item <b>will not</b> be added to your <b>Purchases</b>. Non-entities can't yet be purchased for HFC.";
|
||||||
buyTextContainer.color = "#FFD6AD";
|
buyTextContainer.color = "#FFD6AD";
|
||||||
buyTextContainer.border.color = "#FAC07D";
|
buyTextContainer.border.color = "#FAC07D";
|
||||||
buyGlyph.text = hifi.glyphs.alert;
|
buyGlyph.text = hifi.glyphs.alert;
|
||||||
|
|
|
@ -13,3 +13,28 @@
|
||||||
|
|
||||||
WalletScriptingInterface::WalletScriptingInterface() {
|
WalletScriptingInterface::WalletScriptingInterface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const QString CHECKOUT_QML_PATH = qApp->applicationDirPath() + "../../../qml/hifi/commerce/checkout/Checkout.qml";
|
||||||
|
void WalletScriptingInterface::buy() {
|
||||||
|
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||||
|
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
|
|
||||||
|
if (!tablet->isPathLoaded(CHECKOUT_QML_PATH)) {
|
||||||
|
tablet->loadQMLSource(CHECKOUT_QML_PATH);
|
||||||
|
}
|
||||||
|
DependencyManager::get<HMDScriptingInterface>()->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
|
||||||
|
});
|
||||||
|
}
|
|
@ -15,6 +15,9 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
|
#include <ui/TabletScriptingInterface.h>
|
||||||
|
|
||||||
|
|
||||||
class WalletScriptingInterface : public QObject, public Dependency {
|
class WalletScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -27,6 +30,8 @@ public:
|
||||||
Q_INVOKABLE uint getWalletStatus() { return _walletStatus; }
|
Q_INVOKABLE uint getWalletStatus() { return _walletStatus; }
|
||||||
void setWalletStatus(const uint& status) { _walletStatus = status; }
|
void setWalletStatus(const uint& status) { _walletStatus = status; }
|
||||||
|
|
||||||
|
Q_INVOKABLE void buy();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void walletStatusChanged();
|
void walletStatusChanged();
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
var dropDownElement = document.getElementById('user-dropdown');
|
var dropDownElement = document.getElementById('user-dropdown');
|
||||||
purchasesElement.id = "purchasesButton";
|
purchasesElement.id = "purchasesButton";
|
||||||
purchasesElement.setAttribute('href', "#");
|
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
|
// 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".
|
// 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) +
|
purchasesElement.style = "height:100%;margin-top:18px;font-weight:bold;float:right;margin-right:" + (dropDownElement.offsetWidth + 30) +
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
var onCommerceScreen = false;
|
var onCommerceScreen = false;
|
||||||
|
|
||||||
var debugCheckout = false;
|
var debugCheckout = false;
|
||||||
|
var debugError = false;
|
||||||
function showMarketplace() {
|
function showMarketplace() {
|
||||||
if (!debugCheckout) {
|
if (!debugCheckout) {
|
||||||
UserActivityLogger.openedMarketplace();
|
UserActivityLogger.openedMarketplace();
|
||||||
|
@ -71,7 +72,7 @@
|
||||||
itemId: '0d90d21c-ce7a-4990-ad18-e9d2cf991027',
|
itemId: '0d90d21c-ce7a-4990-ad18-e9d2cf991027',
|
||||||
itemName: 'Test Flaregun',
|
itemName: 'Test Flaregun',
|
||||||
itemAuthor: 'hifiDave',
|
itemAuthor: 'hifiDave',
|
||||||
itemPrice: 17,
|
itemPrice: (debugError ? 10 : 17),
|
||||||
itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json',
|
itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json',
|
||||||
},
|
},
|
||||||
canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified
|
canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified
|
||||||
|
|
Loading…
Reference in a new issue