mirror of
https://git.wownero.com/wowlet/wowlet.git
synced 2024-08-15 01:03:14 +00:00
Refactor numpad code, transfer screen
This commit is contained in:
parent
8b1250030b
commit
bd38e5e1d8
16 changed files with 259 additions and 252 deletions
|
@ -120,6 +120,14 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
|||
|
||||
if(openVREnabled) {
|
||||
#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);
|
||||
auto *ctx = new AppContext(&parser);
|
||||
auto *vr = new wowletvr::WowletVR(ctx, &parser, &vr_app);
|
||||
|
|
|
@ -38,7 +38,7 @@ void Prices::cryptoPricesReceived(const QJsonArray &data) {
|
|||
for(auto &&entry: data) {
|
||||
marketStruct ms;
|
||||
QJsonObject obj = entry.toObject();
|
||||
ms.symbol = obj.value("symbol").toString();
|
||||
ms.symbol = obj.value("symbol").toString().toUpper();
|
||||
ms.image = obj.value("image").toString();
|
||||
ms.name = obj.value("name").toString();
|
||||
ms.price_usd = obj.value("current_price").toDouble();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"fontColor": "white",
|
||||
"fontColorDimmed": "#cccccc",
|
||||
"fontColorBright": "white",
|
||||
"backgroundGradientStartColor": "#194f64",
|
||||
"backgroundGradientStartColor": "#225d73",
|
||||
"backgroundGradientStopColor": "#192e43",
|
||||
"backgroundColor": "#1b2939",
|
||||
"divideColor": "50ffffff",
|
||||
|
|
|
@ -83,10 +83,6 @@ namespace wowletvr {
|
|||
qRegisterMetaType<TransactionInfo::Direction>();
|
||||
qRegisterMetaType<TransactionHistoryModel::TransactionInfoRole>();
|
||||
|
||||
// @TODO: custom DPI / AA
|
||||
// QCoreApplication::setAttribute( Qt::AA_UseDesktopOpenGL );
|
||||
// QCoreApplication::setAttribute( Qt::AA_Use96Dpi );
|
||||
|
||||
if(!desktopMode) {
|
||||
if(!openvr_init::initializeOpenVR(openvr_init::OpenVrInitializationType::Overlay))
|
||||
throw std::runtime_error("Error: initializeOpenVR()");
|
||||
|
|
|
@ -57,12 +57,25 @@ namespace wowletvr {
|
|||
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 %1").arg(preferredFiatCurrency);
|
||||
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();
|
||||
if (amount <= 0) return QString("0.00");
|
||||
|
||||
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:
|
||||
|
|
|
@ -22,7 +22,8 @@ Rectangle {
|
|||
color: "transparent"
|
||||
|
||||
property var themes: {}
|
||||
property string theme: "wownero"
|
||||
property string theme: "default"
|
||||
property string fiatSymbol: "USD"
|
||||
signal initTheme();
|
||||
|
||||
// Components that have been dynamically created need to redraw
|
||||
|
@ -309,15 +310,14 @@ Rectangle {
|
|||
try {
|
||||
appWindow.themes = WowletVR.getThemes();
|
||||
appWindow.theme = WowletVR.getCurrentTheme();
|
||||
}
|
||||
catch(err) {
|
||||
} catch(err) {
|
||||
// for debugging purposes - do not change color codes here, use themes.json instead.
|
||||
appWindow.themes = {
|
||||
"default": {
|
||||
"fontColor": "white",
|
||||
"fontColorDimmed": "#cccccc",
|
||||
"fontColorBright": "#white",
|
||||
"backgroundGradientStartColor": "#194f64",
|
||||
"fontColorBright": "white",
|
||||
"backgroundGradientStartColor": "#225d73",
|
||||
"backgroundGradientStopColor": "#192e43",
|
||||
},
|
||||
"wownero": {
|
||||
|
|
|
@ -47,8 +47,8 @@ ColumnLayout {
|
|||
Layout.leftMargin: 40
|
||||
Layout.rightMargin: 40
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ Rectangle {
|
|||
StackView {
|
||||
id: walletView
|
||||
anchors.fill: parent
|
||||
initialItem: walletDashboardPage
|
||||
|
||||
pushEnter: Transition {
|
||||
PropertyAnimation {
|
||||
|
@ -72,8 +73,6 @@ Rectangle {
|
|||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
initialItem: walletDashboardPage
|
||||
}
|
||||
|
||||
function onPageCompleted() {
|
||||
|
|
|
@ -6,34 +6,23 @@ import "."
|
|||
ColumnLayout {
|
||||
id: root
|
||||
enabled: true
|
||||
spacing: 16
|
||||
|
||||
property double disabledOpacity: 0.4
|
||||
property var code: [];
|
||||
property bool compact: false
|
||||
|
||||
signal resolvePressed();
|
||||
signal codeUpdated(var pin_code);
|
||||
|
||||
function onButtonPress(val) {
|
||||
code.push(val);
|
||||
|
||||
if(code.length === 5)
|
||||
code = [val];
|
||||
|
||||
codeUpdated(code);
|
||||
}
|
||||
|
||||
function reset() {
|
||||
root.code = [];
|
||||
}
|
||||
signal buttonPress(string val);
|
||||
signal clearPress();
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
spacing: 18
|
||||
|
||||
MyNumPadButton {
|
||||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "1"
|
||||
onClicked: {
|
||||
onButtonPress("1");
|
||||
buttonPress("1");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +30,7 @@ ColumnLayout {
|
|||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "2"
|
||||
onClicked: {
|
||||
onButtonPress("2");
|
||||
buttonPress("2");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,19 +38,19 @@ ColumnLayout {
|
|||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "3"
|
||||
onClicked: {
|
||||
onButtonPress("3");
|
||||
buttonPress("3");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
spacing: 18
|
||||
|
||||
MyNumPadButton {
|
||||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "4"
|
||||
onClicked: {
|
||||
onButtonPress("4");
|
||||
buttonPress("4");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +58,7 @@ ColumnLayout {
|
|||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "5"
|
||||
onClicked: {
|
||||
onButtonPress("5");
|
||||
buttonPress("5");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,19 +66,19 @@ ColumnLayout {
|
|||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "6"
|
||||
onClicked: {
|
||||
onButtonPress("6");
|
||||
buttonPress("6");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
spacing: 18
|
||||
|
||||
MyNumPadButton {
|
||||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "7"
|
||||
onClicked: {
|
||||
onButtonPress("7");
|
||||
buttonPress("7");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +86,7 @@ ColumnLayout {
|
|||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "8"
|
||||
onClicked: {
|
||||
onButtonPress("8");
|
||||
buttonPress("8");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,32 +94,44 @@ ColumnLayout {
|
|||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "9"
|
||||
onClicked: {
|
||||
onButtonPress("9");
|
||||
buttonPress("9");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
spacing: 18
|
||||
|
||||
MyNumPadButton {
|
||||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "0"
|
||||
onClicked: {
|
||||
onButtonPress("0");
|
||||
buttonPress("0");
|
||||
}
|
||||
}
|
||||
|
||||
MyNumPadButton {
|
||||
visible: root.compact
|
||||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
text: "."
|
||||
onClicked: {
|
||||
buttonPress(".");
|
||||
}
|
||||
}
|
||||
|
||||
MyNumPadButton {
|
||||
opacity: root.enabled ? 1 : disabledOpacity
|
||||
|
||||
Layout.preferredWidth: 204
|
||||
Layout.preferredWidth: root.compact ? 106 : 230
|
||||
fontSize: 16
|
||||
text: "Clear"
|
||||
text: root.compact ? "C" : "Clear"
|
||||
onClicked: {
|
||||
root.code = [0,0,0,0];
|
||||
root.codeUpdated(root.code);
|
||||
clearPress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ Rectangle {
|
|||
|
||||
signal clicked;
|
||||
|
||||
Layout.preferredWidth: 92
|
||||
Layout.preferredHeight: 92
|
||||
Layout.preferredWidth: 106
|
||||
Layout.preferredHeight: 106
|
||||
color: Style.btnExitedColor
|
||||
|
||||
MyText {
|
||||
|
|
|
@ -128,7 +128,6 @@ Rectangle {
|
|||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
spacing: 12
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,7 @@ Rectangle {
|
|||
anchors.leftMargin: 40
|
||||
anchors.rightMargin: 40
|
||||
|
||||
color: Style.fontColorDimmed
|
||||
color: Style.dividerColor
|
||||
height: 1
|
||||
}
|
||||
|
||||
|
@ -169,7 +168,7 @@ Rectangle {
|
|||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 1
|
||||
color: Style.fontColorDimmed
|
||||
color: Style.dividerColor
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
@ -204,7 +203,7 @@ Rectangle {
|
|||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 1
|
||||
color: Style.fontColorDimmed
|
||||
color: Style.dividerColor
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
@ -228,12 +227,21 @@ Rectangle {
|
|||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 1
|
||||
color: Style.fontColorDimmed
|
||||
color: Style.dividerColor
|
||||
}
|
||||
|
||||
MyText {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +259,7 @@ Rectangle {
|
|||
content.Layout.topMargin = 10
|
||||
content.Layout.leftMargin = 40
|
||||
content.Layout.rightMargin = 40
|
||||
content.Layout.bottomMargin = 40
|
||||
content.Layout.bottomMargin = 10
|
||||
|
||||
bigRect.parent = mainLayout
|
||||
}
|
||||
|
|
|
@ -95,5 +95,10 @@ MyStackViewPage {
|
|||
|
||||
function onPageCompleted() {
|
||||
historyView.onPageCompleted();
|
||||
try {
|
||||
appWindow.fiatSymbol = WowletVR.preferredFiat();
|
||||
} catch(err) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import "."
|
|||
|
||||
MyStackViewPage {
|
||||
id: sendStateController
|
||||
height: 800
|
||||
width: 1600
|
||||
headerText: "Send"
|
||||
|
||||
|
@ -32,9 +33,6 @@ MyStackViewPage {
|
|||
}
|
||||
}
|
||||
|
||||
// if(previousView !== null && currentView.viewName === "wizardHome")
|
||||
// wizardController.restart();
|
||||
|
||||
if (currentView) {
|
||||
sendStack.replace(currentView)
|
||||
// Calls when view is opened
|
||||
|
@ -44,10 +42,6 @@ MyStackViewPage {
|
|||
}
|
||||
|
||||
previousView = currentView;
|
||||
|
||||
// reset push direction
|
||||
// if(wizardController.wizardState == "wizardHome")
|
||||
// wizardController.wizardStackView.backTransition = false;
|
||||
}
|
||||
|
||||
states: [
|
||||
|
@ -105,6 +99,7 @@ MyStackViewPage {
|
|||
onBackClicked: {
|
||||
// top back button to send/receive menu, reset default states for sendViews
|
||||
sendStateView.pinPage.onPageCompleted();
|
||||
sendStateView.qrPage.onPageCompleted();
|
||||
sendStateView.dashPage.onPageCompleted();
|
||||
sendStateView.transferPage.onPageCompleted();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ ColumnLayout {
|
|||
id: root
|
||||
|
||||
Layout.fillWidth: true
|
||||
property string _PINLookup: ""
|
||||
property string pin: ""
|
||||
|
||||
MyText {
|
||||
Layout.fillWidth: true
|
||||
|
@ -29,26 +29,12 @@ ColumnLayout {
|
|||
|
||||
MyNumPad {
|
||||
id: numPad
|
||||
onCodeUpdated: {
|
||||
let codeFmt = "";
|
||||
|
||||
for(var i = 0; i != 4; i++) {
|
||||
if(pin_code[i] !== undefined) {
|
||||
codeFmt += pin_code[i] + " ";
|
||||
} else {
|
||||
codeFmt += ". ";
|
||||
onButtonPress: {
|
||||
root.pin += val;
|
||||
if(root.pin.length === 4 && root.pin !== "0000") {
|
||||
return addressLookup();
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -66,7 +52,7 @@ ColumnLayout {
|
|||
id: codeDisplay
|
||||
Layout.preferredWidth: 390
|
||||
visible: true
|
||||
text: "0 0 0 0"
|
||||
text: (root.pin[0] || ".") + " " + (root.pin[1] || ".") + " " + (root.pin[2] || ".") + " " + (root.pin[3] || ".");
|
||||
color: Style.fontColor
|
||||
font.bold: true
|
||||
font.pointSize: 40
|
||||
|
@ -136,7 +122,7 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
MyText {
|
||||
text: _PINLookup
|
||||
text: root.pin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,18 +134,18 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
function addressLookup(code) {
|
||||
if(_PINLookup !== "")
|
||||
return;
|
||||
|
||||
_PINLookup = code;
|
||||
|
||||
function addressLookup() {
|
||||
console.log("addressLookup()");
|
||||
idleContainer.visible = false;
|
||||
loadingContainer.visible = true;
|
||||
|
||||
numPad.enabled = false;
|
||||
|
||||
ctx.onLookupReceivingPIN(code);
|
||||
try {
|
||||
ctx.onLookupReceivingPIN(root.pin);
|
||||
} catch(err){
|
||||
console.log("ctx.onLookupReceivingPIN() ignored")
|
||||
}
|
||||
}
|
||||
|
||||
function onPageCompleted(previousView) {
|
||||
|
@ -167,8 +153,9 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
function reset() {
|
||||
console.log("SendPagePin reset()");
|
||||
// reset state
|
||||
_PINLookup = "";
|
||||
root.pin = "";
|
||||
|
||||
idleContainer.visible = true;
|
||||
loadingContainer.visible = false;
|
||||
|
@ -176,8 +163,6 @@ ColumnLayout {
|
|||
|
||||
numPad.enabled = true;
|
||||
numPad.reset();
|
||||
|
||||
codeDisplay.text = "0 0 0 0";
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -186,7 +171,7 @@ ColumnLayout {
|
|||
function onPinLookupReceived(address, pin) {
|
||||
console.log("onPinLookupReceived", address);
|
||||
|
||||
if(pin === _PINLookup) {
|
||||
if(pin === root.pin) {
|
||||
sendStateController.destinationAddress = address;
|
||||
sendStateView.state = "transferPage";
|
||||
} else {
|
||||
|
|
|
@ -42,7 +42,11 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
function onPageCompleted(previousView){
|
||||
function reset() {
|
||||
|
||||
}
|
||||
|
||||
function onPageCompleted(previousView){
|
||||
reset();
|
||||
}
|
||||
}
|
|
@ -9,7 +9,8 @@ ColumnLayout {
|
|||
spacing: 30
|
||||
|
||||
property string txDialogText: ""
|
||||
property double amount: 0.0
|
||||
property string amount: ""
|
||||
property string amount_type: "wow"
|
||||
property bool canSend: false
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
@ -21,37 +22,85 @@ ColumnLayout {
|
|||
text: "How much would you like to send?"
|
||||
}
|
||||
|
||||
MyNumPadSendAmount {
|
||||
id: myNumPadSendAmount
|
||||
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;
|
||||
}
|
||||
}
|
||||
function count(input, needle) {
|
||||
return input.split(".").length - 1;
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 30
|
||||
Layout.topMargin: 20
|
||||
spacing: 40
|
||||
|
||||
ColumnLayout {
|
||||
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 {
|
||||
spacing: 10
|
||||
Layout.fillHeight: true
|
||||
Layout.maximumWidth: parent.width / 2
|
||||
|
||||
|
||||
RowLayout {
|
||||
spacing: 30
|
||||
|
@ -78,7 +127,21 @@ ColumnLayout {
|
|||
MyText {
|
||||
fontSize: 24
|
||||
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.right: parent.right
|
||||
}
|
||||
|
@ -111,7 +174,21 @@ ColumnLayout {
|
|||
id: fiatText
|
||||
fontSize: 18
|
||||
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.right: parent.right
|
||||
}
|
||||
|
@ -153,34 +230,9 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "transparent"
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.preferredWidth: parent.width
|
||||
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.alignment: Qt.AlignRight
|
||||
|
@ -188,100 +240,41 @@ ColumnLayout {
|
|||
text: "Create transaction"
|
||||
|
||||
onClicked: {
|
||||
WowletVR.onCreateTransaction(destinationAddress, root.amount, "", false); // no description
|
||||
if(amount === "") return;
|
||||
|
||||
let _amount = parseFloat(amount);
|
||||
if(root.amount_type == "fiat") {
|
||||
try {
|
||||
_amount = WowletVR.fiatToWow(_amount);
|
||||
} catch(err) {
|
||||
messagePopup.showMessage("Error", "Could not convert fiat to wow.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(amount <= 0) {
|
||||
messagePopup.showMessage("Error", "Amount was zero.");
|
||||
return;
|
||||
}
|
||||
|
||||
WowletVR.onCreateTransaction(destinationAddress, _amount.toString(), "", false); // no description
|
||||
sendButton.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onPageCompleted() {
|
||||
root.amount = "";
|
||||
root.amount_type = "wow";
|
||||
root.txDialogText = "";
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: OverlayController
|
||||
|
||||
function onKeyBoardInputSignal(input, userValue) {
|
||||
if (userValue == 1337) {
|
||||
let val = parseFloat(input);
|
||||
if(val >= 0)
|
||||
myNumPadSendAmount.onAmountUpdated(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ctx
|
||||
|
||||
function onInitiateTransaction() {
|
||||
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){
|
||||
|
||||
}
|
||||
|
||||
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: {
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue