mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 00:53:17 +02:00
Fix security images; actually do the right thing when wallet not set up
This commit is contained in:
parent
ceb38e261d
commit
1c1b841a86
3 changed files with 108 additions and 13 deletions
|
@ -34,15 +34,18 @@ Rectangle {
|
||||||
property bool alreadyOwned: false;
|
property bool alreadyOwned: false;
|
||||||
property int itemPriceFull: 0;
|
property int itemPriceFull: 0;
|
||||||
property bool itemIsJson: true;
|
property bool itemIsJson: true;
|
||||||
|
property bool securityImageResultReceived: false;
|
||||||
|
property bool keyFilePathIfExistsResultReceived: false;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.baseGray;
|
color: hifi.colors.baseGray;
|
||||||
Hifi.QmlCommerce {
|
Hifi.QmlCommerce {
|
||||||
id: commerce;
|
id: commerce;
|
||||||
|
|
||||||
onSecurityImageResult: {
|
onSecurityImageResult: {
|
||||||
|
securityImageResultReceived = true;
|
||||||
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
|
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
|
||||||
root.activeView = "notSetUp";
|
root.activeView = "notSetUp";
|
||||||
} else if (exists && root.activeView !== "checkoutMain") {
|
} else if (root.securityImageResultReceived && exists && root.keyFilePathIfExistsResultReceived && root.activeView === "initialize") {
|
||||||
root.activeView = "checkoutMain";
|
root.activeView = "checkoutMain";
|
||||||
} else if (exists) {
|
} else if (exists) {
|
||||||
// just set the source again (to be sure the change was noticed)
|
// just set the source again (to be sure the change was noticed)
|
||||||
|
@ -52,9 +55,10 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFilePathIfExistsResult: {
|
onKeyFilePathIfExistsResult: {
|
||||||
|
keyFilePathIfExistsResultReceived = true;
|
||||||
if (path === "" && root.activeView !== "notSetUp") {
|
if (path === "" && root.activeView !== "notSetUp") {
|
||||||
root.activeView = "notSetUp";
|
root.activeView = "notSetUp";
|
||||||
} else if (path !== "" && root.activeView !== "checkoutMain") {
|
} else if (root.securityImageResultReceived && root.keyFilePathIfExistsResultReceived && path !== "" && root.activeView === "initialize") {
|
||||||
root.activeView = "checkoutMain";
|
root.activeView = "checkoutMain";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,14 +280,13 @@ Rectangle {
|
||||||
//
|
//
|
||||||
Item {
|
Item {
|
||||||
id: itemDescriptionContainer;
|
id: itemDescriptionContainer;
|
||||||
// Size
|
|
||||||
height: childrenRect.height + 20;
|
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: 32;
|
anchors.leftMargin: 32;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 32;
|
anchors.rightMargin: 32;
|
||||||
anchors.top: titleBarContainer.bottom;
|
anchors.top: parent.top;
|
||||||
|
anchors.bottom: checkoutActionButtonsContainer.top;
|
||||||
|
|
||||||
// HFC Balance text
|
// HFC Balance text
|
||||||
Item {
|
Item {
|
||||||
|
@ -349,8 +352,7 @@ Rectangle {
|
||||||
id: itemNameTextLabel;
|
id: itemNameTextLabel;
|
||||||
text: "Item:";
|
text: "Item:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: hfcBalanceContainer.bottom;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 20;
|
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
width: paintedWidth;
|
width: paintedWidth;
|
||||||
height: paintedHeight;
|
height: paintedHeight;
|
||||||
|
|
|
@ -27,6 +27,8 @@ Rectangle {
|
||||||
id: root;
|
id: root;
|
||||||
property string activeView: "initialize";
|
property string activeView: "initialize";
|
||||||
property string referrerURL: "";
|
property string referrerURL: "";
|
||||||
|
property bool securityImageResultReceived: false;
|
||||||
|
property bool keyFilePathIfExistsResultReceived: false;
|
||||||
property bool punctuationMode: false;
|
property bool punctuationMode: false;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.baseGray;
|
color: hifi.colors.baseGray;
|
||||||
|
@ -34,9 +36,10 @@ Rectangle {
|
||||||
id: commerce;
|
id: commerce;
|
||||||
|
|
||||||
onSecurityImageResult: {
|
onSecurityImageResult: {
|
||||||
|
securityImageResultReceived = true;
|
||||||
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
|
if (!exists && root.activeView !== "notSetUp") { // "If security image is not set up"
|
||||||
root.activeView = "notSetUp";
|
root.activeView = "notSetUp";
|
||||||
} else if (exists && root.activeView !== "purchasesMain") {
|
} else if (root.securityImageResultReceived && exists && root.keyFilePathIfExistsResultReceived && root.activeView === "initialize") {
|
||||||
root.activeView = "purchasesMain";
|
root.activeView = "purchasesMain";
|
||||||
} else if (exists) {
|
} else if (exists) {
|
||||||
// just set the source again (to be sure the change was noticed)
|
// just set the source again (to be sure the change was noticed)
|
||||||
|
@ -46,9 +49,10 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyFilePathIfExistsResult: {
|
onKeyFilePathIfExistsResult: {
|
||||||
|
keyFilePathIfExistsResultReceived = true;
|
||||||
if (path === "" && root.activeView !== "notSetUp") {
|
if (path === "" && root.activeView !== "notSetUp") {
|
||||||
root.activeView = "notSetUp";
|
root.activeView = "notSetUp";
|
||||||
} else if (path !== "" && root.activeView !== "purchasesMain") {
|
} else if (root.securityImageResultReceived && root.keyFilePathIfExistsResultReceived && path !== "" && root.activeView === "initialize") {
|
||||||
root.activeView = "purchasesMain";
|
root.activeView = "purchasesMain";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +142,89 @@ Rectangle {
|
||||||
commerce.getKeyFilePathIfExists();
|
commerce.getKeyFilePathIfExists();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// "WALLET NOT SET UP" START
|
||||||
|
//
|
||||||
|
Item {
|
||||||
|
id: notSetUp;
|
||||||
|
visible: root.activeView === "notSetUp";
|
||||||
|
anchors.top: titleBarContainer.bottom;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: notSetUpText;
|
||||||
|
text: "<b>Your wallet isn't set up.</b><br><br>Set up your Wallet (no credit card necessary) to claim your <b>free HFC</b> " +
|
||||||
|
"and get items from the Marketplace.";
|
||||||
|
// Text size
|
||||||
|
size: 24;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.bottom: notSetUpActionButtonsContainer.top;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.faintGray;
|
||||||
|
wrapMode: Text.WordWrap;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: notSetUpActionButtonsContainer;
|
||||||
|
// Size
|
||||||
|
width: root.width;
|
||||||
|
height: 70;
|
||||||
|
// Anchors
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.bottomMargin: 24;
|
||||||
|
|
||||||
|
// "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: 'purchases_backClicked', referrerURL: referrerURL});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// "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: "Set Up Wallet"
|
||||||
|
onClicked: {
|
||||||
|
sendToScript({method: 'checkout_setUpClicked'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// "WALLET NOT SET UP" END
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// PURCHASES CONTENTS START
|
// PURCHASES CONTENTS START
|
||||||
|
@ -153,7 +240,14 @@ Rectangle {
|
||||||
anchors.top: titleBarContainer.bottom;
|
anchors.top: titleBarContainer.bottom;
|
||||||
anchors.topMargin: 8;
|
anchors.topMargin: 8;
|
||||||
anchors.bottom: actionButtonsContainer.top;
|
anchors.bottom: actionButtonsContainer.top;
|
||||||
anchors.bottomMargin: 8;
|
anchors.bottomMargin: 8;
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
commerce.balance();
|
||||||
|
commerce.inventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FILTER BAR START
|
// FILTER BAR START
|
||||||
|
@ -244,6 +338,7 @@ Rectangle {
|
||||||
//
|
//
|
||||||
Item {
|
Item {
|
||||||
id: actionButtonsContainer;
|
id: actionButtonsContainer;
|
||||||
|
visible: purchasesContentsContainer.visible;
|
||||||
// Size
|
// Size
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: 40;
|
height: 40;
|
||||||
|
@ -305,8 +400,6 @@ Rectangle {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'updatePurchases':
|
case 'updatePurchases':
|
||||||
referrerURL = message.referrerURL;
|
referrerURL = message.referrerURL;
|
||||||
commerce.balance();
|
|
||||||
commerce.inventory();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));
|
console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message));
|
||||||
|
|
|
@ -420,7 +420,7 @@ void Wallet::chooseSecurityImage(const QString& filename) {
|
||||||
}
|
}
|
||||||
// temporary...
|
// temporary...
|
||||||
QString path = qApp->applicationDirPath();
|
QString path = qApp->applicationDirPath();
|
||||||
path.append("/resources/qml/hifi/commerce/");
|
path.append("/resources/qml/hifi/commerce/wallet/");
|
||||||
path.append(filename);
|
path.append(filename);
|
||||||
// now create a new security image pixmap
|
// now create a new security image pixmap
|
||||||
_securityImage = new QPixmap();
|
_securityImage = new QPixmap();
|
||||||
|
|
Loading…
Reference in a new issue