mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:24:24 +02:00
Merge pull request #12358 from highfidelity/revert-12316-commerce_inspectionCertRedesign
Revert "Commerce: Inspection Certificate Redesign"
This commit is contained in:
commit
7c492ef1cd
6 changed files with 188 additions and 362 deletions
|
@ -19,30 +19,21 @@ import "../../../controls-uit" as HifiControlsUit
|
||||||
import "../../../controls" as HifiControls
|
import "../../../controls" as HifiControls
|
||||||
import "../wallet" as HifiWallet
|
import "../wallet" as HifiWallet
|
||||||
|
|
||||||
|
// references XXX from root context
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
HifiConstants { id: hifi; }
|
HifiConstants { id: hifi; }
|
||||||
|
|
||||||
id: root;
|
id: root;
|
||||||
property string marketplaceUrl: "";
|
property string marketplaceUrl;
|
||||||
property string certificateId: "";
|
property string certificateId;
|
||||||
property string itemName: "--";
|
property string itemName: "--";
|
||||||
property string itemOwner: "--";
|
property string itemOwner: "--";
|
||||||
property string itemEdition: "--";
|
property string itemEdition: "--";
|
||||||
property string dateOfPurchase: "--";
|
property string dateOfPurchase: "--";
|
||||||
property string itemCost: "--";
|
|
||||||
property string certTitleTextColor: hifi.colors.darkGray;
|
|
||||||
property string certTextColor: hifi.colors.white;
|
|
||||||
property string infoTextColor: hifi.colors.blueAccent;
|
|
||||||
// 0 means replace none
|
|
||||||
// 4 means replace all but "Item Edition"
|
|
||||||
// 5 means replace all 5 replaceable fields
|
|
||||||
property int certInfoReplaceMode: 5;
|
|
||||||
property bool isLightbox: false;
|
property bool isLightbox: false;
|
||||||
property bool isMyCert: false;
|
property bool isMyCert: false;
|
||||||
property bool useGoldCert: true;
|
property bool isCertificateInvalid: false;
|
||||||
property bool certificateInfoPending: true;
|
|
||||||
property int certificateStatus: 0;
|
|
||||||
property bool certificateStatusPending: true;
|
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.faintGray;
|
color: hifi.colors.faintGray;
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -54,130 +45,71 @@ Rectangle {
|
||||||
} else {
|
} else {
|
||||||
root.marketplaceUrl = result.data.marketplace_item_url;
|
root.marketplaceUrl = result.data.marketplace_item_url;
|
||||||
root.isMyCert = result.isMyCert ? result.isMyCert : false;
|
root.isMyCert = result.isMyCert ? result.isMyCert : false;
|
||||||
|
root.itemOwner = root.isCertificateInvalid ? "--" : (root.isMyCert ? Account.username :
|
||||||
if (root.certInfoReplaceMode > 3) {
|
"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022");
|
||||||
root.itemName = result.data.marketplace_item_name;
|
root.itemEdition = root.isCertificateInvalid ? "Uncertified Copy" :
|
||||||
// "\u2022" is the Unicode character 'BULLET' - it's what's used in password fields on the web, etc
|
(result.data.edition_number + "/" + (result.data.limited_run === -1 ? "\u221e" : result.data.limited_run));
|
||||||
root.itemOwner = root.isMyCert ? Account.username :
|
root.dateOfPurchase = root.isCertificateInvalid ? "" : getFormattedDate(result.data.transfer_created_at * 1000);
|
||||||
"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
root.itemName = result.data.marketplace_item_name;
|
||||||
root.dateOfPurchase = root.isMyCert ? getFormattedDate(result.data.transfer_created_at * 1000) : "Undisclosed";
|
|
||||||
root.itemCost = (root.isMyCert && result.data.cost !== undefined) ? result.data.cost : "Undisclosed";
|
|
||||||
}
|
|
||||||
if (root.certInfoReplaceMode > 4) {
|
|
||||||
root.itemEdition = result.data.edition_number + "/" + (result.data.limited_run === -1 ? "\u221e" : result.data.limited_run);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root.certificateStatus === 4) { // CERTIFICATE_STATUS_OWNER_VERIFICATION_FAILED
|
|
||||||
if (root.isMyCert) {
|
|
||||||
errorText.text = "This item is an uncertified copy of an item you purchased.";
|
|
||||||
} else {
|
|
||||||
errorText.text = "The person who placed this item doesn't own it.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.data.invalid_reason || result.data.transfer_status[0] === "failed") {
|
if (result.data.invalid_reason || result.data.transfer_status[0] === "failed") {
|
||||||
root.useGoldCert = false;
|
titleBarText.text = "Invalid Certificate";
|
||||||
root.certTitleTextColor = hifi.colors.redHighlight;
|
titleBarText.color = hifi.colors.redHighlight;
|
||||||
root.certTextColor = hifi.colors.redHighlight;
|
|
||||||
root.infoTextColor = hifi.colors.redHighlight;
|
|
||||||
titleBarText.text = "Certificate\nNo Longer Valid";
|
|
||||||
popText.text = "";
|
popText.text = "";
|
||||||
showInMarketplaceButton.visible = false;
|
|
||||||
// "Edition" text previously set above in this function
|
|
||||||
// "Owner" text previously set above in this function
|
|
||||||
// "Purchase Date" text previously set above in this function
|
|
||||||
// "Purchase Price" text previously set above in this function
|
|
||||||
if (result.data.invalid_reason) {
|
if (result.data.invalid_reason) {
|
||||||
errorText.text = result.data.invalid_reason;
|
errorText.text = result.data.invalid_reason;
|
||||||
}
|
}
|
||||||
} else if (result.data.transfer_status[0] === "pending") {
|
} else if (result.data.transfer_status[0] === "pending") {
|
||||||
root.useGoldCert = false;
|
|
||||||
root.certTitleTextColor = hifi.colors.redHighlight;
|
|
||||||
root.certTextColor = hifi.colors.redHighlight;
|
|
||||||
root.infoTextColor = hifi.colors.redHighlight;
|
|
||||||
titleBarText.text = "Certificate Pending";
|
titleBarText.text = "Certificate Pending";
|
||||||
popText.text = "";
|
|
||||||
showInMarketplaceButton.visible = true;
|
|
||||||
// "Edition" text previously set above in this function
|
|
||||||
// "Owner" text previously set above in this function
|
|
||||||
// "Purchase Date" text previously set above in this function
|
|
||||||
// "Purchase Price" text previously set above in this function
|
|
||||||
errorText.text = "The status of this item is still pending confirmation. If the purchase is not confirmed, " +
|
errorText.text = "The status of this item is still pending confirmation. If the purchase is not confirmed, " +
|
||||||
"this entity will be cleaned up by the domain.";
|
"this entity will be cleaned up by the domain.";
|
||||||
|
errorText.color = hifi.colors.baseGray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.certificateInfoPending = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateCertificateStatus: {
|
onUpdateCertificateStatus: {
|
||||||
root.certificateStatus = certStatus;
|
if (certStatus === 1) { // CERTIFICATE_STATUS_VERIFICATION_SUCCESS
|
||||||
if (root.certificateStatus === 1) { // CERTIFICATE_STATUS_VERIFICATION_SUCCESS
|
// NOP
|
||||||
root.useGoldCert = true;
|
} else if (certStatus === 2) { // CERTIFICATE_STATUS_VERIFICATION_TIMEOUT
|
||||||
root.certTitleTextColor = hifi.colors.darkGray;
|
root.isCertificateInvalid = true;
|
||||||
root.certTextColor = hifi.colors.white;
|
errorText.text = "Verification of this certificate timed out.";
|
||||||
root.infoTextColor = hifi.colors.blueAccent;
|
errorText.color = hifi.colors.redHighlight;
|
||||||
titleBarText.text = "Certificate";
|
} else if (certStatus === 3) { // CERTIFICATE_STATUS_STATIC_VERIFICATION_FAILED
|
||||||
popText.text = "PROOF OF PROVENANCE";
|
root.isCertificateInvalid = true;
|
||||||
showInMarketplaceButton.visible = true;
|
|
||||||
root.certInfoReplaceMode = 5;
|
|
||||||
// "Item Name" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Edition" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Owner" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Purchase Date" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Purchase Price" text will be set in "onCertificateInfoResult()"
|
|
||||||
errorText.text = "";
|
|
||||||
} else if (root.certificateStatus === 2) { // CERTIFICATE_STATUS_VERIFICATION_TIMEOUT
|
|
||||||
root.useGoldCert = false;
|
|
||||||
root.certTitleTextColor = hifi.colors.redHighlight;
|
|
||||||
root.certTextColor = hifi.colors.redHighlight;
|
|
||||||
root.infoTextColor = hifi.colors.redHighlight;
|
|
||||||
titleBarText.text = "Request Timed Out";
|
|
||||||
popText.text = "";
|
|
||||||
showInMarketplaceButton.visible = false;
|
|
||||||
root.certInfoReplaceMode = 0;
|
|
||||||
root.itemName = "";
|
|
||||||
root.itemEdition = "";
|
|
||||||
root.itemOwner = "";
|
|
||||||
root.dateOfPurchase = "";
|
|
||||||
root.itemCost = "";
|
|
||||||
errorText.text = "Your request to inspect this item timed out. Please try again later.";
|
|
||||||
} else if (root.certificateStatus === 3) { // CERTIFICATE_STATUS_STATIC_VERIFICATION_FAILED
|
|
||||||
root.useGoldCert = false;
|
|
||||||
root.certTitleTextColor = hifi.colors.redHighlight;
|
|
||||||
root.certTextColor = hifi.colors.redHighlight;
|
|
||||||
root.infoTextColor = hifi.colors.redHighlight;
|
|
||||||
titleBarText.text = "Certificate\nNo Longer Valid";
|
|
||||||
popText.text = "";
|
|
||||||
showInMarketplaceButton.visible = true;
|
|
||||||
root.certInfoReplaceMode = 5;
|
|
||||||
// "Item Name" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Edition" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Owner" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Purchase Date" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Purchase Price" text will be set in "onCertificateInfoResult()"
|
|
||||||
errorText.text = "The information associated with this item has been modified and it no longer matches the original certified item.";
|
|
||||||
} else if (root.certificateStatus === 4) { // CERTIFICATE_STATUS_OWNER_VERIFICATION_FAILED
|
|
||||||
root.useGoldCert = false;
|
|
||||||
root.certTitleTextColor = hifi.colors.redHighlight;
|
|
||||||
root.certTextColor = hifi.colors.redHighlight;
|
|
||||||
root.infoTextColor = hifi.colors.redHighlight;
|
|
||||||
titleBarText.text = "Invalid Certificate";
|
titleBarText.text = "Invalid Certificate";
|
||||||
|
titleBarText.color = hifi.colors.redHighlight;
|
||||||
|
|
||||||
popText.text = "";
|
popText.text = "";
|
||||||
showInMarketplaceButton.visible = true;
|
root.itemOwner = "";
|
||||||
root.certInfoReplaceMode = 4;
|
dateOfPurchaseHeader.text = "";
|
||||||
// "Item Name" text will be set in "onCertificateInfoResult()"
|
root.dateOfPurchase = "";
|
||||||
root.itemEdition = "Uncertified Copy"
|
root.itemEdition = "Uncertified Copy";
|
||||||
// "Owner" text will be set in "onCertificateInfoResult()"
|
|
||||||
// "Purchase Date" text will be set in "onCertificateInfoResult()"
|
errorText.text = "The information associated with this item has been modified and it no longer matches the original certified item.";
|
||||||
// "Purchase Price" text will be set in "onCertificateInfoResult()"
|
errorText.color = hifi.colors.baseGray;
|
||||||
// "Error Text" text will be set in "onCertificateInfoResult()"
|
} else if (certStatus === 4) { // CERTIFICATE_STATUS_OWNER_VERIFICATION_FAILED
|
||||||
|
root.isCertificateInvalid = true;
|
||||||
|
titleBarText.text = "Invalid Certificate";
|
||||||
|
titleBarText.color = hifi.colors.redHighlight;
|
||||||
|
|
||||||
|
popText.text = "";
|
||||||
|
root.itemOwner = "";
|
||||||
|
dateOfPurchaseHeader.text = "";
|
||||||
|
root.dateOfPurchase = "";
|
||||||
|
root.itemEdition = "Uncertified Copy";
|
||||||
|
|
||||||
|
errorText.text = "The avatar who rezzed this item doesn't own it.";
|
||||||
|
errorText.color = hifi.colors.baseGray;
|
||||||
} else {
|
} else {
|
||||||
console.log("Unknown certificate status received from ledger signal!");
|
console.log("Unknown certificate status received from ledger signal!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
root.certificateStatusPending = false;
|
}
|
||||||
// We've gotten cert status - we are GO on getting the cert info
|
|
||||||
Commerce.certificateInfo(root.certificateId);
|
onCertificateIdChanged: {
|
||||||
|
if (certificateId !== "") {
|
||||||
|
Commerce.certificateInfo(certificateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,35 +122,9 @@ Rectangle {
|
||||||
hoverEnabled: true;
|
hoverEnabled: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: loadingOverlay;
|
|
||||||
z: 998;
|
|
||||||
|
|
||||||
visible: root.certificateInfoPending || root.certificateStatusPending;
|
|
||||||
anchors.fill: parent;
|
|
||||||
color: Qt.rgba(0.0, 0.0, 0.0, 0.7);
|
|
||||||
|
|
||||||
// This object is always used in a popup or full-screen Wallet section.
|
|
||||||
// This MouseArea is used to prevent a user from being
|
|
||||||
// able to click on a button/mouseArea underneath the popup/section.
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent;
|
|
||||||
propagateComposedEvents: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedImage {
|
|
||||||
source: "../common/images/loader.gif"
|
|
||||||
width: 96;
|
|
||||||
height: width;
|
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: backgroundImage;
|
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
source: root.useGoldCert ? "images/cert-bg-gold-split.png" : "images/nocert-bg-split.png";
|
source: "images/cert-bg.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title text
|
// Title text
|
||||||
|
@ -231,17 +137,16 @@ Rectangle {
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 40;
|
anchors.topMargin: 40;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 36;
|
anchors.leftMargin: 45;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 8;
|
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: root.certTitleTextColor;
|
color: hifi.colors.darkGray;
|
||||||
wrapMode: Text.WordWrap;
|
|
||||||
}
|
}
|
||||||
// Title text
|
// Title text
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: popText;
|
id: popText;
|
||||||
|
text: "Proof of Provenance";
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
// Anchors
|
// Anchors
|
||||||
|
@ -249,38 +154,9 @@ Rectangle {
|
||||||
anchors.topMargin: 4;
|
anchors.topMargin: 4;
|
||||||
anchors.left: titleBarText.left;
|
anchors.left: titleBarText.left;
|
||||||
anchors.right: titleBarText.right;
|
anchors.right: titleBarText.right;
|
||||||
height: text === "" ? 0 : paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: root.certTitleTextColor;
|
color: hifi.colors.darkGray;
|
||||||
}
|
|
||||||
|
|
||||||
// "Close" button
|
|
||||||
HiFiGlyphs {
|
|
||||||
id: closeGlyphButton;
|
|
||||||
text: hifi.glyphs.close;
|
|
||||||
color: hifi.colors.white;
|
|
||||||
size: 26;
|
|
||||||
anchors.top: parent.top;
|
|
||||||
anchors.topMargin: 10;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.rightMargin: 10;
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent;
|
|
||||||
hoverEnabled: true;
|
|
||||||
onEntered: {
|
|
||||||
parent.text = hifi.glyphs.closeInverted;
|
|
||||||
}
|
|
||||||
onExited: {
|
|
||||||
parent.text = hifi.glyphs.close;
|
|
||||||
}
|
|
||||||
onClicked: {
|
|
||||||
if (root.isLightbox) {
|
|
||||||
root.visible = false;
|
|
||||||
} else {
|
|
||||||
sendToScript({method: 'inspectionCertificate_closeClicked', closeGoesToPurchases: root.closeGoesToPurchases});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -288,13 +164,11 @@ Rectangle {
|
||||||
//
|
//
|
||||||
Item {
|
Item {
|
||||||
id: certificateContainer;
|
id: certificateContainer;
|
||||||
anchors.top: titleBarText.top;
|
anchors.top: popText.bottom;
|
||||||
anchors.topMargin: 110;
|
anchors.topMargin: 30;
|
||||||
anchors.bottom: infoContainer.top;
|
anchors.bottom: buttonsContainer.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: titleBarText.anchors.leftMargin;
|
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 24;
|
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: itemNameHeader;
|
id: itemNameHeader;
|
||||||
|
@ -304,7 +178,9 @@ Rectangle {
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 45;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.darkGray;
|
color: hifi.colors.darkGray;
|
||||||
|
@ -321,30 +197,79 @@ Rectangle {
|
||||||
anchors.right: itemNameHeader.right;
|
anchors.right: itemNameHeader.right;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: root.certTextColor;
|
color: hifi.colors.white;
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
MouseArea {
|
MouseArea {
|
||||||
enabled: showInMarketplaceButton.visible;
|
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
hoverEnabled: enabled;
|
hoverEnabled: enabled;
|
||||||
onClicked: {
|
onClicked: {
|
||||||
sendToScript({method: 'inspectionCertificate_showInMarketplaceClicked', marketplaceUrl: root.marketplaceUrl});
|
sendToScript({method: 'inspectionCertificate_showInMarketplaceClicked', marketplaceUrl: root.marketplaceUrl});
|
||||||
}
|
}
|
||||||
onEntered: itemName.color = hifi.colors.blueHighlight;
|
onEntered: itemName.color = hifi.colors.blueHighlight;
|
||||||
onExited: itemName.color = root.certTextColor;
|
onExited: itemName.color = hifi.colors.white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: ownedByHeader;
|
||||||
|
text: "OWNER";
|
||||||
|
// Text size
|
||||||
|
size: 16;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: itemName.bottom;
|
||||||
|
anchors.topMargin: 28;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 45;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
height: paintedHeight;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.darkGray;
|
||||||
|
}
|
||||||
|
RalewayRegular {
|
||||||
|
id: ownedBy;
|
||||||
|
text: root.itemOwner;
|
||||||
|
// Text size
|
||||||
|
size: 22;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: ownedByHeader.bottom;
|
||||||
|
anchors.topMargin: 8;
|
||||||
|
anchors.left: ownedByHeader.left;
|
||||||
|
height: paintedHeight;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.white;
|
||||||
|
elide: Text.ElideRight;
|
||||||
|
}
|
||||||
|
AnonymousProRegular {
|
||||||
|
id: isMyCertText;
|
||||||
|
visible: root.isMyCert && !root.isCertificateInvalid;
|
||||||
|
text: "(Private)";
|
||||||
|
size: 18;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: ownedBy.top;
|
||||||
|
anchors.topMargin: 4;
|
||||||
|
anchors.bottom: ownedBy.bottom;
|
||||||
|
anchors.left: ownedBy.right;
|
||||||
|
anchors.leftMargin: 6;
|
||||||
|
anchors.right: ownedByHeader.right;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.white;
|
||||||
|
elide: Text.ElideRight;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: editionHeader;
|
id: editionHeader;
|
||||||
text: "EDITION";
|
text: "EDITION";
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: itemName.bottom;
|
anchors.top: ownedBy.bottom;
|
||||||
anchors.topMargin: 28;
|
anchors.topMargin: 28;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 45;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.darkGray;
|
color: hifi.colors.darkGray;
|
||||||
|
@ -361,117 +286,21 @@ Rectangle {
|
||||||
anchors.right: editionHeader.right;
|
anchors.right: editionHeader.right;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: root.certTextColor;
|
color: hifi.colors.white;
|
||||||
}
|
|
||||||
|
|
||||||
// "Show In Marketplace" button
|
|
||||||
HifiControlsUit.Button {
|
|
||||||
id: showInMarketplaceButton;
|
|
||||||
enabled: root.marketplaceUrl;
|
|
||||||
color: hifi.buttons.blue;
|
|
||||||
colorScheme: hifi.colorSchemes.light;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
anchors.bottomMargin: 48;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
width: 200;
|
|
||||||
height: 40;
|
|
||||||
text: "View In Market"
|
|
||||||
onClicked: {
|
|
||||||
sendToScript({method: 'inspectionCertificate_showInMarketplaceClicked', marketplaceUrl: root.marketplaceUrl});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// "CERTIFICATE" END
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
// "INFO CONTAINER" START
|
|
||||||
//
|
|
||||||
Item {
|
|
||||||
id: infoContainer;
|
|
||||||
anchors.bottom: parent.bottom;
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.leftMargin: titleBarText.anchors.leftMargin;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
anchors.rightMargin: 24;
|
|
||||||
height: root.useGoldCert ? 220 : 372;
|
|
||||||
|
|
||||||
RalewayRegular {
|
|
||||||
id: errorText;
|
|
||||||
visible: !root.useGoldCert;
|
|
||||||
// Text size
|
|
||||||
size: 20;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: parent.top;
|
|
||||||
anchors.topMargin: 36;
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
height: 116;
|
|
||||||
// Style
|
|
||||||
wrapMode: Text.WordWrap;
|
|
||||||
color: hifi.colors.baseGray;
|
|
||||||
verticalAlignment: Text.AlignTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
RalewayRegular {
|
|
||||||
id: ownedByHeader;
|
|
||||||
text: "OWNER";
|
|
||||||
// Text size
|
|
||||||
size: 16;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: errorText.visible ? errorText.bottom : parent.top;
|
|
||||||
anchors.topMargin: 28;
|
|
||||||
anchors.left: parent.left;
|
|
||||||
anchors.right: parent.right;
|
|
||||||
height: paintedHeight;
|
|
||||||
// Style
|
|
||||||
color: hifi.colors.darkGray;
|
|
||||||
}
|
|
||||||
|
|
||||||
RalewayRegular {
|
|
||||||
id: ownedBy;
|
|
||||||
text: root.itemOwner;
|
|
||||||
// Text size
|
|
||||||
size: 22;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: ownedByHeader.bottom;
|
|
||||||
anchors.topMargin: 8;
|
|
||||||
anchors.left: ownedByHeader.left;
|
|
||||||
height: paintedHeight;
|
|
||||||
// Style
|
|
||||||
color: root.infoTextColor;
|
|
||||||
elide: Text.ElideRight;
|
|
||||||
}
|
|
||||||
AnonymousProRegular {
|
|
||||||
id: isMyCertText;
|
|
||||||
visible: root.isMyCert && ownedBy.text !== "--" && ownedBy.text !== "";
|
|
||||||
text: "(Private)";
|
|
||||||
size: 18;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: ownedBy.top;
|
|
||||||
anchors.topMargin: 4;
|
|
||||||
anchors.bottom: ownedBy.bottom;
|
|
||||||
anchors.left: ownedBy.right;
|
|
||||||
anchors.leftMargin: 6;
|
|
||||||
anchors.right: ownedByHeader.right;
|
|
||||||
// Style
|
|
||||||
color: root.infoTextColor;
|
|
||||||
elide: Text.ElideRight;
|
|
||||||
verticalAlignment: Text.AlignVCenter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: dateOfPurchaseHeader;
|
id: dateOfPurchaseHeader;
|
||||||
text: "PURCHASE DATE";
|
text: "DATE OF PURCHASE";
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: ownedBy.bottom;
|
anchors.top: edition.bottom;
|
||||||
anchors.topMargin: 28;
|
anchors.topMargin: 28;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.horizontalCenter;
|
anchors.leftMargin: 45;
|
||||||
anchors.rightMargin: 8;
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.darkGray;
|
color: hifi.colors.darkGray;
|
||||||
|
@ -488,59 +317,74 @@ Rectangle {
|
||||||
anchors.right: dateOfPurchaseHeader.right;
|
anchors.right: dateOfPurchaseHeader.right;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
// Style
|
// Style
|
||||||
color: root.infoTextColor;
|
color: hifi.colors.white;
|
||||||
}
|
}
|
||||||
|
|
||||||
RalewayRegular {
|
RalewayRegular {
|
||||||
id: priceHeader;
|
id: errorText;
|
||||||
text: "PURCHASE PRICE";
|
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 20;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: ownedBy.bottom;
|
anchors.top: dateOfPurchase.bottom;
|
||||||
anchors.topMargin: 28;
|
anchors.topMargin: 36;
|
||||||
anchors.left: parent.horizontalCenter;
|
anchors.left: dateOfPurchase.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: dateOfPurchase.right;
|
||||||
height: paintedHeight;
|
anchors.bottom: parent.bottom;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.darkGray;
|
wrapMode: Text.WordWrap;
|
||||||
}
|
color: hifi.colors.redHighlight;
|
||||||
HiFiGlyphs {
|
|
||||||
id: hfcGlyph;
|
|
||||||
visible: priceText.text !== "Undisclosed" && priceText.text !== "";
|
|
||||||
text: hifi.glyphs.hfc;
|
|
||||||
// Size
|
|
||||||
size: 24;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: priceHeader.bottom;
|
|
||||||
anchors.topMargin: 8;
|
|
||||||
anchors.left: priceHeader.left;
|
|
||||||
width: visible ? paintedWidth + 6 : 0;
|
|
||||||
height: 40;
|
|
||||||
// Style
|
|
||||||
color: root.infoTextColor;
|
|
||||||
verticalAlignment: Text.AlignTop;
|
verticalAlignment: Text.AlignTop;
|
||||||
horizontalAlignment: Text.AlignLeft;
|
|
||||||
}
|
|
||||||
AnonymousProRegular {
|
|
||||||
id: priceText;
|
|
||||||
text: root.itemCost;
|
|
||||||
// Text size
|
|
||||||
size: 18;
|
|
||||||
// Anchors
|
|
||||||
anchors.top: priceHeader.bottom;
|
|
||||||
anchors.topMargin: 8;
|
|
||||||
anchors.left: hfcGlyph.right;
|
|
||||||
anchors.right: priceHeader.right;
|
|
||||||
height: paintedHeight;
|
|
||||||
// Style
|
|
||||||
color: root.infoTextColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// "INFO CONTAINER" END
|
// "CERTIFICATE" END
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: buttonsContainer;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.bottomMargin: 30;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: 50;
|
||||||
|
|
||||||
|
// "Cancel" button
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
color: hifi.buttons.noneBorderlessWhite;
|
||||||
|
colorScheme: hifi.colorSchemes.light;
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 30;
|
||||||
|
width: parent.width/2 - 50;
|
||||||
|
height: 50;
|
||||||
|
text: "close";
|
||||||
|
onClicked: {
|
||||||
|
if (root.isLightbox) {
|
||||||
|
root.visible = false;
|
||||||
|
} else {
|
||||||
|
sendToScript({method: 'inspectionCertificate_closeClicked', closeGoesToPurchases: root.closeGoesToPurchases});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Show In Marketplace" button
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: showInMarketplaceButton;
|
||||||
|
enabled: root.marketplaceUrl;
|
||||||
|
color: hifi.buttons.blue;
|
||||||
|
colorScheme: hifi.colorSchemes.light;
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 30;
|
||||||
|
width: parent.width/2 - 50;
|
||||||
|
height: 50;
|
||||||
|
text: "View In Market"
|
||||||
|
onClicked: {
|
||||||
|
sendToScript({method: 'inspectionCertificate_showInMarketplaceClicked', marketplaceUrl: root.marketplaceUrl});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FUNCTION DEFINITIONS START
|
// FUNCTION DEFINITIONS START
|
||||||
//
|
//
|
||||||
|
@ -560,11 +404,19 @@ Rectangle {
|
||||||
function fromScript(message) {
|
function fromScript(message) {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'inspectionCertificate_setCertificateId':
|
case 'inspectionCertificate_setCertificateId':
|
||||||
resetCert(false);
|
|
||||||
root.certificateId = message.certificateId;
|
root.certificateId = message.certificateId;
|
||||||
break;
|
break;
|
||||||
case 'inspectionCertificate_resetCert':
|
case 'inspectionCertificate_resetCert':
|
||||||
resetCert(true);
|
titleBarText.text = "Certificate";
|
||||||
|
popText.text = "PROOF OF PURCHASE";
|
||||||
|
root.certificateId = "";
|
||||||
|
root.itemName = "--";
|
||||||
|
root.itemOwner = "--";
|
||||||
|
root.itemEdition = "--";
|
||||||
|
root.dateOfPurchase = "--";
|
||||||
|
root.marketplaceUrl = "";
|
||||||
|
root.isMyCert = false;
|
||||||
|
errorText.text = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));
|
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));
|
||||||
|
@ -572,33 +424,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
function resetCert(alsoResetCertID) {
|
|
||||||
if (alsoResetCertID) {
|
|
||||||
root.certificateId = "";
|
|
||||||
}
|
|
||||||
root.certInfoReplaceMode = 5;
|
|
||||||
root.certificateInfoPending = true;
|
|
||||||
root.certificateStatusPending = true;
|
|
||||||
root.useGoldCert = true;
|
|
||||||
root.certTitleTextColor = hifi.colors.darkGray;
|
|
||||||
root.certTextColor = hifi.colors.white;
|
|
||||||
root.infoTextColor = hifi.colors.blueAccent;
|
|
||||||
titleBarText.text = "Certificate";
|
|
||||||
popText.text = "";
|
|
||||||
root.itemName = "--";
|
|
||||||
root.itemOwner = "--";
|
|
||||||
root.itemEdition = "--";
|
|
||||||
root.dateOfPurchase = "--";
|
|
||||||
root.marketplaceUrl = "";
|
|
||||||
root.itemCost = "--";
|
|
||||||
root.isMyCert = false;
|
|
||||||
errorText.text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFormattedDate(timestamp) {
|
function getFormattedDate(timestamp) {
|
||||||
if (timestamp === "--") {
|
|
||||||
return "--";
|
|
||||||
}
|
|
||||||
function addLeadingZero(n) {
|
function addLeadingZero(n) {
|
||||||
return n < 10 ? '0' + n : '' + n;
|
return n < 10 ? '0' + n : '' + n;
|
||||||
}
|
}
|
||||||
|
@ -623,7 +449,7 @@ Rectangle {
|
||||||
|
|
||||||
var min = addLeadingZero(a.getMinutes());
|
var min = addLeadingZero(a.getMinutes());
|
||||||
var sec = addLeadingZero(a.getSeconds());
|
var sec = addLeadingZero(a.getSeconds());
|
||||||
return year + '-' + month + '-' + day + ' ' + drawnHour + ':' + min + amOrPm;
|
return year + '-' + month + '-' + day + '<br>' + drawnHour + ':' + min + amOrPm;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// FUNCTION DEFINITIONS END
|
// FUNCTION DEFINITIONS END
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 185 KiB |
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
|
@ -1115,7 +1115,7 @@ Item {
|
||||||
|
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
id: sendingMoneyImage;
|
id: sendingMoneyImage;
|
||||||
source: "../../common/images/loader.gif"
|
source: "./images/loader.gif"
|
||||||
width: 96;
|
width: 96;
|
||||||
height: width;
|
height: width;
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Loading…
Reference in a new issue