mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Checkpoint
This commit is contained in:
parent
db16035f26
commit
f1da7a6381
9 changed files with 105 additions and 24 deletions
|
@ -27,6 +27,20 @@ Item {
|
|||
|
||||
Hifi.QmlCommerce {
|
||||
id: commerce;
|
||||
|
||||
onSecurityImageResult: {
|
||||
if (imageID !== 0) { // "If security image is set up"
|
||||
var path = securityImageModel.getImagePathFromImageID(imageID);
|
||||
topSecurityImage.source = path;
|
||||
changeSecurityImageImage.source = path;
|
||||
}
|
||||
}
|
||||
|
||||
onKeyFilePathResult: {
|
||||
if (path !== "") {
|
||||
keyFilePath.text = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Username Text
|
||||
|
@ -62,6 +76,12 @@ Item {
|
|||
width: height;
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
mipmap: true;
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
commerce.getSecurityImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
// "Security picture" text below pic
|
||||
RalewayRegular {
|
||||
|
@ -199,15 +219,15 @@ Item {
|
|||
|
||||
// Text below "your private keys"
|
||||
RalewayRegular {
|
||||
id: explanitoryText;
|
||||
text: "Your money and purchases are secured with private keys that only you " +
|
||||
"have access to. <b>If they are lost, you will not be able to access your money or purchases.</b> " +
|
||||
"To ensure they are not lost, it is imperative that you back up your private keys.<br><br>" +
|
||||
"<b>To safeguard your private keys, back up this file regularly:</b>";
|
||||
"have access to. <b>If they are lost, you will not be able to access your money or purchases." +
|
||||
"To safeguard your private keys, back up this file regularly:</b>";
|
||||
// Text size
|
||||
size: 18;
|
||||
// Anchors
|
||||
anchors.top: yourPrivateKeysText.bottom;
|
||||
anchors.topMargin: 20;
|
||||
anchors.topMargin: 10;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
height: paintedHeight;
|
||||
|
@ -218,15 +238,26 @@ Item {
|
|||
horizontalAlignment: Text.AlignLeft;
|
||||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
HifiControlsUit.TextField {
|
||||
id: keyFilePath;
|
||||
anchors.top: explanitoryText.bottom;
|
||||
anchors.topMargin: 10;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
height: 40;
|
||||
readOnly: true;
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
commerce.getKeyFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION DEFINITIONS START
|
||||
//
|
||||
function setSecurityImages(imagePath) {
|
||||
topSecurityImage.source = imagePath;
|
||||
changeSecurityImageImage.source = imagePath;
|
||||
}
|
||||
//
|
||||
// Function Name: fromScript()
|
||||
//
|
||||
|
|
|
@ -25,7 +25,7 @@ Rectangle {
|
|||
|
||||
id: root;
|
||||
|
||||
property string activeView: "notSetUp";
|
||||
property string activeView: "";
|
||||
|
||||
// Style
|
||||
color: hifi.colors.baseGray;
|
||||
|
@ -33,19 +33,20 @@ Rectangle {
|
|||
id: commerce;
|
||||
|
||||
onSecurityImageResult: {
|
||||
if (imageID !== 0) { // "If security image is set up"
|
||||
if (walletHome) {
|
||||
walletHome.setSecurityImage(securityImageModel.getImagePathFromImageID(imageID));
|
||||
}
|
||||
if (security) {
|
||||
security.setSecurityImages(securityImageModel.getImagePathFromImageID(imageID));
|
||||
}
|
||||
} else if (root.lastPage === "securityImage") {
|
||||
if (imageID === 0 && root.lastPage === "securityImage") { // "If security image is set up"
|
||||
// ERROR! Invalid security image.
|
||||
securityImageContainer.visible = true;
|
||||
choosePassphraseContainer.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
onKeyFilePathResult: {
|
||||
if (path === "") {
|
||||
root.activeView = "notSetUp";
|
||||
} else {
|
||||
root.activeView = "walletHome";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SecurityImageModel {
|
||||
|
@ -284,6 +285,13 @@ Rectangle {
|
|||
onEntered: parent.color = hifi.colors.blueHighlight;
|
||||
onExited: parent.color = root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
commerce.getSecurityImage();
|
||||
commerce.balance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "SEND MONEY" tab button
|
||||
|
@ -376,6 +384,13 @@ Rectangle {
|
|||
onEntered: parent.color = hifi.colors.blueHighlight;
|
||||
onExited: parent.color = root.activeView === "security" ? hifi.colors.blueAccent : hifi.colors.black;
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
commerce.getSecurityImage();
|
||||
commerce.getKeyFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "HELP" tab button
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//
|
||||
// AccountHome.qml
|
||||
// WalletHome.qml
|
||||
// qml/hifi/commerce/wallet
|
||||
//
|
||||
// AccountHome
|
||||
// WalletHome
|
||||
//
|
||||
// Created by Zach Fox on 2017-08-18
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
|
@ -22,11 +22,18 @@ import "../../../controls" as HifiControls
|
|||
|
||||
Item {
|
||||
HifiConstants { id: hifi; }
|
||||
|
||||
|
||||
id: root;
|
||||
|
||||
Hifi.QmlCommerce {
|
||||
id: commerce;
|
||||
|
||||
onSecurityImageResult: {
|
||||
if (imageID !== 0) { // "If security image is set up"
|
||||
securityImage.source = securityImageModel.getImagePathFromImageID(imageID);
|
||||
}
|
||||
}
|
||||
|
||||
onBalanceResult : {
|
||||
balanceText.text = parseFloat(result.data.balance/100).toFixed(2);
|
||||
}
|
||||
|
@ -99,6 +106,7 @@ Item {
|
|||
// Balance Text
|
||||
FiraSansRegular {
|
||||
id: balanceText;
|
||||
text: --;
|
||||
// Text size
|
||||
size: 28;
|
||||
// Anchors
|
||||
|
@ -308,9 +316,6 @@ Item {
|
|||
//
|
||||
// FUNCTION DEFINITIONS START
|
||||
//
|
||||
function setSecurityImage(imagePath) {
|
||||
securityImage.source = imagePath;
|
||||
}
|
||||
//
|
||||
// Function Name: fromScript()
|
||||
//
|
||||
|
|
|
@ -55,6 +55,12 @@ Rectangle {
|
|||
choosePassphraseContainer.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
onKeyFilePathResult: {
|
||||
if (path !== "") {
|
||||
keyFilePath.text = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -452,6 +458,7 @@ Rectangle {
|
|||
choosePassphraseContainer.visible = false;
|
||||
privateKeysReadyContainer.visible = true;
|
||||
commerce.balance(); // Do this here so that keys are generated. Order might change as backend changes?
|
||||
commerce.getKeyFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -520,6 +527,7 @@ Rectangle {
|
|||
|
||||
// Text below checkbox
|
||||
RalewayRegular {
|
||||
id: explanationText;
|
||||
text: "Your money and purchases are secured with private keys that only you have access to. " +
|
||||
"<b>If they are lost, you will not be able to access your money or purchases.</b><br><br>" +
|
||||
"<b>To protect your privacy, High Fidelity has no access to your private keys and cannot " +
|
||||
|
@ -542,6 +550,16 @@ Rectangle {
|
|||
verticalAlignment: Text.AlignVCenter;
|
||||
}
|
||||
|
||||
HifiControlsUit.TextField {
|
||||
id: keyFilePath;
|
||||
anchors.top: explanationText.bottom;
|
||||
anchors.topMargin: 10;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
height: 40;
|
||||
readOnly: true;
|
||||
}
|
||||
|
||||
// Navigation Bar
|
||||
Item {
|
||||
// Size
|
||||
|
|
|
@ -25,6 +25,7 @@ QmlCommerce::QmlCommerce(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
|||
connect(ledger.data(), &Ledger::balanceResult, this, &QmlCommerce::balanceResult);
|
||||
connect(ledger.data(), &Ledger::inventoryResult, this, &QmlCommerce::inventoryResult);
|
||||
connect(wallet.data(), &Wallet::securityImageResult, this, &QmlCommerce::securityImageResult);
|
||||
connect(wallet.data(), &Wallet::keyFilePathResult, this, &QmlCommerce::keyFilePathResult);
|
||||
}
|
||||
|
||||
void QmlCommerce::buy(const QString& assetId, int cost, const QString& buyerUsername) {
|
||||
|
@ -68,3 +69,7 @@ void QmlCommerce::setPassphrase(const QString& passphrase) {
|
|||
void QmlCommerce::getPassphraseSetupStatus() {
|
||||
emit passphraseSetupStatusResult(false);
|
||||
}
|
||||
void QmlCommerce::getKeyFilePath() {
|
||||
auto wallet = DependencyManager::get<Wallet>();
|
||||
wallet->getKeyFilePath();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ signals:
|
|||
void securityImageResult(uint imageID);
|
||||
void loginStatusResult(bool isLoggedIn);
|
||||
void passphraseSetupStatusResult(bool passphraseIsSetup);
|
||||
void keyFilePathResult(const QString& path);
|
||||
|
||||
protected:
|
||||
Q_INVOKABLE void buy(const QString& assetId, int cost, const QString& buyerUsername = "");
|
||||
|
@ -44,6 +45,7 @@ protected:
|
|||
Q_INVOKABLE void getLoginStatus();
|
||||
Q_INVOKABLE void setPassphrase(const QString& passphrase);
|
||||
Q_INVOKABLE void getPassphraseSetupStatus();
|
||||
Q_INVOKABLE void getKeyFilePath();
|
||||
};
|
||||
|
||||
#endif // hifi_QmlCommerce_h
|
||||
|
|
|
@ -275,3 +275,6 @@ void Wallet::chooseSecurityImage(uint imageID) {
|
|||
void Wallet::getSecurityImage() {
|
||||
emit securityImageResult(_chosenSecurityImage);
|
||||
}
|
||||
void Wallet::getKeyFilePath() {
|
||||
emit keyFilePathResult(keyFilePath());
|
||||
}
|
||||
|
|
|
@ -28,9 +28,11 @@ public:
|
|||
QString signWithKey(const QByteArray& text, const QString& key);
|
||||
void chooseSecurityImage(uint imageID);
|
||||
void getSecurityImage();
|
||||
void getKeyFilePath();
|
||||
|
||||
signals:
|
||||
void securityImageResult(uint imageID);
|
||||
void keyFilePathResult(const QString& path);
|
||||
|
||||
protected:
|
||||
// ALWAYS add SecurityImage enum values to the END of the enum.
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
itemId: id,
|
||||
itemName: name,
|
||||
itemAuthor: author,
|
||||
itemPrice: price ? parseInt(price, 10) : Math.round(Math.random() * 50),
|
||||
itemPrice: price ? parseInt(price, 10) : 0,
|
||||
itemHref: href
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue