overte-HifiExperiments/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml
Zach Fox 7ad3a5a1e3 Commerce: Tons of Interface changes (#11463)
* canRez(Tmp)Certified()

* CertifiedItem beginnings

* Skeleton of verifyOwnerChallenge()

* Controlled failure; updateLocation() skeletion

* Controlled failure on checkout page with ctrl+f

* Skeleton Purchases first-use tutorial

* Initial progress on new setup

* Security pic tip

* Skeleton Certificate page

* Updates to Certificate

* General progress; setup is nearly complete

* Better buttons; last step almost done

* Initial progress on wallet home

* Completed recent transactions

* Security page

* Scrollbar

* Fix auth error text

* PassphraseSelection

* Change security pic

* Minor layout changes; beginnings of emulated header

* Various layout changes; wallet nav bar

* Help screen

* Quick onaccepted change

* First pass at new purchases

* Small style updates

* Some error progress

* Lightbox in purchases

* Collapse other help answers when clicking on another

* REZZED notif

* Commerce Lightbox

* Lots of new interactions in Purchases

* Hook up 'view certificate'

* Fix errors, fix close button on cert

* Purchases timer; much faster filter

* Add debugCheckout

* Purchase updates

* GlyphButton; separator; Checkout Success; Ledger fix; debug modes

* Lock glyph below security pic should be white

* Various fixes, round 1

* Circular mask

* Passphrase change button fix; TextField error edge highlighting

* Recent Activity fixes

* Various changes

* Standard Security Pic location

* Color changes

* Filter bar changes

* Styling for multiple owned items

* Minor language change

* Header dropdown (harder than expected)

* Small fixes

* View backup instructions

* marketplaces.js onCommerceScreen

* Beginnign of new injection

* Marketplace injection changes

* Purchase button style changes

* More button styling

* MY PURCHASES button

* marketplace onUsernameChanged

* New help QA

* Help text changes etc

* Downscale security image, reducing filesize

* Lots of bugfixes

* Cleanup before PR

* Only open cert during inspection if commerce switch is on

* Help text changes

* Purchase status incl. change to confirmed; Help text; Open Explorer to hifikey

* Quick glyph change

* New 'wallet not set up' flow for when entering Purchases or Checkout without set-up wallet
2017-09-27 14:43:51 -07:00

321 lines
9.6 KiB
QML

//
// InspectionCertificate.qml
// qml/hifi/commerce/inspectionCertificate
//
// InspectionCertificate
//
// Created by Zach Fox on 2017-09-14
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
import Hifi 1.0 as Hifi
import QtQuick 2.5
import QtQuick.Controls 1.4
import "../../../styles-uit"
import "../../../controls-uit" as HifiControlsUit
import "../../../controls" as HifiControls
import "../wallet" as HifiWallet
// references XXX from root context
Rectangle {
HifiConstants { id: hifi; }
id: root;
property string marketplaceId: "";
property string itemName: "--";
property string itemOwner: "--";
property string itemEdition: "--";
property string dateOfPurchase: "";
property bool closeGoesToPurchases: false;
// Style
color: hifi.colors.faintGray;
Hifi.QmlCommerce {
id: commerce;
}
Image {
anchors.fill: parent;
source: "images/cert-bg.jpg";
}
// Title text
RalewayLight {
id: titleBarText;
text: "Certificate";
// Text size
size: 40;
// Anchors
anchors.top: parent.top;
anchors.topMargin: 40;
anchors.left: parent.left;
anchors.leftMargin: 45;
anchors.right: parent.right;
height: paintedHeight;
// Style
color: hifi.colors.darkGray;
}
// Title text
RalewayRegular {
id: popText;
text: "PROOF OF PURCHASE";
// Text size
size: 16;
// Anchors
anchors.top: titleBarText.bottom;
anchors.topMargin: 4;
anchors.left: titleBarText.left;
anchors.right: titleBarText.right;
height: paintedHeight;
// Style
color: hifi.colors.baseGray;
}
//
// "CERTIFICATE" START
//
Item {
id: certificateContainer;
anchors.top: popText.bottom;
anchors.topMargin: 30;
anchors.bottom: buttonsContainer.top;
anchors.left: parent.left;
anchors.right: parent.right;
RalewayRegular {
id: itemNameHeader;
text: "ITEM NAME";
// Text size
size: 16;
// Anchors
anchors.top: parent.top;
anchors.left: parent.left;
anchors.leftMargin: 45;
anchors.right: parent.right;
anchors.rightMargin: 16;
height: paintedHeight;
// Style
color: hifi.colors.baseGray;
}
RalewaySemiBold {
id: itemName;
text: root.itemName;
// Text size
size: 28;
// Anchors
anchors.top: itemNameHeader.bottom;
anchors.topMargin: 4;
anchors.left: itemNameHeader.left;
anchors.right: itemNameHeader.right;
height: paintedHeight;
// Style
color: hifi.colors.blueAccent;
elide: Text.ElideRight;
MouseArea {
anchors.fill: parent;
hoverEnabled: enabled;
onClicked: {
sendToScript({method: 'inspectionCertificate_showInMarketplaceClicked', itemId: root.marketplaceId});
}
onEntered: itemName.color = hifi.colors.blueHighlight;
onExited: itemName.color = hifi.colors.blueAccent;
}
}
RalewayRegular {
id: ownedByHeader;
text: "OWNER";
// Text size
size: 16;
// Anchors
anchors.top: itemName.bottom;
anchors.topMargin: 20;
anchors.left: parent.left;
anchors.leftMargin: 45;
anchors.right: parent.right;
anchors.rightMargin: 16;
height: paintedHeight;
// Style
color: hifi.colors.baseGray;
}
RalewayRegular {
id: ownedBy;
text: root.itemOwner;
// Text size
size: 22;
// Anchors
anchors.top: ownedByHeader.bottom;
anchors.topMargin: 4;
anchors.left: ownedByHeader.left;
anchors.right: ownedByHeader.right;
height: paintedHeight;
// Style
color: hifi.colors.darkGray;
elide: Text.ElideRight;
}
RalewayRegular {
id: editionHeader;
text: "EDITION";
// Text size
size: 16;
// Anchors
anchors.top: ownedBy.bottom;
anchors.topMargin: 20;
anchors.left: parent.left;
anchors.leftMargin: 45;
anchors.right: parent.right;
anchors.rightMargin: 16;
height: paintedHeight;
// Style
color: hifi.colors.baseGray;
}
AnonymousProRegular {
id: edition;
text: root.itemEdition;
// Text size
size: 22;
// Anchors
anchors.top: editionHeader.bottom;
anchors.topMargin: 4;
anchors.left: editionHeader.left;
anchors.right: editionHeader.right;
height: paintedHeight;
// Style
color: hifi.colors.darkGray;
}
RalewayRegular {
id: dateOfPurchaseHeader;
text: "DATE OF PURCHASE";
visible: root.dateOfPurchase !== "";
// Text size
size: 16;
// Anchors
anchors.top: ownedBy.bottom;
anchors.topMargin: 20;
anchors.left: parent.left;
anchors.leftMargin: 45;
anchors.right: parent.right;
anchors.rightMargin: 16;
height: paintedHeight;
// Style
color: hifi.colors.baseGray;
}
AnonymousProRegular {
id: dateOfPurchase;
text: root.dateOfPurchase;
visible: root.dateOfPurchase !== "";
// Text size
size: 22;
// Anchors
anchors.top: editionHeader.bottom;
anchors.topMargin: 4;
anchors.left: editionHeader.left;
anchors.right: editionHeader.right;
height: paintedHeight;
// Style
color: hifi.colors.darkGray;
}
RalewayRegular {
id: errorText;
text: "Here we will display some text if there's an <b>error</b> with the certificate " +
"(DMCA takedown, invalid cert, location of item updated)";
// Text size
size: 20;
// Anchors
anchors.top: root.dateOfPurchase !== "" ? dateOfPurchase.bottom : edition.bottom;
anchors.topMargin: 40;
anchors.left: root.dateOfPurchase !== "" ? dateOfPurchase.left : edition.left;
anchors.right: root.dateOfPurchase !== "" ? dateOfPurchase.right : edition.right;
anchors.bottom: parent.bottom;
// Style
wrapMode: Text.WordWrap;
color: hifi.colors.redHighlight;
verticalAlignment: Text.AlignTop;
}
}
//
// "CERTIFICATE" END
//
Item {
id: buttonsContainer;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 50;
anchors.left: parent.left;
anchors.right: parent.right;
height: 50;
// "Cancel" button
HifiControlsUit.Button {
color: hifi.buttons.noneBorderless;
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: {
sendToScript({method: 'inspectionCertificate_closeClicked', closeGoesToPurchases: root.closeGoesToPurchases});
}
}
// "Show In Marketplace" button
HifiControlsUit.Button {
id: showInMarketplaceButton;
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', itemId: root.marketplaceId});
}
}
}
//
// FUNCTION DEFINITIONS START
//
//
// Function Name: fromScript()
//
// Relevant Variables:
// None
//
// Arguments:
// message: The message sent from the JavaScript, in this case the Marketplaces JavaScript.
// Messages are in format "{method, params}", like json-rpc.
//
// Description:
// Called when a message is received from a script.
//
function fromScript(message) {
switch (message.method) {
case 'inspectionCertificate_setMarketplaceId':
root.marketplaceId = message.marketplaceId;
root.closeGoesToPurchases = message.closeGoesToPurchases;
break;
case 'inspectionCertificate_setItemInfo':
root.itemName = message.itemName;
root.itemOwner = message.itemOwner;
root.itemEdition = message.itemEdition;
break;
default:
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));
}
}
signal sendToScript(var message);
//
// FUNCTION DEFINITIONS END
//
}