Merge pull request #11267 from zfox23/commerce_zachsPunchlist1

Commerce: Zachs Punchlist 01
This commit is contained in:
Zach Fox 2017-08-30 10:10:56 -07:00 committed by GitHub
commit 1b48319a3f
17 changed files with 327 additions and 159 deletions

View file

@ -147,6 +147,16 @@ Rectangle {
cache: false;
source: "image://security/securityImage";
}
Image {
id: securityImageOverlay;
source: "../wallet/images/lockOverlay.png";
width: securityImage.width * 0.45;
height: securityImage.height * 0.45;
anchors.bottom: securityImage.bottom;
anchors.right: securityImage.right;
mipmap: true;
opacity: 0.9;
}
// Separator
HifiControlsUit.Separator {
@ -877,7 +887,7 @@ Rectangle {
if (root.purchasesReceived && root.balanceReceived) {
if (root.balanceAfterPurchase < 0) {
if (root.alreadyOwned) {
buyText.text = "You do not have enough HFC to purchase this item again. Go to your Purchases to view the copy you own.";
buyText.text = "You do not have enough HFC to purchase this item again. Go to your <b>Purchases</b> to view the copy you own.";
} else {
buyText.text = "You do not have enough HFC to purchase this item.";
}

View file

@ -29,6 +29,7 @@ Rectangle {
property string referrerURL: "";
property bool securityImageResultReceived: false;
property bool keyFilePathIfExistsResultReceived: false;
property bool inventoryReceived: false;
property bool punctuationMode: false;
// Style
color: hifi.colors.baseGray;
@ -58,6 +59,7 @@ Rectangle {
}
onInventoryResult: {
inventoryReceived = true;
if (result.status !== 'success') {
console.log("Failed to get purchases", result.message);
} else {
@ -116,6 +118,16 @@ Rectangle {
cache: false;
source: "image://security/securityImage";
}
Image {
id: securityImageOverlay;
source: "../wallet/images/lockOverlay.png";
width: securityImage.width * 0.45;
height: securityImage.height * 0.45;
anchors.bottom: securityImage.bottom;
anchors.right: securityImage.right;
mipmap: true;
opacity: 0.9;
}
// Separator
HifiControlsUit.Separator {
@ -258,7 +270,9 @@ Rectangle {
height: 40;
// Anchors
anchors.left: parent.left;
anchors.leftMargin: 8;
anchors.right: parent.right;
anchors.rightMargin: 8;
anchors.top: parent.top;
anchors.topMargin: 4;
@ -304,6 +318,7 @@ Rectangle {
ListView {
id: purchasesContentsList;
visible: purchasesModel.count !== 0;
clip: true;
model: filteredPurchasesModel;
// Anchors
@ -329,6 +344,52 @@ Rectangle {
}
}
}
Item {
id: noPurchasesAlertContainer;
visible: !purchasesContentsList.visible && root.inventoryReceived;
anchors.top: filterBarContainer.bottom;
anchors.topMargin: 12;
anchors.left: parent.left;
anchors.bottom: parent.bottom;
width: parent.width;
// Explanitory text
RalewayRegular {
id: haventPurchasedYet;
text: "<b>You haven't purchased anything yet!</b><br><br>Get an item from <b>Marketplace</b> to add it to your <b>Purchases</b>.";
// Text size
size: 22;
// Anchors
anchors.top: parent.top;
anchors.topMargin: 150;
anchors.left: parent.left;
anchors.leftMargin: 24;
anchors.right: parent.right;
anchors.rightMargin: 24;
height: paintedHeight;
// Style
color: hifi.colors.faintGray;
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignHCenter;
}
// "Set Up" button
HifiControlsUit.Button {
color: hifi.buttons.blue;
colorScheme: hifi.colorSchemes.dark;
anchors.top: haventPurchasedYet.bottom;
anchors.topMargin: 20;
anchors.horizontalCenter: parent.horizontalCenter;
width: parent.width * 2 / 3;
height: 50;
text: "Visit Marketplace";
onClicked: {
sendToScript({method: 'purchases_goToMarketplaceClicked'});
}
}
}
}
//
// PURCHASES CONTENTS END

View file

@ -80,7 +80,7 @@ Item {
// "Set Up" button
HifiControlsUit.Button {
color: hifi.buttons.black;
color: hifi.buttons.blue;
colorScheme: hifi.colorSchemes.dark;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 150;

View file

@ -48,6 +48,9 @@ Item {
onVisibleChanged: {
if (visible) {
passphraseField.focus = true;
sendMessageToLightbox({method: 'disableHmdPreview'});
} else {
sendMessageToLightbox({method: 'maybeEnableHmdPreview'});
}
}
@ -71,6 +74,26 @@ Item {
text = "";
}
}
onFocusChanged: {
if (focus) {
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
} else if (!passphraseFieldAgain.focus) {
sendMessageToLightbox({method: 'walletSetup_lowerKeyboard'});
}
}
MouseArea {
anchors.fill: parent;
onClicked: {
parent.focus = true;
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
}
}
onAccepted: {
passphraseFieldAgain.focus = true;
}
}
HifiControlsUit.TextField {
id: passphraseFieldAgain;
@ -87,6 +110,26 @@ Item {
text = "";
}
}
onFocusChanged: {
if (focus) {
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
} else if (!passphraseField.focus) {
sendMessageToLightbox({method: 'walletSetup_lowerKeyboard'});
}
}
MouseArea {
anchors.fill: parent;
onClicked: {
parent.focus = true;
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
}
}
onAccepted: {
focus = false;
}
}
// Security Image
@ -111,9 +154,19 @@ Item {
commerce.getSecurityImage();
}
}
// "Security picture" text below pic
Image {
id: topSecurityImageOverlay;
source: "images/lockOverlay.png";
width: passphrasePageSecurityImage.width * 0.45;
height: passphrasePageSecurityImage.height * 0.45;
anchors.bottom: passphrasePageSecurityImage.bottom;
anchors.right: passphrasePageSecurityImage.right;
mipmap: true;
opacity: 0.9;
}
// "Security image" text below pic
RalewayRegular {
text: "security picture";
text: "security image";
// Text size
size: 12;
// Anchors

View file

@ -33,23 +33,6 @@ Rectangle {
}
}
Connections {
target: passphraseSelection;
onSendMessageToLightbox: {
if (msg.method === 'statusResult') {
if (msg.status) {
// Success submitting new passphrase
root.resetSubmitButton();
root.visible = false;
} else {
// Error submitting new passphrase
root.resetSubmitButton();
passphraseSelection.setErrorText("Backend error");
}
}
}
}
//
// SECURE PASSPHRASE SELECTION START
//
@ -113,6 +96,24 @@ Rectangle {
anchors.left: parent.left;
anchors.right: parent.right;
anchors.bottom: passphraseNavBar.top;
Connections {
onSendMessageToLightbox: {
if (msg.method === 'statusResult') {
if (msg.status) {
// Success submitting new passphrase
root.resetSubmitButton();
root.visible = false;
} else {
// Error submitting new passphrase
root.resetSubmitButton();
passphraseSelection.setErrorText("Backend error");
}
} else {
sendSignalToWallet(msg);
}
}
}
}
// Navigation Bar
@ -168,6 +169,8 @@ Rectangle {
// SECURE PASSPHRASE SELECTION END
//
signal sendSignalToWallet(var msg);
function resetSubmitButton() {
passphraseSubmitButton.enabled = true;
passphraseSubmitButton.text = "Submit";

View file

@ -13,6 +13,7 @@
import Hifi 1.0 as Hifi
import QtQuick 2.5
import QtGraphicalEffects 1.0
import QtQuick.Controls 1.4
import "../../../styles-uit"
import "../../../controls-uit" as HifiControlsUit
@ -35,8 +36,6 @@ Item {
topSecurityImage.source = path;
changeSecurityImageImage.source = "";
changeSecurityImageImage.source = path;
changePassphraseImage.source = "";
changePassphraseImage.source = path;
}
}
@ -92,9 +91,19 @@ Item {
source: "image://security/securityImage";
cache: false;
}
// "Security picture" text below pic
Image {
id: topSecurityImageMask;
source: "images/lockOverlay.png";
width: topSecurityImage.width * 0.45;
height: topSecurityImage.height * 0.45;
anchors.bottom: topSecurityImage.bottom;
anchors.right: topSecurityImage.right;
mipmap: true;
opacity: 0.9;
}
// "Security image" text below pic
RalewayRegular {
text: "security picture";
text: "security image";
// Text size
size: 12;
// Anchors
@ -148,10 +157,16 @@ Item {
anchors.left: parent.left;
height: parent.height;
width: height;
source: "image://security/securityImage";
source: "images/lockOverlay.png";
fillMode: Image.PreserveAspectFit;
mipmap: true;
cache: false;
visible: false;
}
ColorOverlay {
anchors.fill: changePassphraseImage;
source: changePassphraseImage;
color: "white"
}
// "Change Passphrase" button
HifiControlsUit.Button {

View file

@ -27,13 +27,14 @@ Item {
Hifi.QmlCommerce {
id: commerce;
onSecurityImageResult: {
}
}
onVisibleChanged: {
if (visible) {
commerce.getSecurityImage();
sendSignalToWallet({method: 'disableHmdPreview'});
} else {
sendSignalToWallet({method: 'maybeEnableHmdPreview'});
}
}
@ -83,7 +84,7 @@ Item {
//
// FUNCTION DEFINITIONS START
//
signal sendToScript(var message);
signal sendSignalToWallet(var msg);
function getImagePathFromImageID(imageID) {
return (imageID ? gridModel.getImagePathFromImageID(imageID) : "");

View file

@ -116,6 +116,12 @@ Rectangle {
anchors.right: parent.right;
anchors.rightMargin: 16;
height: 280;
Connections {
onSendSignalToWallet: {
sendSignalToWallet(msg);
}
}
}
// Text below security images
@ -193,6 +199,8 @@ Rectangle {
// SECURITY IMAGE SELECTION END
//
signal sendSignalToWallet(var msg);
function resetSubmitButton() {
securityImageSubmitButton.enabled = true;
securityImageSubmitButton.text = "Submit";

View file

@ -28,6 +28,7 @@ Rectangle {
property string activeView: "initialize";
property bool securityImageResultReceived: false;
property bool keyFilePathIfExistsResultReceived: false;
property bool keyboardRaised: false;
// Style
color: hifi.colors.baseGray;
@ -57,27 +58,6 @@ Rectangle {
id: securityImageModel;
}
Connections {
target: walletSetupLightbox;
onSendSignalToWallet: {
if (msg.method === 'walletSetup_cancelClicked') {
walletSetupLightbox.visible = false;
} else if (msg.method === 'walletSetup_finished') {
root.activeView = "walletHome";
} else {
sendToScript(msg);
}
}
}
Connections {
target: notSetUp;
onSendSignalToWallet: {
if (msg.method === 'setUpClicked') {
walletSetupLightbox.visible = true;
}
}
}
Rectangle {
id: walletSetupLightboxContainer;
visible: walletSetupLightbox.visible || passphraseSelectionLightbox.visible || securityImageSelectionLightbox.visible;
@ -89,26 +69,60 @@ Rectangle {
WalletSetupLightbox {
id: walletSetupLightbox;
visible: false;
z: 999;
z: 998;
anchors.centerIn: walletSetupLightboxContainer;
width: walletSetupLightboxContainer.width - 50;
height: walletSetupLightboxContainer.height - 50;
Connections {
onSendSignalToWallet: {
if (msg.method === 'walletSetup_cancelClicked') {
walletSetupLightbox.visible = false;
} else if (msg.method === 'walletSetup_finished') {
root.activeView = "walletHome";
} else if (msg.method === 'walletSetup_raiseKeyboard') {
root.keyboardRaised = true;
} else if (msg.method === 'walletSetup_lowerKeyboard') {
root.keyboardRaised = false;
} else {
sendToScript(msg);
}
}
}
}
PassphraseSelectionLightbox {
id: passphraseSelectionLightbox;
visible: false;
z: 999;
z: 998;
anchors.centerIn: walletSetupLightboxContainer;
width: walletSetupLightboxContainer.width - 50;
height: walletSetupLightboxContainer.height - 50;
Connections {
onSendSignalToWallet: {
if (msg.method === 'walletSetup_raiseKeyboard') {
root.keyboardRaised = true;
} else if (msg.method === 'walletSetup_lowerKeyboard') {
root.keyboardRaised = false;
} else {
sendToScript(msg);
}
}
}
}
SecurityImageSelectionLightbox {
id: securityImageSelectionLightbox;
visible: false;
z: 999;
z: 998;
anchors.centerIn: walletSetupLightboxContainer;
width: walletSetupLightboxContainer.width - 50;
height: walletSetupLightboxContainer.height - 50;
Connections {
onSendSignalToWallet: {
sendToScript(msg);
}
}
}
@ -180,6 +194,14 @@ Rectangle {
anchors.bottom: tabButtonsContainer.top;
anchors.left: parent.left;
anchors.right: parent.right;
Connections {
onSendSignalToWallet: {
if (msg.method === 'setUpClicked') {
walletSetupLightbox.visible = true;
}
}
}
}
WalletHome {
@ -219,14 +241,14 @@ Rectangle {
anchors.leftMargin: 16;
anchors.right: parent.right;
anchors.rightMargin: 16;
}
Connections {
target: security;
onSendSignalToWallet: {
if (msg.method === 'walletSecurity_changePassphrase') {
passphraseSelectionLightbox.visible = true;
} else if (msg.method === 'walletSecurity_changeSecurityImage') {
securityImageSelectionLightbox.visible = true;
Connections {
onSendSignalToWallet: {
if (msg.method === 'walletSecurity_changePassphrase') {
passphraseSelectionLightbox.visible = true;
} else if (msg.method === 'walletSecurity_changeSecurityImage') {
securityImageSelectionLightbox.visible = true;
}
}
}
}
@ -455,7 +477,47 @@ Rectangle {
}
//
// TAB BUTTONS END
//
//
Item {
id: keyboardContainer;
z: 999;
visible: keyboard.raised;
anchors {
bottom: parent.bottom;
left: parent.left;
right: parent.right;
}
Image {
id: lowerKeyboardButton;
source: "images/lowerKeyboard.png";
anchors.horizontalCenter: parent.horizontalCenter;
anchors.bottom: keyboard.top;
height: 30;
width: 120;
MouseArea {
anchors.fill: parent;
onClicked: {
root.keyboardRaised = false;
}
}
}
HifiControlsUit.Keyboard {
id: keyboard;
property bool punctuationMode: false;
raised: HMD.mounted && root.keyboardRaised;
numeric: keyboard.punctuationMode;
anchors {
bottom: parent.bottom;
left: parent.left;
right: parent.right;
}
}
}
//
// FUNCTION DEFINITIONS START

View file

@ -182,9 +182,19 @@ Item {
cache: false;
source: "image://security/securityImage";
}
// "Security picture" text below pic
Image {
id: securityImageOverlay;
source: "images/lockOverlay.png";
width: securityImage.width * 0.45;
height: securityImage.height * 0.45;
anchors.bottom: securityImage.bottom;
anchors.right: securityImage.right;
mipmap: true;
opacity: 0.9;
}
// "Security image" text below pic
RalewayRegular {
text: "security picture";
text: "security image";
// Text size
size: 12;
// Anchors
@ -208,8 +218,7 @@ Item {
anchors.topMargin: 8;
anchors.left: parent.left;
anchors.right: parent.right;
anchors.bottom: homeMessage.visible ? homeMessage.top : root.bottom;
anchors.bottomMargin: 10;
anchors.bottom: parent.bottom;
RalewayRegular {
id: recentActivityText;
@ -229,8 +238,7 @@ Item {
id: transactionHistory;
anchors.top: recentActivityText.bottom;
anchors.topMargin: 4;
anchors.bottom: toggleFullHistoryButton.top;
anchors.bottomMargin: 8;
anchors.bottom: parent.bottom;
anchors.left: parent.left;
anchors.right: parent.right;
@ -245,92 +253,6 @@ Item {
verticalAlignment: Text.AlignTop;
}
}
HifiControlsUit.Button {
id: toggleFullHistoryButton;
color: hifi.buttons.black;
colorScheme: hifi.colorSchemes.dark;
anchors.bottom: parent.bottom;
anchors.right: parent.right;
width: 250;
height: 40;
text: homeMessage.visible ? "See Full Transaction History" : "Collapse Transaction History";
onClicked: {
if (homeMessage.visible) {
homeMessage.visible = false;
} else {
homeMessage.visible = true;
}
}
}
}
// Item for "messages" - like "Welcome"
Item {
id: homeMessage;
anchors.bottom: parent.bottom;
anchors.left: parent.left;
anchors.leftMargin: 20;
anchors.right: parent.right;
anchors.rightMargin: 20;
height: childrenRect.height;
RalewayRegular {
id: messageText;
text: "<b>Welcome! Let's get you some spending money.</b><br><br>" +
"Now that your account is all set up, click the button below to request your starter money. " +
"A robot will promptly review your request and put money into your account.";
// Text size
size: 16;
// Anchors
anchors.top: parent.top;
anchors.left: parent.left;
anchors.right: parent.right;
height: 130;
// Style
color: hifi.colors.faintGray;
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
Item {
id: homeMessageButtons;
anchors.top: messageText.bottom;
anchors.topMargin: 4;
anchors.left: parent.left;
anchors.right: parent.right;
height: 40;
HifiControlsUit.Button {
id: noThanksButton;
color: hifi.buttons.black;
colorScheme: hifi.colorSchemes.dark;
anchors.top: parent.top;
anchors.bottom: parent.bottom;
anchors.left: parent.left;
width: 100;
text: "No Thanks"
onClicked: {
messageText.text = "Okay...weird. Who doesn't like free money? If you change your mind, too bad. Sorry."
homeMessageButtons.visible = false;
}
}
HifiControlsUit.Button {
id: freeMoneyButton;
color: hifi.buttons.black;
colorScheme: hifi.colorSchemes.dark;
anchors.top: parent.top;
anchors.bottom: parent.bottom;
anchors.right: parent.right;
width: 210;
text: "Free Money Please"
onClicked: {
messageText.text = "Go, MoneyRobots, Go!"
homeMessageButtons.visible = false;
}
}
}
}
//

View file

@ -262,6 +262,12 @@ Rectangle {
anchors.right: parent.right;
anchors.rightMargin: 16;
height: 280;
Connections {
onSendSignalToWallet: {
sendSignalToWallet(msg);
}
}
}
// Text below security images
@ -407,6 +413,15 @@ Rectangle {
anchors.left: parent.left;
anchors.right: parent.right;
anchors.bottom: passphraseNavBar.top;
Connections {
onSendMessageToLightbox: {
if (msg.method === 'statusResult') {
} else {
sendSignalToWallet(msg);
}
}
}
}
// Navigation Bar

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

View file

@ -13,6 +13,7 @@
#include "Application.h"
#include <EntityTreeRenderer.h>
#include <NetworkingConstants.h>
static const float CONTEXT_OVERLAY_TABLET_OFFSET = 30.0f; // Degrees
static const float CONTEXT_OVERLAY_TABLET_ORIENTATION = 210.0f; // Degrees
@ -242,7 +243,7 @@ void ContextOverlayInterface::contextOverlays_hoverLeaveEntity(const EntityItemI
}
}
static const QString MARKETPLACE_BASE_URL = "https://metaverse.highfidelity.com/marketplace/items/";
static const QString MARKETPLACE_BASE_URL = NetworkingConstants::METAVERSE_SERVER_URL.toString() + "/marketplace/items/";
void ContextOverlayInterface::openMarketplace() {
// lets open the tablet and go to the current item in

View file

@ -53,6 +53,7 @@
// Description:
// -Called when a message is received from SpectatorCamera.qml. The "message" argument is what is sent from the QML
// in the format "{method, params}", like json-rpc. See also sendToQml().
var isHmdPreviewDisabled = true;
function fromQml(message) {
switch (message.method) {
case 'walletSetup_cancelClicked':
@ -61,6 +62,13 @@
case 'walletSetup_loginClicked':
openLoginWindow();
break;
case 'disableHmdPreview':
isHmdPreviewDisabled = Menu.isOptionChecked("Disable Preview");
Menu.setIsOptionChecked("Disable Preview", true);
break;
case 'maybeEnableHmdPreview':
Menu.setIsOptionChecked("Disable Preview", isHmdPreviewDisabled);
break;
default:
print('Unrecognized message from QML:', JSON.stringify(message));
}

View file

@ -127,9 +127,15 @@
$(this).attr('data-href', $(this).attr('href'));
$(this).attr('href', '#');
cost = $(this).closest('.col-xs-3').find('.item-cost').text();
$(this).closest('.col-xs-3').prev().attr("class", 'col-xs-6');
$(this).closest('.col-xs-3').attr("class", 'col-xs-6');
if (parseInt(cost) > 0) {
$(this).find('.price').text("BUY");
var priceElement = $(this).find('.price')
priceElement.css({ "width": "auto", "padding": "3px 5px", "height": "26px" });
priceElement.text(parseFloat(cost / 100).toFixed(2) + ' HFC');
priceElement.css({ "min-width": priceElement.width() + 10 });
}
});
@ -160,7 +166,7 @@
// Try this here in case it works (it will if the user just pressed the "back" button,
// since that doesn't trigger another AJAX request.
injectBuyButtonOnMainPage;
injectBuyButtonOnMainPage();
addPurchasesButton();
}
}
@ -172,8 +178,8 @@
var cost = $('.item-cost').text();
if (parseInt(cost) > 0) {
$('#side-info').find('.btn').html('<span class="glyphicon glyphicon-download"></span>Buy Item ');
if (parseInt(cost) > 0 && $('#side-info').find('#buyItemButton').size() === 0) {
$('#side-info').find('.btn').html('<span class="glyphicon glyphicon-download" id="buyItemButton"></span>Own Item: ' + (parseFloat(cost / 100).toFixed(2)) + ' HFC');
}
$('#side-info').find('.btn').on('click', function () {

View file

@ -228,6 +228,9 @@
case 'purchases_backClicked':
tablet.gotoWebScreen(message.referrerURL, MARKETPLACES_INJECT_SCRIPT_URL);
break;
case 'purchases_goToMarketplaceClicked':
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
break;
default:
print('Unrecognized message from Checkout.qml or Purchases.qml: ' + JSON.stringify(message));
}