diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml
index cdd692dd17..4f4aab70af 100644
--- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml
+++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml
@@ -41,6 +41,16 @@ Rectangle {
Hifi.QmlCommerce {
id: commerce;
+ onLoginStatusResult: {
+ if (!isLoggedIn && root.activeView !== "needsLogIn") {
+ root.activeView = "needsLogIn";
+ } else if (isLoggedIn) {
+ root.activeView = "initialize";
+ commerce.getSecurityImage();
+ commerce.getKeyFilePathIfExists();
+ }
+ }
+
onSecurityImageResult: {
securityImageResultReceived = true;
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
@@ -107,6 +117,7 @@ Rectangle {
//
Item {
id: titleBarContainer;
+ visible: !needsLogIn.visible;
// Size
width: parent.width;
height: 50;
@@ -179,10 +190,32 @@ Rectangle {
color: hifi.colors.baseGray;
Component.onCompleted: {
- commerce.getSecurityImage();
- commerce.getKeyFilePathIfExists();
+ commerce.getLoginStatus();
}
}
+
+ HifiWallet.NeedsLogIn {
+ id: needsLogIn;
+ visible: root.activeView === "needsLogIn";
+ anchors.top: parent.top;
+ anchors.bottom: parent.bottom;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+
+ Connections {
+ onSendSignalToWallet: {
+ sendToScript(msg);
+ }
+ }
+ }
+ Connections {
+ target: GlobalServices
+ onMyUsernameChanged: {
+ commerce.getLoginStatus();
+ }
+ }
+
+
//
// "WALLET NOT SET UP" START
diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
index a88633344f..8e58b5190f 100644
--- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
+++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
@@ -36,6 +36,16 @@ Rectangle {
Hifi.QmlCommerce {
id: commerce;
+ onLoginStatusResult: {
+ if (!isLoggedIn && root.activeView !== "needsLogIn") {
+ root.activeView = "needsLogIn";
+ } else if (isLoggedIn) {
+ root.activeView = "initialize";
+ commerce.getSecurityImage();
+ commerce.getKeyFilePathIfExists();
+ }
+ }
+
onSecurityImageResult: {
securityImageResultReceived = true;
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
@@ -78,6 +88,7 @@ Rectangle {
//
Item {
id: titleBarContainer;
+ visible: !needsLogIn.visible;
// Size
height: 50;
// Anchors
@@ -150,8 +161,28 @@ Rectangle {
color: hifi.colors.baseGray;
Component.onCompleted: {
- commerce.getSecurityImage();
- commerce.getKeyFilePathIfExists();
+ commerce.getLoginStatus();
+ }
+ }
+
+ HifiWallet.NeedsLogIn {
+ id: needsLogIn;
+ visible: root.activeView === "needsLogIn";
+ anchors.top: parent.top;
+ anchors.bottom: parent.bottom;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+
+ Connections {
+ onSendSignalToWallet: {
+ sendToScript(msg);
+ }
+ }
+ }
+ Connections {
+ target: GlobalServices
+ onMyUsernameChanged: {
+ commerce.getLoginStatus();
}
}
diff --git a/interface/resources/qml/hifi/commerce/wallet/NeedsLogIn.qml b/interface/resources/qml/hifi/commerce/wallet/NeedsLogIn.qml
new file mode 100644
index 0000000000..1e95aaa297
--- /dev/null
+++ b/interface/resources/qml/hifi/commerce/wallet/NeedsLogIn.qml
@@ -0,0 +1,188 @@
+//
+// NeedsLogIn.qml
+// qml/hifi/commerce/wallet
+//
+// NeedsLogIn
+//
+// Created by Zach Fox on 2017-08-18
+// 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
+
+Item {
+ HifiConstants { id: hifi; }
+
+ id: root;
+ Hifi.QmlCommerce {
+ id: commerce;
+ }
+
+ //
+ // LOGIN PAGE START
+ //
+ Item {
+ id: loginPageContainer;
+ // Anchors
+ anchors.fill: parent;
+
+ Item {
+ id: loginTitle;
+ // Size
+ width: parent.width;
+ height: 50;
+ // Anchors
+ anchors.left: parent.left;
+ anchors.top: parent.top;
+
+ // Title Bar text
+ RalewaySemiBold {
+ text: "HIFI COMMERCE - 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.faintGray;
+ // Alignment
+ horizontalAlignment: Text.AlignHLeft;
+ verticalAlignment: Text.AlignVCenter;
+ }
+ }
+
+ // Text below title bar
+ RalewaySemiBold {
+ id: loginTitleHelper;
+ text: "Please Log In to High Fidelity";
+ // Text size
+ size: 24;
+ // Anchors
+ anchors.top: loginTitle.bottom;
+ anchors.topMargin: 100;
+ anchors.left: parent.left;
+ anchors.leftMargin: 16;
+ anchors.right: parent.right;
+ anchors.rightMargin: 16;
+ height: 50;
+ // Style
+ color: hifi.colors.faintGray;
+ // Alignment
+ horizontalAlignment: Text.AlignHCenter;
+ verticalAlignment: Text.AlignVCenter;
+ }
+
+ // Text below helper text
+ RalewayRegular {
+ id: loginDetailText;
+ text: "To buy/sell items on the Marketplace, or to use your Wallet, you must first log in to High Fidelity.";
+ // Text size
+ size: 18;
+ // Anchors
+ anchors.top: loginTitleHelper.bottom;
+ anchors.topMargin: 25;
+ anchors.left: parent.left;
+ anchors.leftMargin: 16;
+ anchors.right: parent.right;
+ anchors.rightMargin: 16;
+ height: 50;
+ // Style
+ color: hifi.colors.faintGray;
+ wrapMode: Text.WordWrap;
+ // Alignment
+ horizontalAlignment: Text.AlignHCenter;
+ verticalAlignment: Text.AlignVCenter;
+ }
+
+
+
+ Item {
+ // Size
+ width: root.width;
+ height: 70;
+ // Anchors
+ anchors.top: loginDetailText.bottom;
+ anchors.topMargin: 40;
+ anchors.left: parent.left;
+
+ // "Cancel" button
+ HifiControlsUit.Button {
+ id: cancelButton;
+ 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: parent.width/2 - anchors.leftMargin*2;
+ text: "Cancel"
+ onClicked: {
+ sendToScript({method: 'needsLogIn_cancelClicked'});
+ }
+ }
+
+ // "Set Up" button
+ HifiControlsUit.Button {
+ id: setUpButton;
+ color: hifi.buttons.blue;
+ 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: parent.width/2 - anchors.rightMargin*2;
+ text: "Log In"
+ onClicked: {
+ sendToScript({method: 'needsLogIn_loginClicked'});
+ }
+ }
+ }
+ }
+ //
+ // LOGIN PAGE 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 sendSignalToWallet(var msg);
+ //
+ // FUNCTION DEFINITIONS END
+ //
+}
diff --git a/interface/resources/qml/hifi/commerce/wallet/SecurityImageModel.qml b/interface/resources/qml/hifi/commerce/wallet/SecurityImageModel.qml
index b49f16857b..7b1434aa3c 100644
--- a/interface/resources/qml/hifi/commerce/wallet/SecurityImageModel.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/SecurityImageModel.qml
@@ -16,27 +16,27 @@ import QtQuick 2.5
ListModel {
id: root;
ListElement{
- sourcePath: "images/01cat.jpg"
+ sourcePath: "images/01.jpg"
securityImageEnumValue: 1;
}
ListElement{
- sourcePath: "images/02car.jpg"
+ sourcePath: "images/02.jpg"
securityImageEnumValue: 2;
}
ListElement{
- sourcePath: "images/03dog.jpg"
+ sourcePath: "images/03.jpg"
securityImageEnumValue: 3;
}
ListElement{
- sourcePath: "images/04stars.jpg"
+ sourcePath: "images/04.jpg"
securityImageEnumValue: 4;
}
ListElement{
- sourcePath: "images/05plane.jpg"
+ sourcePath: "images/05.jpg"
securityImageEnumValue: 5;
}
ListElement{
- sourcePath: "images/06gingerbread.jpg"
+ sourcePath: "images/06.jpg"
securityImageEnumValue: 6;
}
diff --git a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml
index 3a46082988..1cb6b45d5e 100644
--- a/interface/resources/qml/hifi/commerce/wallet/Wallet.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/Wallet.qml
@@ -35,6 +35,16 @@ Rectangle {
Hifi.QmlCommerce {
id: commerce;
+ onLoginStatusResult: {
+ if (!isLoggedIn && root.activeView !== "needsLogIn") {
+ root.activeView = "needsLogIn";
+ } else if (isLoggedIn) {
+ root.activeView = "initialize";
+ commerce.getSecurityImage();
+ commerce.getKeyFilePathIfExists();
+ }
+ }
+
onSecurityImageResult: {
securityImageResultReceived = true;
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
@@ -131,6 +141,7 @@ Rectangle {
//
Item {
id: titleBarContainer;
+ visible: !needsLogIn.visible;
// Size
width: parent.width;
height: 50;
@@ -182,8 +193,28 @@ Rectangle {
color: hifi.colors.baseGray;
Component.onCompleted: {
- commerce.getSecurityImage();
- commerce.getKeyFilePathIfExists();
+ commerce.getLoginStatus();
+ }
+ }
+
+ NeedsLogIn {
+ id: needsLogIn;
+ visible: root.activeView === "needsLogIn";
+ anchors.top: parent.top;
+ anchors.bottom: parent.bottom;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+
+ Connections {
+ onSendSignalToWallet: {
+ sendToScript(msg);
+ }
+ }
+ }
+ Connections {
+ target: GlobalServices
+ onMyUsernameChanged: {
+ commerce.getLoginStatus();
}
}
@@ -276,6 +307,7 @@ Rectangle {
//
Item {
id: tabButtonsContainer;
+ visible: !needsLogIn.visible;
property int numTabs: 5;
// Size
width: root.width;
@@ -483,6 +515,7 @@ Rectangle {
id: keyboardContainer;
z: 999;
visible: keyboard.raised;
+ property bool punctuationMode: false;
anchors {
bottom: parent.bottom;
left: parent.left;
@@ -508,9 +541,8 @@ Rectangle {
HifiControlsUit.Keyboard {
id: keyboard;
- property bool punctuationMode: false;
raised: HMD.mounted && root.keyboardRaised;
- numeric: keyboard.punctuationMode;
+ numeric: parent.punctuationMode;
anchors {
bottom: parent.bottom;
left: parent.left;
diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml
index d2ddb204fb..adc1d67975 100644
--- a/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml
+++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml
@@ -24,21 +24,13 @@ Rectangle {
HifiConstants { id: hifi; }
id: root;
- property string lastPage: "login";
+ property string lastPage: "securityImage";
// Style
color: hifi.colors.baseGray;
Hifi.QmlCommerce {
id: commerce;
- onLoginStatusResult: {
- if (isLoggedIn) {
- securityImageContainer.visible = true;
- } else {
- loginPageContainer.visible = true;
- }
- }
-
onSecurityImageResult: {
if (!exists && root.lastPage === "securityImage") {
// ERROR! Invalid security image.
@@ -61,136 +53,6 @@ Rectangle {
}
}
- //
- // LOGIN PAGE START
- //
- Item {
- id: loginPageContainer;
- visible: false;
- // Anchors
- anchors.fill: parent;
-
- Component.onCompleted: {
- commerce.getLoginStatus();
- }
-
- Item {
- id: loginTitle;
- // 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.faintGray;
- // Alignment
- horizontalAlignment: Text.AlignHLeft;
- verticalAlignment: Text.AlignVCenter;
- }
- }
-
- // Text below title bar
- RalewaySemiBold {
- id: loginTitleHelper;
- text: "Please Log In to High Fidelity";
- // Text size
- size: 24;
- // Anchors
- anchors.top: loginTitle.bottom;
- anchors.left: parent.left;
- anchors.leftMargin: 16;
- anchors.right: parent.right;
- anchors.rightMargin: 16;
- height: 50;
- // Style
- color: hifi.colors.faintGray;
- // Alignment
- horizontalAlignment: Text.AlignHLeft;
- verticalAlignment: Text.AlignVCenter;
- }
-
- // Text below helper text
- RalewaySemiBold {
- id: loginDetailText;
- text: "To set up your wallet, you must first log in to High Fidelity.";
- // Text size
- size: 18;
- // Anchors
- anchors.top: loginTitleHelper.bottom;
- anchors.topMargin: 25;
- anchors.left: parent.left;
- anchors.leftMargin: 16;
- anchors.right: parent.right;
- anchors.rightMargin: 16;
- height: 50;
- // Style
- color: hifi.colors.faintGray;
- wrapMode: Text.WordWrap;
- // Alignment
- horizontalAlignment: Text.AlignHLeft;
- verticalAlignment: Text.AlignVCenter;
- }
-
- // "Cancel" button
- HifiControlsUit.Button {
- color: hifi.buttons.black;
- colorScheme: hifi.colorSchemes.dark;
- anchors.top: loginDetailText.bottom;
- anchors.topMargin: 25;
- anchors.left: parent.left;
- anchors.leftMargin: 16;
- width: 150;
- height: 50;
- text: "Log In"
- onClicked: {
- sendSignalToWallet({method: 'walletSetup_loginClicked'});
- }
- }
-
- // 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: {
- sendSignalToWallet({method: 'walletSetup_cancelClicked'});
- }
- }
- }
- }
- //
- // LOGIN PAGE END
- //
-
//
// SECURITY IMAGE SELECTION START
//
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/01cat.jpg b/interface/resources/qml/hifi/commerce/wallet/images/01.jpg
similarity index 100%
rename from interface/resources/qml/hifi/commerce/wallet/images/01cat.jpg
rename to interface/resources/qml/hifi/commerce/wallet/images/01.jpg
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/02.jpg b/interface/resources/qml/hifi/commerce/wallet/images/02.jpg
new file mode 100644
index 0000000000..e210d0dc82
Binary files /dev/null and b/interface/resources/qml/hifi/commerce/wallet/images/02.jpg differ
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/02car.jpg b/interface/resources/qml/hifi/commerce/wallet/images/02car.jpg
deleted file mode 100644
index 5dd8091e57..0000000000
Binary files a/interface/resources/qml/hifi/commerce/wallet/images/02car.jpg and /dev/null differ
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/03dog.jpg b/interface/resources/qml/hifi/commerce/wallet/images/03.jpg
similarity index 100%
rename from interface/resources/qml/hifi/commerce/wallet/images/03dog.jpg
rename to interface/resources/qml/hifi/commerce/wallet/images/03.jpg
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/04.jpg b/interface/resources/qml/hifi/commerce/wallet/images/04.jpg
new file mode 100644
index 0000000000..e2358b4dbc
Binary files /dev/null and b/interface/resources/qml/hifi/commerce/wallet/images/04.jpg differ
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/04stars.jpg b/interface/resources/qml/hifi/commerce/wallet/images/04stars.jpg
deleted file mode 100644
index 8f2bf62f83..0000000000
Binary files a/interface/resources/qml/hifi/commerce/wallet/images/04stars.jpg and /dev/null differ
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/05.jpg b/interface/resources/qml/hifi/commerce/wallet/images/05.jpg
new file mode 100644
index 0000000000..796acac167
Binary files /dev/null and b/interface/resources/qml/hifi/commerce/wallet/images/05.jpg differ
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/05plane.jpg b/interface/resources/qml/hifi/commerce/wallet/images/05plane.jpg
deleted file mode 100644
index 6504459d8b..0000000000
Binary files a/interface/resources/qml/hifi/commerce/wallet/images/05plane.jpg and /dev/null differ
diff --git a/interface/resources/qml/hifi/commerce/wallet/images/06gingerbread.jpg b/interface/resources/qml/hifi/commerce/wallet/images/06.jpg
similarity index 100%
rename from interface/resources/qml/hifi/commerce/wallet/images/06gingerbread.jpg
rename to interface/resources/qml/hifi/commerce/wallet/images/06.jpg
diff --git a/interface/src/commerce/Wallet.h b/interface/src/commerce/Wallet.h
index b13d4368d9..cce7ebed3d 100644
--- a/interface/src/commerce/Wallet.h
+++ b/interface/src/commerce/Wallet.h
@@ -42,17 +42,6 @@ signals:
void securityImageResult(bool exists) ;
void keyFilePathIfExistsResult(const QString& path);
-protected:
- enum SecurityImage {
- NONE = 0,
- Cat,
- Car,
- Dog,
- Stars,
- Plane,
- Gingerbread
- };
-
private:
QStringList _publicKeys{};
QPixmap* _securityImage { nullptr };
diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js
index 2068768de9..34c602513e 100644
--- a/scripts/system/commerce/wallet.js
+++ b/scripts/system/commerce/wallet.js
@@ -57,9 +57,10 @@
function fromQml(message) {
switch (message.method) {
case 'walletSetup_cancelClicked':
+ case 'needsLogIn_cancelClicked':
tablet.gotoHomeScreen();
break;
- case 'walletSetup_loginClicked':
+ case 'needsLogIn_loginClicked':
openLoginWindow();
break;
case 'disableHmdPreview':
diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js
index 3b97a4c142..7d1aaee157 100644
--- a/scripts/system/marketplaces/marketplaces.js
+++ b/scripts/system/marketplaces/marketplaces.js
@@ -231,6 +231,12 @@
case 'purchases_goToMarketplaceClicked':
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
break;
+ case 'needsLogIn_cancelClicked':
+ tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
+ break;
+ case 'needsLogIn_loginClicked':
+ openLoginWindow();
+ break;
default:
print('Unrecognized message from Checkout.qml or Purchases.qml: ' + JSON.stringify(message));
}