MOAR PROGRESS

This commit is contained in:
Zach Fox 2017-08-17 16:20:50 -07:00
parent 9135e37078
commit 5f69f30551
4 changed files with 89 additions and 48 deletions

View file

@ -24,8 +24,6 @@ Item {
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
id: root; id: root;
anchors.fill: parent;
visible: false;
Hifi.QmlCommerce { Hifi.QmlCommerce {
id: commerce; id: commerce;
@ -96,6 +94,10 @@ Item {
function getImagePathFromImageID(imageID) { function getImagePathFromImageID(imageID) {
return (imageID ? gridModel.get(imageID - 1).sourcePath : ""); return (imageID ? gridModel.get(imageID - 1).sourcePath : "");
} }
function getSelectedImageIndex() {
return gridModel.get(securityImageGrid.currentIndex).securityImageEnumValue;
}
// //
// FUNCTION DEFINITIONS END // FUNCTION DEFINITIONS END
// //

View file

@ -36,17 +36,27 @@ Rectangle {
} }
} }
} }
Connections {
target: walletSetupLightbox;
onSignalSent: {
sendToScript(msg);
}
}
Rectangle { Rectangle {
id: walletSetupLightboxContainer;
visible: walletSetupLightbox.visible;
z: 998;
anchors.fill: parent; anchors.fill: parent;
color: "black"; color: "black";
opacity: 0.5; opacity: 0.5;
}
WalletSetupLightbox { WalletSetupLightbox {
id: walletSetupLightbox; id: walletSetupLightbox;
anchors.centerIn: parent; z: 999;
width: parent.width - 50; anchors.centerIn: walletSetupLightboxContainer;
height: parent.height - 50; width: walletSetupLightboxContainer.width - 50;
} height: walletSetupLightboxContainer.height - 50;
} }
// //
@ -146,6 +156,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
} }
MouseArea { MouseArea {
enabled: !walletSetupLightboxContainer.visible;
anchors.fill: parent; anchors.fill: parent;
hoverEnabled: enabled; hoverEnabled: enabled;
onClicked: { onClicked: {
@ -180,6 +191,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
} }
MouseArea { MouseArea {
enabled: !walletSetupLightboxContainer.visible;
anchors.fill: parent; anchors.fill: parent;
hoverEnabled: enabled; hoverEnabled: enabled;
onClicked: { onClicked: {
@ -214,6 +226,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
} }
MouseArea { MouseArea {
enabled: !walletSetupLightboxContainer.visible;
anchors.fill: parent; anchors.fill: parent;
hoverEnabled: enabled; hoverEnabled: enabled;
onClicked: { onClicked: {
@ -248,6 +261,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
} }
MouseArea { MouseArea {
enabled: !walletSetupLightboxContainer.visible;
anchors.fill: parent; anchors.fill: parent;
hoverEnabled: enabled; hoverEnabled: enabled;
onClicked: { onClicked: {

View file

@ -24,30 +24,32 @@ Rectangle {
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
id: root; id: root;
property int stepNumber: 0; property string lastPage: "";
// Style // Style
color: hifi.colors.white; color: "white";
anchors.fill: parent;
Hifi.QmlCommerce { Hifi.QmlCommerce {
id: commerce; id: commerce;
onLoginStatusResult: { onLoginStatusResult: {
if (isLoggedIn) { if (isLoggedIn) {
loginPageContainer.visible = false; securityImageContainer.visible = true;
commerce.getSecurityImage();
} else { } else {
loginPageContainer.visible = true; loginPageContainer.visible = true;
} }
} }
onSecurityImageResult: { onSecurityImageResult: {
loginPageContainer.visible = false;
if (imageID !== 0) { // "If security image is set up" if (imageID !== 0) { // "If security image is set up"
commerce.getPassphraseSetupStatus();
passphrasePageSecurityImage.source = securityImageSelection.getImagePathFromImageID(imageID); passphrasePageSecurityImage.source = securityImageSelection.getImagePathFromImageID(imageID);
} else { if (root.lastPage === "") {
securityImageContainer.visible = false;
choosePassphraseContainer.visible = true;
}
} else if (root.lastPage === "securityImage") {
// ERROR! Invalid security image.
securityImageContainer.visible = true; securityImageContainer.visible = true;
choosePassphraseContainer.visible = false;
} }
} }
@ -94,7 +96,7 @@ Rectangle {
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
width: paintedWidth; width: paintedWidth;
// Style // Style
color: hifi.colors.lightGrayText; color: hifi.colors.darkGray;
// Alignment // Alignment
horizontalAlignment: Text.AlignHLeft; horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
@ -141,6 +143,12 @@ Rectangle {
// Anchors // Anchors
anchors.fill: parent; anchors.fill: parent;
onVisibleChanged: {
if (visible) {
commerce.getSecurityImage();
}
}
Item { Item {
id: securityImageTitle; id: securityImageTitle;
// Size // Size
@ -162,7 +170,7 @@ Rectangle {
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
width: paintedWidth; width: paintedWidth;
// Style // Style
color: hifi.colors.lightGrayText; color: hifi.colors.darkGray;
// Alignment // Alignment
horizontalAlignment: Text.AlignHLeft; horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
@ -172,9 +180,9 @@ Rectangle {
// Text below title bar // Text below title bar
RalewaySemiBold { RalewaySemiBold {
id: securityImageTitleHelper; id: securityImageTitleHelper;
text: "Choose a Security Picture"; text: "Choose a Security Picture:";
// Text size // Text size
size: hifi.fontSizes.overlayTitle; size: 24;
// Anchors // Anchors
anchors.top: securityImageTitle.bottom; anchors.top: securityImageTitle.bottom;
anchors.left: parent.left; anchors.left: parent.left;
@ -182,7 +190,7 @@ Rectangle {
height: 50; height: 50;
width: paintedWidth; width: paintedWidth;
// Style // Style
color: hifi.colors.lightGrayText; color: hifi.colors.darkGray;
// Alignment // Alignment
horizontalAlignment: Text.AlignHLeft; horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
@ -193,8 +201,31 @@ Rectangle {
// Anchors // Anchors
anchors.top: securityImageTitleHelper.bottom; anchors.top: securityImageTitleHelper.bottom;
anchors.left: parent.left; anchors.left: parent.left;
anchors.leftMargin: 16;
anchors.right: parent.right; anchors.right: parent.right;
height: 350; anchors.rightMargin: 16;
height: 280;
}
// Text below security images
RalewaySemiBold {
text: "<b>Your security picture shows you that the service asking for your passphrase is authorized. You can change your secure picture at any time.</b>";
// Text size
size: 18;
// Anchors
anchors.top: securityImageSelection.bottom;
anchors.topMargin: 40;
anchors.left: parent.left;
anchors.leftMargin: 16;
anchors.right: parent.right;
anchors.rightMargin: 16;
height: paintedHeight;
// Style
color: hifi.colors.darkGray;
wrapMode: Text.WordWrap;
// Alignment
horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter;
} }
// Navigation Bar // Navigation Bar
@ -219,7 +250,7 @@ Rectangle {
width: 100; width: 100;
text: "Cancel" text: "Cancel"
onClicked: { onClicked: {
signalSent({method: 'securityImageSelection_cancelClicked'});
} }
} }
@ -236,7 +267,10 @@ Rectangle {
width: 100; width: 100;
text: "Next"; text: "Next";
onClicked: { onClicked: {
root.lastPage = "securityImage";
commerce.chooseSecurityImage(securityImageSelection.getSelectedImageIndex());
securityImageContainer.visible = false;
choosePassphraseContainer.visible = true;
} }
} }
} }
@ -254,6 +288,12 @@ Rectangle {
// Anchors // Anchors
anchors.fill: parent; anchors.fill: parent;
onVisibleChanged: {
if (visible) {
commerce.getPassphraseSetupStatus();
}
}
Item { Item {
// Size // Size
width: parent.width; width: parent.width;
@ -274,7 +314,7 @@ Rectangle {
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
width: paintedWidth; width: paintedWidth;
// Style // Style
color: hifi.colors.lightGrayText; color: hifi.colors.darkGray;
// Alignment // Alignment
horizontalAlignment: Text.AlignHLeft; horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
@ -303,7 +343,9 @@ Rectangle {
width: 100; width: 100;
text: "Back" text: "Back"
onClicked: { onClicked: {
root.lastPage = "choosePassphrase";
choosePassphraseContainer.visible = false;
securityImageContainer.visible = true;
} }
} }
@ -374,7 +416,7 @@ Rectangle {
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
width: paintedWidth; width: paintedWidth;
// Style // Style
color: hifi.colors.lightGrayText; color: hifi.colors.darkGray;
// Alignment // Alignment
horizontalAlignment: Text.AlignHLeft; horizontalAlignment: Text.AlignHLeft;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
@ -388,27 +430,7 @@ Rectangle {
// //
// FUNCTION DEFINITIONS START // FUNCTION DEFINITIONS START
// //
// signal signalSent(var msg);
// Function Name: fromScript()
//
// Relevant Variables:
// None
//
// Arguments:
// message: The message sent from the 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) {
default:
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
}
}
signal sendToScript(var message);
// //
// FUNCTION DEFINITIONS END // FUNCTION DEFINITIONS END
// //

View file

@ -55,6 +55,9 @@
// in the format "{method, params}", like json-rpc. See also sendToQml(). // in the format "{method, params}", like json-rpc. See also sendToQml().
function fromQml(message) { function fromQml(message) {
switch (message.method) { switch (message.method) {
case 'securityImageSelection_cancelClicked':
tablet.gotoHomeScreen();
break;
default: default:
print('Unrecognized message from QML:', JSON.stringify(message)); print('Unrecognized message from QML:', JSON.stringify(message));
} }