mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-23 04:20:25 +02:00
415 lines
12 KiB
QML
415 lines
12 KiB
QML
//
|
|
// WalletSetupLightbox.qml
|
|
// qml/hifi/commerce/wallet
|
|
//
|
|
// WalletSetupLightbox
|
|
//
|
|
// Created by Zach Fox on 2017-08-17
|
|
// 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
|
|
|
|
// references XXX from root context
|
|
|
|
Rectangle {
|
|
HifiConstants { id: hifi; }
|
|
|
|
id: root;
|
|
property int stepNumber: 0;
|
|
// Style
|
|
color: hifi.colors.white;
|
|
anchors.fill: parent;
|
|
|
|
Hifi.QmlCommerce {
|
|
id: commerce;
|
|
|
|
onLoginStatusResult: {
|
|
if (isLoggedIn) {
|
|
loginPageContainer.visible = false;
|
|
commerce.getSecurityImage();
|
|
} else {
|
|
loginPageContainer.visible = true;
|
|
}
|
|
}
|
|
|
|
onSecurityImageResult: {
|
|
loginPageContainer.visible = false;
|
|
if (imageID !== 0) { // "If security image is set up"
|
|
commerce.getPassphraseSetupStatus();
|
|
passphrasePageSecurityImage.source = securityImageSelection.getImagePathFromImageID(imageID);
|
|
} else {
|
|
securityImageContainer.visible = true;
|
|
}
|
|
}
|
|
|
|
onPassphraseSetupStatusResult: {
|
|
securityImageContainer.visible = false;
|
|
if (passphraseIsSetup) {
|
|
privateKeysReadyContainer.visible = true;
|
|
} else {
|
|
choosePassphraseContainer.visible = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// LOGIN PAGE START
|
|
//
|
|
Item {
|
|
id: loginPageContainer;
|
|
visible: false;
|
|
// Anchors
|
|
anchors.fill: parent;
|
|
|
|
Component.onCompleted: {
|
|
commerce.getLoginStatus();
|
|
}
|
|
|
|
Item {
|
|
// Size
|
|
width: parent.width;
|
|
height: 50;
|
|
// Anchors
|
|
anchors.left: parent.left;
|
|
anchors.top: parent.top;
|
|
|
|
// Title Bar text
|
|
RalewaySemiBold {
|
|
text: "WALLET SETUP - LOGIN";
|
|
// Text size
|
|
size: hifi.fontSizes.overlayTitle;
|
|
// Anchors
|
|
anchors.top: parent.top;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 16;
|
|
anchors.bottom: parent.bottom;
|
|
width: paintedWidth;
|
|
// Style
|
|
color: hifi.colors.lightGrayText;
|
|
// Alignment
|
|
horizontalAlignment: Text.AlignHLeft;
|
|
verticalAlignment: Text.AlignVCenter;
|
|
}
|
|
}
|
|
|
|
// Navigation Bar
|
|
Item {
|
|
// Size
|
|
width: parent.width;
|
|
height: 100;
|
|
// Anchors:
|
|
anchors.left: parent.left;
|
|
anchors.bottom: parent.bottom;
|
|
|
|
// "Cancel" button
|
|
HifiControlsUit.Button {
|
|
color: hifi.buttons.black;
|
|
colorScheme: hifi.colorSchemes.dark;
|
|
anchors.top: parent.top;
|
|
anchors.topMargin: 3;
|
|
anchors.bottom: parent.bottom;
|
|
anchors.bottomMargin: 3;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 20;
|
|
width: 100;
|
|
text: "Cancel"
|
|
onClicked: {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//
|
|
// LOGIN PAGE END
|
|
//
|
|
|
|
//
|
|
// SECURITY IMAGE SELECTION START
|
|
//
|
|
Item {
|
|
id: securityImageContainer;
|
|
visible: false;
|
|
// Anchors
|
|
anchors.fill: parent;
|
|
|
|
Item {
|
|
id: securityImageTitle;
|
|
// Size
|
|
width: parent.width;
|
|
height: 50;
|
|
// Anchors
|
|
anchors.left: parent.left;
|
|
anchors.top: parent.top;
|
|
|
|
// Title Bar text
|
|
RalewaySemiBold {
|
|
text: "WALLET SETUP - STEP 1 OF 3";
|
|
// Text size
|
|
size: hifi.fontSizes.overlayTitle;
|
|
// Anchors
|
|
anchors.top: parent.top;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 16;
|
|
anchors.bottom: parent.bottom;
|
|
width: paintedWidth;
|
|
// Style
|
|
color: hifi.colors.lightGrayText;
|
|
// Alignment
|
|
horizontalAlignment: Text.AlignHLeft;
|
|
verticalAlignment: Text.AlignVCenter;
|
|
}
|
|
}
|
|
|
|
// Text below title bar
|
|
RalewaySemiBold {
|
|
id: securityImageTitleHelper;
|
|
text: "Choose a Security Picture";
|
|
// Text size
|
|
size: hifi.fontSizes.overlayTitle;
|
|
// Anchors
|
|
anchors.top: securityImageTitle.bottom;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 16;
|
|
height: 50;
|
|
width: paintedWidth;
|
|
// Style
|
|
color: hifi.colors.lightGrayText;
|
|
// Alignment
|
|
horizontalAlignment: Text.AlignHLeft;
|
|
verticalAlignment: Text.AlignVCenter;
|
|
}
|
|
|
|
SecurityImageSelection {
|
|
id: securityImageSelection;
|
|
// Anchors
|
|
anchors.top: securityImageTitleHelper.bottom;
|
|
anchors.left: parent.left;
|
|
anchors.right: parent.right;
|
|
height: 350;
|
|
}
|
|
|
|
// Navigation Bar
|
|
Item {
|
|
// Size
|
|
width: parent.width;
|
|
height: 100;
|
|
// Anchors:
|
|
anchors.left: parent.left;
|
|
anchors.bottom: parent.bottom;
|
|
|
|
// "Cancel" button
|
|
HifiControlsUit.Button {
|
|
color: hifi.buttons.black;
|
|
colorScheme: hifi.colorSchemes.dark;
|
|
anchors.top: parent.top;
|
|
anchors.topMargin: 3;
|
|
anchors.bottom: parent.bottom;
|
|
anchors.bottomMargin: 3;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 20;
|
|
width: 100;
|
|
text: "Cancel"
|
|
onClicked: {
|
|
|
|
}
|
|
}
|
|
|
|
// "Next" button
|
|
HifiControlsUit.Button {
|
|
color: hifi.buttons.black;
|
|
colorScheme: hifi.colorSchemes.dark;
|
|
anchors.top: parent.top;
|
|
anchors.topMargin: 3;
|
|
anchors.bottom: parent.bottom;
|
|
anchors.bottomMargin: 3;
|
|
anchors.right: parent.right;
|
|
anchors.rightMargin: 20;
|
|
width: 100;
|
|
text: "Next";
|
|
onClicked: {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//
|
|
// SECURITY IMAGE SELECTION END
|
|
//
|
|
|
|
//
|
|
// SECURE PASSPHRASE SELECTION START
|
|
//
|
|
Item {
|
|
id: choosePassphraseContainer;
|
|
visible: false;
|
|
// Anchors
|
|
anchors.fill: parent;
|
|
|
|
Item {
|
|
// Size
|
|
width: parent.width;
|
|
height: 50;
|
|
// Anchors
|
|
anchors.left: parent.left;
|
|
anchors.top: parent.top;
|
|
|
|
// Title Bar text
|
|
RalewaySemiBold {
|
|
text: "WALLET SETUP - STEP 2 OF 3";
|
|
// Text size
|
|
size: hifi.fontSizes.overlayTitle;
|
|
// Anchors
|
|
anchors.top: parent.top;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 16;
|
|
anchors.bottom: parent.bottom;
|
|
width: paintedWidth;
|
|
// Style
|
|
color: hifi.colors.lightGrayText;
|
|
// Alignment
|
|
horizontalAlignment: Text.AlignHLeft;
|
|
verticalAlignment: Text.AlignVCenter;
|
|
}
|
|
}
|
|
|
|
// Navigation Bar
|
|
Item {
|
|
// Size
|
|
width: parent.width;
|
|
height: 100;
|
|
// Anchors:
|
|
anchors.left: parent.left;
|
|
anchors.bottom: parent.bottom;
|
|
|
|
// "Back" button
|
|
HifiControlsUit.Button {
|
|
color: hifi.buttons.black;
|
|
colorScheme: hifi.colorSchemes.dark;
|
|
anchors.top: parent.top;
|
|
anchors.topMargin: 3;
|
|
anchors.bottom: parent.bottom;
|
|
anchors.bottomMargin: 3;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 20;
|
|
width: 100;
|
|
text: "Back"
|
|
onClicked: {
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// Security Image
|
|
Image {
|
|
id: passphrasePageSecurityImage;
|
|
// Anchors
|
|
anchors.top: parent.top;
|
|
anchors.topMargin: 3;
|
|
anchors.right: passphrasePageNextButton.left;
|
|
height: passphrasePageNextButton.height;
|
|
width: height;
|
|
anchors.verticalCenter: parent.verticalCenter;
|
|
fillMode: Image.PreserveAspectFit;
|
|
mipmap: true;
|
|
}
|
|
|
|
// "Next" button
|
|
HifiControlsUit.Button {
|
|
id: passphrasePageNextButton;
|
|
color: hifi.buttons.black;
|
|
colorScheme: hifi.colorSchemes.dark;
|
|
anchors.top: parent.top;
|
|
anchors.topMargin: 3;
|
|
anchors.bottom: parent.bottom;
|
|
anchors.bottomMargin: 3;
|
|
anchors.right: parent.right;
|
|
anchors.rightMargin: 20;
|
|
width: 100;
|
|
text: "Next";
|
|
onClicked: {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//
|
|
// SECURE PASSPHRASE SELECTION END
|
|
//
|
|
|
|
//
|
|
// PRIVATE KEYS READY START
|
|
//
|
|
Item {
|
|
id: privateKeysReadyContainer;
|
|
visible: false;
|
|
// Anchors
|
|
anchors.fill: parent;
|
|
|
|
Item {
|
|
// Size
|
|
width: parent.width;
|
|
height: 50;
|
|
// Anchors
|
|
anchors.left: parent.left;
|
|
anchors.top: parent.top;
|
|
|
|
// Title Bar text
|
|
RalewaySemiBold {
|
|
text: "WALLET SETUP - STEP 2 OF 3";
|
|
// Text size
|
|
size: hifi.fontSizes.overlayTitle;
|
|
// Anchors
|
|
anchors.top: parent.top;
|
|
anchors.left: parent.left;
|
|
anchors.leftMargin: 16;
|
|
anchors.bottom: parent.bottom;
|
|
width: paintedWidth;
|
|
// Style
|
|
color: hifi.colors.lightGrayText;
|
|
// Alignment
|
|
horizontalAlignment: Text.AlignHLeft;
|
|
verticalAlignment: Text.AlignVCenter;
|
|
}
|
|
}
|
|
}
|
|
//
|
|
// PRIVATE KEYS READY END
|
|
//
|
|
|
|
//
|
|
// FUNCTION DEFINITIONS START
|
|
//
|
|
//
|
|
// 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
|
|
//
|
|
}
|