This commit is contained in:
Zach Fox 2017-08-07 16:16:17 -07:00
parent 517128a939
commit 7e922cb2c2
2 changed files with 125 additions and 89 deletions

View file

@ -73,121 +73,158 @@ Rectangle {
id: itemDescriptionContainer; id: itemDescriptionContainer;
// Size // Size
width: checkoutRoot.width; width: checkoutRoot.width;
height: 150; height: childrenRect.height + 20;
// Anchors // Anchors
anchors.left: parent.left; anchors.left: parent.left;
anchors.top: titleBarContainer.bottom; anchors.top: titleBarContainer.bottom;
// Item Name text // Item Name text
RalewaySemiBold { Item {
id: itemNameTextLabel; id: itemNameContainer;
text: "Item Name:";
// Text size
size: 16;
// Anchors // Anchors
anchors.top: parent.top; anchors.top: parent.top;
anchors.topMargin: 4; anchors.topMargin: 4;
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: 16; anchors.leftMargin: 16;
// Style anchors.right: parent.right;
color: hifi.colors.lightGrayText; anchors.rightMargin: 16;
// Alignment height: childrenRect.height;
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; RalewaySemiBold {
} id: itemNameTextLabel;
RalewayRegular { text: "Item Name:";
id: itemNameText; // Anchors
// Text size anchors.top: parent.top;
size: itemNameTextLabel.size; anchors.left: parent.left;
// Anchors width: paintedWidth;
anchors.top: itemNameTextLabel.top; // Text size
anchors.topMargin: itemNameTextLabel.anchors.topMargin; size: 16;
anchors.left: itemNameTextLabel.right; // Style
anchors.leftMargin: 16; color: hifi.colors.lightGrayText;
// Style // Alignment
color: hifi.colors.lightGrayText; horizontalAlignment: Text.AlignHLeft;
// Alignment verticalAlignment: Text.AlignVCenter;
horizontalAlignment: Text.AlignHLeft; }
verticalAlignment: Text.AlignVCenter; RalewayRegular {
id: itemNameText;
// Text size
size: itemNameTextLabel.size;
// Anchors
anchors.top: parent.top;
anchors.left: itemNameTextLabel.right;
anchors.leftMargin: 16;
width: paintedWidth;
// Style
color: hifi.colors.lightGrayText;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
} }
// Item Author text // Item Author text
RalewaySemiBold { Item {
id: itemAuthorTextLabel; id: itemAuthorContainer;
text: "Item Author:";
// Text size
size: 16;
// Anchors // Anchors
anchors.top: itemNameTextLabel.bottom; anchors.top: itemNameContainer.bottom;
anchors.topMargin: 4; anchors.topMargin: 4;
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: 16; anchors.leftMargin: 16;
// Style anchors.right: parent.right;
color: hifi.colors.lightGrayText; anchors.rightMargin: 16;
// Alignment height: childrenRect.height;
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; RalewaySemiBold {
} id: itemAuthorTextLabel;
RalewayRegular { text: "Item Author:";
id: itemAuthorText; // Anchors
// Text size anchors.top: parent.top;
size: itemAuthorTextLabel.size; anchors.left: parent.left;
// Anchors width: paintedWidth;
anchors.top: itemAuthorTextLabel.top; // Text size
anchors.topMargin: itemAuthorTextLabel.anchors.topMargin; size: 16;
anchors.left: itemAuthorTextLabel.right; // Style
anchors.leftMargin: 16; color: hifi.colors.lightGrayText;
// Style // Alignment
color: hifi.colors.lightGrayText; horizontalAlignment: Text.AlignHLeft;
// Alignment verticalAlignment: Text.AlignVCenter;
horizontalAlignment: Text.AlignHLeft; }
verticalAlignment: Text.AlignVCenter; RalewayRegular {
id: itemAuthorText;
// Text size
size: itemAuthorTextLabel.size;
// Anchors
anchors.top: parent.top;
anchors.left: itemAuthorTextLabel.right;
anchors.leftMargin: 16;
width: paintedWidth;
// Style
color: hifi.colors.lightGrayText;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
} }
// Item Price text // Item Price text
RalewaySemiBold { Item {
id: itemPriceTextLabel; id: itemPriceContainer;
text: "Item Price:";
// Text size
size: 16;
// Anchors // Anchors
anchors.top: itemAuthorTextLabel.bottom; anchors.top: itemAuthorContainer.bottom;
anchors.topMargin: 4; anchors.topMargin: 4;
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: 16; anchors.leftMargin: 16;
// Style
color: hifi.colors.lightGrayText;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
RalewayRegular {
id: itemPriceText;
// Text size
size: itemPriceTextLabel.size;
// Anchors
anchors.top: itemPriceTextLabel.top;
anchors.topMargin: itemPriceTextLabel.anchors.topMargin;
anchors.left: itemPriceTextLabel.right;
anchors.leftMargin: 16;
// Style
color: hifi.colors.lightGrayText;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
// Separator
HifiControlsUit.Separator {
anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
anchors.bottom: parent.bottom; anchors.rightMargin: 16;
height: childrenRect.height;
RalewaySemiBold {
id: itemPriceTextLabel;
text: "Item Price:";
// Anchors
anchors.top: parent.top;
anchors.left: parent.left;
width: paintedWidth;
// Text size
size: 20;
// Style
color: hifi.colors.lightGrayText;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
RalewayRegular {
id: itemPriceText;
// Text size
size: itemPriceTextLabel.size;
// Anchors
anchors.top: parent.top;
anchors.left: itemPriceTextLabel.right;
anchors.leftMargin: 16;
width: paintedWidth;
// Style
color: hifi.colors.lightGrayText;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
}
} }
} }
// //
// ITEM DESCRIPTION END // ITEM DESCRIPTION END
// //
//
// ACTION BUTTONS START
//
//
// ACTION BUTTONS END
//
// //
// FUNCTION DEFINITIONS START // FUNCTION DEFINITIONS START
// //
@ -205,13 +242,12 @@ Rectangle {
// Called when a message is received from a script. // Called when a message is received from a script.
// //
function fromScript(message) { function fromScript(message) {
console.log("ZRF:", JSON.stringify(message));
switch (message.method) { switch (message.method) {
case 'updateCheckoutQML': case 'updateCheckoutQML':
console.log("ZRF:", JSON.stringify(message)); console.log("ZRF:", JSON.stringify(message));
itemNameText.text = message.itemName; itemNameText.text = message.params.itemName;
itemAuthorText.text = message.itemAuthor; itemAuthorText.text = message.params.itemAuthor;
itemAuthorText.text = message.itemPrice; itemPriceText.text = message.params.itemPrice;
break; break;
default: default:
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message)); console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));

View file

@ -63,7 +63,7 @@
if (parsedJsonMessage.type === "CHECKOUT") { if (parsedJsonMessage.type === "CHECKOUT") {
console.log("ZRF: Buy Button Clicked: " + JSON.stringify(parsedJsonMessage)); console.log("ZRF: Buy Button Clicked: " + JSON.stringify(parsedJsonMessage));
tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH); tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH);
tablet.sendToQml({ method: 'updateCheckoutQML', params: message }); tablet.sendToQml({ method: 'updateCheckoutQML', params: parsedJsonMessage });
} }
if (message === GOTO_DIRECTORY) { if (message === GOTO_DIRECTORY) {