Refactor numpad code, transfer screen

pull/45/head
dsc 3 years ago
parent 8b1250030b
commit bd38e5e1d8

@ -120,6 +120,14 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
if(openVREnabled) { if(openVREnabled) {
#ifdef HAS_OPENVR #ifdef HAS_OPENVR
// @TODO: custom DPI / AA
// QCoreApplication::setAttribute( Qt::AA_UseDesktopOpenGL );
// QCoreApplication::setAttribute( Qt::AA_Use96Dpi );
if(qgetenv("scale") == "1")
QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
if(qgetenv("noscale") == "1")
QCoreApplication::setAttribute( Qt::AA_DisableHighDpiScaling );
QApplication vr_app(argc, argv); QApplication vr_app(argc, argv);
auto *ctx = new AppContext(&parser); auto *ctx = new AppContext(&parser);
auto *vr = new wowletvr::WowletVR(ctx, &parser, &vr_app); auto *vr = new wowletvr::WowletVR(ctx, &parser, &vr_app);

@ -38,7 +38,7 @@ void Prices::cryptoPricesReceived(const QJsonArray &data) {
for(auto &&entry: data) { for(auto &&entry: data) {
marketStruct ms; marketStruct ms;
QJsonObject obj = entry.toObject(); QJsonObject obj = entry.toObject();
ms.symbol = obj.value("symbol").toString(); ms.symbol = obj.value("symbol").toString().toUpper();
ms.image = obj.value("image").toString(); ms.image = obj.value("image").toString();
ms.name = obj.value("name").toString(); ms.name = obj.value("name").toString();
ms.price_usd = obj.value("current_price").toDouble(); ms.price_usd = obj.value("current_price").toDouble();

@ -3,7 +3,7 @@
"fontColor": "white", "fontColor": "white",
"fontColorDimmed": "#cccccc", "fontColorDimmed": "#cccccc",
"fontColorBright": "white", "fontColorBright": "white",
"backgroundGradientStartColor": "#194f64", "backgroundGradientStartColor": "#225d73",
"backgroundGradientStopColor": "#192e43", "backgroundGradientStopColor": "#192e43",
"backgroundColor": "#1b2939", "backgroundColor": "#1b2939",
"divideColor": "50ffffff", "divideColor": "50ffffff",

@ -83,10 +83,6 @@ namespace wowletvr {
qRegisterMetaType<TransactionInfo::Direction>(); qRegisterMetaType<TransactionInfo::Direction>();
qRegisterMetaType<TransactionHistoryModel::TransactionInfoRole>(); qRegisterMetaType<TransactionHistoryModel::TransactionInfoRole>();
// @TODO: custom DPI / AA
// QCoreApplication::setAttribute( Qt::AA_UseDesktopOpenGL );
// QCoreApplication::setAttribute( Qt::AA_Use96Dpi );
if(!desktopMode) { if(!desktopMode) {
if(!openvr_init::initializeOpenVR(openvr_init::OpenVrInitializationType::Overlay)) if(!openvr_init::initializeOpenVR(openvr_init::OpenVrInitializationType::Overlay))
throw std::runtime_error("Error: initializeOpenVR()"); throw std::runtime_error("Error: initializeOpenVR()");

@ -57,12 +57,25 @@ namespace wowletvr {
m_pClipboard->setText(text, QClipboard::Selection); m_pClipboard->setText(text, QClipboard::Selection);
} }
Q_INVOKABLE QString amountToFiat(double amount) { Q_INVOKABLE QString preferredFiat() {
return config()->get(Config::preferredFiatCurrency).toString();
}
Q_INVOKABLE QString fiatToWow(double amount) {
auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString();
if (amount <= 0) return QString("0.00");
double conversionAmount = AppContext::prices->convert(preferredFiatCurrency, "WOW", amount);
return QString("%1").arg(QString::number(conversionAmount, 'f', 2));
}
Q_INVOKABLE QString wowToFiat(double amount) {
auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString();
if (amount <= 0) return QString("0.00 %1").arg(preferredFiatCurrency); if (amount <= 0) return QString("0.00");
double conversionAmount = AppContext::prices->convert("WOW", preferredFiatCurrency, amount); double conversionAmount = AppContext::prices->convert("WOW", preferredFiatCurrency, amount);
return QString("~%1 %2").arg(QString::number(conversionAmount, 'f', 2), preferredFiatCurrency); if(conversionAmount <= 0) return QString("0.00");
return QString("~%1").arg(QString::number(conversionAmount, 'f', 2));
} }
private: private:

@ -22,7 +22,8 @@ Rectangle {
color: "transparent" color: "transparent"
property var themes: {} property var themes: {}
property string theme: "wownero" property string theme: "default"
property string fiatSymbol: "USD"
signal initTheme(); signal initTheme();
// Components that have been dynamically created need to redraw // Components that have been dynamically created need to redraw
@ -309,24 +310,23 @@ Rectangle {
try { try {
appWindow.themes = WowletVR.getThemes(); appWindow.themes = WowletVR.getThemes();
appWindow.theme = WowletVR.getCurrentTheme(); appWindow.theme = WowletVR.getCurrentTheme();
} } catch(err) {
catch(err) {
// for debugging purposes - do not change color codes here, use themes.json instead. // for debugging purposes - do not change color codes here, use themes.json instead.
appWindow.themes = { appWindow.themes = {
"default": { "default": {
"fontColor": "white", "fontColor": "white",
"fontColorDimmed": "#cccccc", "fontColorDimmed": "#cccccc",
"fontColorBright": "#white", "fontColorBright": "white",
"backgroundGradientStartColor": "#194f64", "backgroundGradientStartColor": "#225d73",
"backgroundGradientStopColor": "#192e43", "backgroundGradientStopColor": "#192e43",
}, },
"wownero": { "wownero": {
"fontColor": "#bd93f9", "fontColor": "#bd93f9",
"fontColorDimmed": "#cccccc", "fontColorDimmed": "#cccccc",
"fontColorBright": "#e5d3ff", "fontColorBright": "#e5d3ff",
"backgroundGradientStartColor": "#383a59", "backgroundGradientStartColor": "#383a59",
"backgroundGradientStopColor": "#282a36", "backgroundGradientStopColor": "#282a36",
} }
} }
} }

@ -47,8 +47,8 @@ ColumnLayout {
Layout.leftMargin: 40 Layout.leftMargin: 40
Layout.rightMargin: 40 Layout.rightMargin: 40
Layout.fillWidth: true Layout.fillWidth: true
text: "Greetings: matzman666, qvqc, ez, Gatto, cisme, wowario, lza_menace, jwinterm, nioc, asymptotically, azy, selsta, kico, laura, thrmo, rottensox, solar, bl4sty, scoobybejesus"
fontSize: 14 fontSize: 14
text: "Shoutouts: matzman666, qvqc, ez, Gatto, RAGEHAÜZ, cisme, wowario, lza_menace, jwinterm, nioc, asymptotically, azy, selsta, kico, laura, thrmo, rottensox, solar, bl4sty, scoobybejesus"
wrap: true wrap: true
} }

@ -35,6 +35,7 @@ Rectangle {
StackView { StackView {
id: walletView id: walletView
anchors.fill: parent anchors.fill: parent
initialItem: walletDashboardPage
pushEnter: Transition { pushEnter: Transition {
PropertyAnimation { PropertyAnimation {
@ -72,8 +73,6 @@ Rectangle {
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }
initialItem: walletDashboardPage
} }
function onPageCompleted() { function onPageCompleted() {

@ -6,34 +6,23 @@ import "."
ColumnLayout { ColumnLayout {
id: root id: root
enabled: true enabled: true
spacing: 16
property double disabledOpacity: 0.4 property double disabledOpacity: 0.4
property var code: []; property bool compact: false
signal resolvePressed(); signal resolvePressed();
signal codeUpdated(var pin_code); signal buttonPress(string val);
signal clearPress();
function onButtonPress(val) {
code.push(val);
if(code.length === 5)
code = [val];
codeUpdated(code);
}
function reset() {
root.code = [];
}
RowLayout { RowLayout {
spacing: 20 spacing: 18
MyNumPadButton { MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "1" text: "1"
onClicked: { onClicked: {
onButtonPress("1"); buttonPress("1");
} }
} }
@ -41,7 +30,7 @@ ColumnLayout {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "2" text: "2"
onClicked: { onClicked: {
onButtonPress("2"); buttonPress("2");
} }
} }
@ -49,19 +38,19 @@ ColumnLayout {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "3" text: "3"
onClicked: { onClicked: {
onButtonPress("3"); buttonPress("3");
} }
} }
} }
RowLayout { RowLayout {
spacing: 20 spacing: 18
MyNumPadButton { MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "4" text: "4"
onClicked: { onClicked: {
onButtonPress("4"); buttonPress("4");
} }
} }
@ -69,7 +58,7 @@ ColumnLayout {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "5" text: "5"
onClicked: { onClicked: {
onButtonPress("5"); buttonPress("5");
} }
} }
@ -77,19 +66,19 @@ ColumnLayout {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "6" text: "6"
onClicked: { onClicked: {
onButtonPress("6"); buttonPress("6");
} }
} }
} }
RowLayout { RowLayout {
spacing: 20 spacing: 18
MyNumPadButton { MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "7" text: "7"
onClicked: { onClicked: {
onButtonPress("7"); buttonPress("7");
} }
} }
@ -97,7 +86,7 @@ ColumnLayout {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "8" text: "8"
onClicked: { onClicked: {
onButtonPress("8"); buttonPress("8");
} }
} }
@ -105,32 +94,44 @@ ColumnLayout {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "9" text: "9"
onClicked: { onClicked: {
onButtonPress("9"); buttonPress("9");
} }
} }
} }
RowLayout { RowLayout {
spacing: 20 spacing: 18
MyNumPadButton { MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
text: "0" text: "0"
onClicked: { onClicked: {
onButtonPress("0"); buttonPress("0");
}
}
MyNumPadButton {
visible: root.compact
opacity: root.enabled ? 1 : disabledOpacity
text: "."
onClicked: {
buttonPress(".");
} }
} }
MyNumPadButton { MyNumPadButton {
opacity: root.enabled ? 1 : disabledOpacity opacity: root.enabled ? 1 : disabledOpacity
Layout.preferredWidth: 204 Layout.preferredWidth: root.compact ? 106 : 230
fontSize: 16 fontSize: 16
text: "Clear" text: root.compact ? "C" : "Clear"
onClicked: { onClicked: {
root.code = [0,0,0,0]; clearPress();
root.codeUpdated(root.code);
} }
} }
} }
function reset() {
}
} }

@ -11,8 +11,8 @@ Rectangle {
signal clicked; signal clicked;
Layout.preferredWidth: 92 Layout.preferredWidth: 106
Layout.preferredHeight: 92 Layout.preferredHeight: 106
color: Style.btnExitedColor color: Style.btnExitedColor
MyText { MyText {

@ -128,7 +128,6 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: mainLayout id: mainLayout
spacing: 12
anchors.fill: parent anchors.fill: parent
} }
@ -147,7 +146,7 @@ Rectangle {
anchors.leftMargin: 40 anchors.leftMargin: 40
anchors.rightMargin: 40 anchors.rightMargin: 40
color: Style.fontColorDimmed color: Style.dividerColor
height: 1 height: 1
} }
@ -169,7 +168,7 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
color: Style.fontColorDimmed color: Style.dividerColor
} }
RowLayout { RowLayout {
@ -204,7 +203,7 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
color: Style.fontColorDimmed color: Style.dividerColor
} }
RowLayout { RowLayout {
@ -228,12 +227,21 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
color: Style.fontColorDimmed color: Style.dividerColor
} }
MyText { MyText {
fontSize: 14 fontSize: 14
text: "Balance: " + WowletVR.amountToFiat(appWindow.spendable); text: {
let rtn = "Balance: ";
try {
rtn += WowletVR.wowToFiat(appWindow.spendable);
} catch(err) {
rtn += "ERROR";
}
return rtn + " " + appWindow.fiatSymbol
}
color: Style.fontColorDimmed color: Style.fontColorDimmed
} }
} }
@ -251,7 +259,7 @@ Rectangle {
content.Layout.topMargin = 10 content.Layout.topMargin = 10
content.Layout.leftMargin = 40 content.Layout.leftMargin = 40
content.Layout.rightMargin = 40 content.Layout.rightMargin = 40
content.Layout.bottomMargin = 40 content.Layout.bottomMargin = 10
bigRect.parent = mainLayout bigRect.parent = mainLayout
} }

@ -95,5 +95,10 @@ MyStackViewPage {
function onPageCompleted() { function onPageCompleted() {
historyView.onPageCompleted(); historyView.onPageCompleted();
try {
appWindow.fiatSymbol = WowletVR.preferredFiat();
} catch(err) {
}
} }
} }

@ -8,6 +8,7 @@ import "."
MyStackViewPage { MyStackViewPage {
id: sendStateController id: sendStateController
height: 800
width: 1600 width: 1600
headerText: "Send" headerText: "Send"
@ -32,9 +33,6 @@ MyStackViewPage {
} }
} }
// if(previousView !== null && currentView.viewName === "wizardHome")
// wizardController.restart();
if (currentView) { if (currentView) {
sendStack.replace(currentView) sendStack.replace(currentView)
// Calls when view is opened // Calls when view is opened
@ -44,10 +42,6 @@ MyStackViewPage {
} }
previousView = currentView; previousView = currentView;
// reset push direction
// if(wizardController.wizardState == "wizardHome")
// wizardController.wizardStackView.backTransition = false;
} }
states: [ states: [
@ -105,6 +99,7 @@ MyStackViewPage {
onBackClicked: { onBackClicked: {
// top back button to send/receive menu, reset default states for sendViews // top back button to send/receive menu, reset default states for sendViews
sendStateView.pinPage.onPageCompleted(); sendStateView.pinPage.onPageCompleted();
sendStateView.qrPage.onPageCompleted();
sendStateView.dashPage.onPageCompleted(); sendStateView.dashPage.onPageCompleted();
sendStateView.transferPage.onPageCompleted(); sendStateView.transferPage.onPageCompleted();
} }

@ -9,7 +9,7 @@ ColumnLayout {
id: root id: root
Layout.fillWidth: true Layout.fillWidth: true
property string _PINLookup: "" property string pin: ""
MyText { MyText {
Layout.fillWidth: true Layout.fillWidth: true
@ -29,25 +29,11 @@ ColumnLayout {
MyNumPad { MyNumPad {
id: numPad id: numPad
onCodeUpdated: { onButtonPress: {
let codeFmt = ""; root.pin += val;
if(root.pin.length === 4 && root.pin !== "0000") {
for(var i = 0; i != 4; i++) { return addressLookup();
if(pin_code[i] !== undefined) {
codeFmt += pin_code[i] + " ";
} else {
codeFmt += ". ";
}
} }
// update display thingy
codeDisplay.text = codeFmt;
// lol Qt
codeFmt = codeFmt.replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "").replace(" ", "").trim();
if(pin_code.length === 4 && codeFmt != "0000")
addressLookup(codeFmt);
} }
} }
@ -66,7 +52,7 @@ ColumnLayout {
id: codeDisplay id: codeDisplay
Layout.preferredWidth: 390 Layout.preferredWidth: 390
visible: true visible: true
text: "0 0 0 0" text: (root.pin[0] || ".") + " " + (root.pin[1] || ".") + " " + (root.pin[2] || ".") + " " + (root.pin[3] || ".");
color: Style.fontColor color: Style.fontColor
font.bold: true font.bold: true
font.pointSize: 40 font.pointSize: 40
@ -136,7 +122,7 @@ ColumnLayout {
} }
MyText { MyText {
text: _PINLookup text: root.pin
} }
} }
} }
@ -148,18 +134,18 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
} }
function addressLookup(code) { function addressLookup() {
if(_PINLookup !== "") console.log("addressLookup()");
return;
_PINLookup = code;
idleContainer.visible = false; idleContainer.visible = false;
loadingContainer.visible = true; loadingContainer.visible = true;
numPad.enabled = false; numPad.enabled = false;
ctx.onLookupReceivingPIN(code); try {
ctx.onLookupReceivingPIN(root.pin);
} catch(err){
console.log("ctx.onLookupReceivingPIN() ignored")
}
} }
function onPageCompleted(previousView) { function onPageCompleted(previousView) {
@ -167,8 +153,9 @@ ColumnLayout {
} }
function reset() { function reset() {
console.log("SendPagePin reset()");
// reset state // reset state
_PINLookup = ""; root.pin = "";
idleContainer.visible = true; idleContainer.visible = true;
loadingContainer.visible = false; loadingContainer.visible = false;
@ -176,8 +163,6 @@ ColumnLayout {
numPad.enabled = true; numPad.enabled = true;
numPad.reset(); numPad.reset();
codeDisplay.text = "0 0 0 0";
} }
Connections { Connections {
@ -186,7 +171,7 @@ ColumnLayout {
function onPinLookupReceived(address, pin) { function onPinLookupReceived(address, pin) {
console.log("onPinLookupReceived", address); console.log("onPinLookupReceived", address);
if(pin === _PINLookup) { if(pin === root.pin) {
sendStateController.destinationAddress = address; sendStateController.destinationAddress = address;
sendStateView.state = "transferPage"; sendStateView.state = "transferPage";
} else { } else {

@ -42,7 +42,11 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
} }
function onPageCompleted(previousView){ function reset() {
}
function onPageCompleted(previousView){
reset();
} }
} }

@ -9,7 +9,8 @@ ColumnLayout {
spacing: 30 spacing: 30
property string txDialogText: "" property string txDialogText: ""
property double amount: 0.0 property string amount: ""
property string amount_type: "wow"
property bool canSend: false property bool canSend: false
Layout.fillWidth: true Layout.fillWidth: true
@ -21,37 +22,85 @@ ColumnLayout {
text: "How much would you like to send?" text: "How much would you like to send?"
} }
MyNumPadSendAmount { function count(input, needle) {
id: myNumPadSendAmount return input.split(".").length - 1;
Layout.fillWidth: true
Layout.preferredHeight: 112
Layout.maximumHeight: 112
onAmountUpdated: {
root.amount = amount;
fiatText.text = WowletVR.amountToFiat(root.amount);
// @TODO: tx validation here
if(root.amount <= 0) {
root.canSend = false;
} else if(root.amount > appWindow.spendable) {
root.canSend = false;
} else {
root.canSend = true;
}
}
} }
RowLayout { RowLayout {
spacing: 30 spacing: 40
Layout.topMargin: 20
Layout.fillHeight: true ColumnLayout {
Layout.fillWidth: true Layout.preferredWidth: 320
Layout.preferredHeight: 400
MyNumPad {
id: numPad
compact: true
onButtonPress: {
let periods = count(root.amount, ".");
if(periods == 1 && val === ".") return;
if(root.amount === "" && val === ".") return;
if(root.amount.length > 7) return;
root.amount += val;
}
onClearPress: {
root.amount = "";
}
}
Rectangle {
Layout.fillHeight: true
Layout.preferredWidth: parent.Layout.preferredWidth
color: "transparent"
}
}
ColumnLayout {
spacing: 14
Layout.fillHeight: true
Layout.preferredWidth: 280
MyPushButton {
id: wowButton
opacity: enabled ? 1.0 : 0.4
enabled: root.amount_type === "fiat"
Layout.preferredWidth: 280
Layout.preferredHeight: 108
text: "Wownero"
onClicked: {
root.amount_type = "wow"
}
}
MyPushButton {
id: fiatBtn
opacity: enabled ? 1.0 : 0.4
enabled: root.amount_type === "wow"
Layout.preferredWidth: 280
Layout.preferredHeight: 108
text: "Fiat"
onClicked: {
root.amount_type = "fiat"
}
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
}
ColumnLayout { ColumnLayout {
spacing: 10 spacing: 10
Layout.fillHeight: true Layout.fillHeight: true
Layout.maximumWidth: parent.width / 2
RowLayout { RowLayout {
spacing: 30 spacing: 30
@ -78,7 +127,21 @@ ColumnLayout {
MyText { MyText {
fontSize: 24 fontSize: 24
fontColor: Style.fontColorBright fontColor: Style.fontColorBright
text: root.amount + " WOW" text: {
let rtn = "";
if(root.amount === "") rtn += "0.0"
else if(root.amount_type === "wow") {
rtn += root.amount;
} else {
try {
rtn += WowletVR.fiatToWow(root.amount);
} catch(err) {
return "ERROR";
}
}
return rtn + " WOW";
}
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
} }
@ -111,7 +174,21 @@ ColumnLayout {
id: fiatText id: fiatText
fontSize: 18 fontSize: 18
fontColor: Style.fontColorBright fontColor: Style.fontColorBright
text: "$0.00 USD" text: {
let rtn = "";
if(root.amount === "") rtn += "0.0"
else if(root.amount_type === "fiat") {
rtn += root.amount;
} else {
try {
rtn += WowletVR.wowToFiat(root.amount);
} catch(err) {
return "ERROR";
}
}
return rtn + " " + appWindow.fiatSymbol
}
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
} }
@ -153,133 +230,49 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }
}
Rectangle {
color: "transparent"
Layout.fillWidth: true
Layout.fillHeight: true
}
}
RowLayout { MyPushButton {
Layout.preferredWidth: parent.width id: sendButton
Layout.preferredHeight: 128
MyPushButton {
id: keyboardButton
Layout.preferredWidth: 700
text: "Enter amount via virtual keyboard"
onClicked: {
OverlayController.showKeyboard(text, 1337)
}
}
MyPushButton {
id: sendButton
opacity: root.canSend ? 1.0 : 0.5
enabled: root.canSend
Layout.preferredWidth: 420 Layout.preferredWidth: 420
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: "Create transaction" text: "Create transaction"
onClicked: { onClicked: {
WowletVR.onCreateTransaction(destinationAddress, root.amount, "", false); // no description if(amount === "") return;
sendButton.enabled = false;
}
}
}
Item { let _amount = parseFloat(amount);
Layout.fillWidth: true if(root.amount_type == "fiat") {
Layout.fillHeight: true try {
} _amount = WowletVR.fiatToWow(_amount);
} catch(err) {
messagePopup.showMessage("Error", "Could not convert fiat to wow.");
return;
}
}
Connections { if(amount <= 0) {
target: OverlayController messagePopup.showMessage("Error", "Amount was zero.");
return;
}
function onKeyBoardInputSignal(input, userValue) { WowletVR.onCreateTransaction(destinationAddress, _amount.toString(), "", false); // no description
if (userValue == 1337) { sendButton.enabled = false;
let val = parseFloat(input); }
if(val >= 0)
myNumPadSendAmount.onAmountUpdated(val);
} }
} }
} }
Connections { function onPageCompleted() {
target: ctx root.amount = "";
root.amount_type = "wow";
function onInitiateTransaction() { root.txDialogText = "";
console.log("transactionStarted");
mainView.opacity = 0.4;
mainView.enabled = false;
root.canSend = false;
root.txDialogText = "Busy creating transaction. Hold on tight!";
waitPopup.open();
}
function onCreateTransactionError(message) { // str
console.log("onCreateTransactionError", message);
waitPopup.close();
mainView.opacity = 1.0;
mainView.enabled = true;
root.canSend = true;
root.txDialogText = "";
messagePopup.showMessage("Error creating tx", message);
}
function onCreateTransactionSuccess(tx, address) { // PendingTransaction
console.log("onCreateTransactionSuccess", address)
root.txDialogText = "Submitting transaction to the Wownero network.";
}
function onTransactionCommitted(status, tx, txid) { // bool,PendingTransaction,stringlist
console.log("onTransactionCommitted", status);
waitPopup.close();
mainView.opacity = 1.0;
mainView.enabled = true;
root.canSend = true;
root.txDialogText = "";
walletView.pop();
}
} }
function onPageCompleted(previousView){ Item {
Layout.fillWidth: true
} Layout.fillHeight: true
Popup {
id: waitPopup
implicitHeight: 100
implicitWidth: 1200
x: (parent.width - width) / 2
y: (parent.height - height) / 2
ColumnLayout {
anchors.fill: parent
MyText {
Layout.alignment: Qt.AlignHCenter
fontColor: Style.fontColor
text: root.txDialogText
}
}
background: Rectangle {
color: "black"
opacity: 0.8
}
} }
Component.onCompleted: { Component.onCompleted: {

Loading…
Cancel
Save