2016-06-26 15:04:45 +00:00
|
|
|
// Copyright (c) 2014-2015, The Monero Project
|
2016-10-04 10:15:29 +00:00
|
|
|
//
|
2016-06-26 15:04:45 +00:00
|
|
|
// All rights reserved.
|
2016-10-04 10:15:29 +00:00
|
|
|
//
|
2016-06-26 15:04:45 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without modification, are
|
|
|
|
// permitted provided that the following conditions are met:
|
2016-10-04 10:15:29 +00:00
|
|
|
//
|
2016-06-26 15:04:45 +00:00
|
|
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
|
|
// conditions and the following disclaimer.
|
2016-10-04 10:15:29 +00:00
|
|
|
//
|
2016-06-26 15:04:45 +00:00
|
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
|
|
// of conditions and the following disclaimer in the documentation and/or other
|
|
|
|
// materials provided with the distribution.
|
2016-10-04 10:15:29 +00:00
|
|
|
//
|
2016-06-26 15:04:45 +00:00
|
|
|
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
|
|
|
// used to endorse or promote products derived from this software without specific
|
|
|
|
// prior written permission.
|
2016-10-04 10:15:29 +00:00
|
|
|
//
|
2016-06-26 15:04:45 +00:00
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
|
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
|
|
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
|
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Controls 1.4
|
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
import QtQuick.Layouts 1.1
|
2016-11-27 10:57:13 +00:00
|
|
|
import QtQuick.Dialogs 1.2
|
2016-06-26 15:04:45 +00:00
|
|
|
|
|
|
|
import "../components"
|
2016-10-02 18:40:40 +00:00
|
|
|
import moneroComponents.Clipboard 1.0
|
2016-11-27 10:57:13 +00:00
|
|
|
import moneroComponents.Wallet 1.0
|
|
|
|
import moneroComponents.WalletManager 1.0
|
|
|
|
import moneroComponents.TransactionHistory 1.0
|
|
|
|
import moneroComponents.TransactionHistoryModel 1.0
|
2016-06-26 15:04:45 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
|
|
|
color: "#F0EEEE"
|
|
|
|
property alias addressText : addressLine.text
|
|
|
|
property alias paymentIdText : paymentIdLine.text
|
|
|
|
property alias integratedAddressText : integratedAddressLine.text
|
2016-11-27 10:57:13 +00:00
|
|
|
property var model
|
|
|
|
property string trackingLineText: ""
|
2016-06-26 15:04:45 +00:00
|
|
|
|
2016-10-16 12:21:22 +00:00
|
|
|
function updatePaymentId(payment_id) {
|
2016-11-18 19:38:26 +00:00
|
|
|
if (typeof appWindow.currentWallet === 'undefined' || appWindow.currentWallet == null)
|
2016-10-16 12:21:22 +00:00
|
|
|
return
|
2017-03-18 22:01:00 +00:00
|
|
|
|
2016-10-16 12:21:22 +00:00
|
|
|
// generate a new one if not given as argument
|
|
|
|
if (typeof payment_id === 'undefined') {
|
2016-10-02 20:54:05 +00:00
|
|
|
payment_id = appWindow.currentWallet.generatePaymentId()
|
2016-10-16 12:21:22 +00:00
|
|
|
paymentIdLine.text = payment_id
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
2017-03-18 22:01:00 +00:00
|
|
|
|
|
|
|
if (payment_id.length > 0) {
|
|
|
|
integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
|
|
|
|
if (integratedAddressLine.text === "")
|
|
|
|
integratedAddressLine.text = qsTr("Invalid payment ID")
|
|
|
|
}
|
|
|
|
else {
|
2017-03-18 22:28:29 +00:00
|
|
|
paymentIdLine.text = ""
|
2017-03-18 22:01:00 +00:00
|
|
|
integratedAddressLine.text = ""
|
|
|
|
}
|
|
|
|
|
2016-11-27 10:57:13 +00:00
|
|
|
update()
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
|
|
|
|
2016-11-20 12:36:14 +00:00
|
|
|
function makeQRCodeString() {
|
|
|
|
var s = "monero:"
|
|
|
|
var nfields = 0
|
|
|
|
s += addressLine.text
|
|
|
|
var amount = amountLine.text.trim()
|
|
|
|
if (amount !== "") {
|
|
|
|
s += (nfields++ ? "&" : "?")
|
|
|
|
s += "tx_amount=" + amount
|
|
|
|
}
|
|
|
|
var pid = paymentIdLine.text.trim()
|
|
|
|
if (pid !== "") {
|
|
|
|
s += (nfields++ ? "&" : "?")
|
|
|
|
s += "tx_payment_id=" + pid
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
2016-11-27 10:57:13 +00:00
|
|
|
function setTrackingLineText(text) {
|
|
|
|
// don't replace with same text, it wrecks selection while the user is selecting
|
|
|
|
// also keep track of text, because when we read back the text from the widget,
|
|
|
|
// we do not get what we put it, but some extra HTML stuff on top
|
|
|
|
if (text != trackingLineText) {
|
|
|
|
trackingLine.text = text
|
|
|
|
trackingLineText = text
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
if (!appWindow.currentWallet) {
|
|
|
|
setTrackingLineText("-")
|
|
|
|
return
|
|
|
|
}
|
2017-02-23 18:47:58 +00:00
|
|
|
if (appWindow.currentWallet.connected() == Wallet.ConnectionStatus_Disconnected) {
|
2016-11-27 10:57:13 +00:00
|
|
|
setTrackingLineText(qsTr("WARNING: no connection to daemon"))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var model = appWindow.currentWallet.historyModel
|
|
|
|
var count = model.rowCount()
|
|
|
|
var totalAmount = 0
|
|
|
|
var nTransactions = 0
|
|
|
|
var list = ""
|
|
|
|
var blockchainHeight = 0
|
|
|
|
for (var i = 0; i < count; ++i) {
|
|
|
|
var idx = model.index(i, 0)
|
|
|
|
var isout = model.data(idx, TransactionHistoryModel.TransactionIsOutRole);
|
|
|
|
var payment_id = model.data(idx, TransactionHistoryModel.TransactionPaymentIdRole);
|
|
|
|
if (!isout && payment_id == paymentIdLine.text) {
|
|
|
|
var amount = model.data(idx, TransactionHistoryModel.TransactionAtomicAmountRole);
|
|
|
|
totalAmount = walletManager.addi(totalAmount, amount)
|
|
|
|
nTransactions += 1
|
|
|
|
|
|
|
|
var txid = model.data(idx, TransactionHistoryModel.TransactionHashRole);
|
|
|
|
var blockHeight = model.data(idx, TransactionHistoryModel.TransactionBlockHeightRole);
|
|
|
|
if (blockHeight == 0) {
|
|
|
|
list += qsTr("in the txpool: %1").arg(txid) + translationManager.emptyString
|
|
|
|
} else {
|
|
|
|
if (blockchainHeight == 0)
|
|
|
|
blockchainHeight = walletManager.blockchainHeight()
|
|
|
|
var confirmations = blockchainHeight - blockHeight - 1
|
|
|
|
var displayAmount = model.data(idx, TransactionHistoryModel.TransactionDisplayAmountRole);
|
|
|
|
if (confirmations > 1) {
|
|
|
|
list += qsTr("%2 confirmations: %3 (%1)").arg(txid).arg(confirmations).arg(displayAmount) + translationManager.emptyString
|
|
|
|
} else {
|
|
|
|
list += qsTr("1 confirmation: %2 (%1)").arg(txid).arg(displayAmount) + translationManager.emptyString
|
|
|
|
}
|
|
|
|
}
|
|
|
|
list += "<br>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nTransactions == 0) {
|
|
|
|
setTrackingLineText(qsTr("No transaction found yet...") + translationManager.emptyString)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
var text = ((nTransactions == 1) ? qsTr("Transaction found") : qsTr("%1 transactions found").arg(nTransactions)) + translationManager.emptyString
|
|
|
|
|
|
|
|
var expectedAmount = walletManager.amountFromString(amountLine.text)
|
|
|
|
if (expectedAmount && expectedAmount != amount) {
|
|
|
|
var displayTotalAmount = walletManager.displayAmount(totalAmount)
|
|
|
|
if (amount > expectedAmount) {
|
|
|
|
text += qsTr(" with more money (%1)").arg(displayTotalAmount) + translationManager.emptyString
|
|
|
|
} else if (amount < expectedAmount) {
|
|
|
|
text += qsTr(" with not enough money (%1)").arg(displayTotalAmount) + translationManager.emptyString
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setTrackingLineText(text + "<br>" + list)
|
|
|
|
}
|
|
|
|
|
2016-06-26 15:04:45 +00:00
|
|
|
Clipboard { id: clipboard }
|
|
|
|
|
|
|
|
|
|
|
|
/* main layout */
|
|
|
|
ColumnLayout {
|
|
|
|
id: mainLayout
|
2017-04-03 16:51:55 +00:00
|
|
|
anchors.margins: (isMobile)? 17 : 40
|
2017-08-07 14:05:54 +00:00
|
|
|
anchors.topMargin: 40 * scaleRatio
|
2017-04-03 16:51:55 +00:00
|
|
|
|
2016-06-26 15:04:45 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
2017-08-07 14:05:54 +00:00
|
|
|
spacing: 20 * scaleRatio
|
|
|
|
property int labelWidth: 120 * scaleRatio
|
|
|
|
property int editWidth: 400 * scaleRatio
|
|
|
|
property int lineEditFontSize: 12 * scaleRatio
|
|
|
|
property int qrCodeSize: 240 * scaleRatio
|
2016-06-26 15:04:45 +00:00
|
|
|
|
|
|
|
|
2017-04-03 16:51:55 +00:00
|
|
|
ColumnLayout {
|
2016-06-26 15:04:45 +00:00
|
|
|
id: addressRow
|
|
|
|
Label {
|
|
|
|
id: addressLabel
|
2016-07-20 19:28:11 +00:00
|
|
|
text: qsTr("Address") + translationManager.emptyString
|
2016-06-26 15:04:45 +00:00
|
|
|
width: mainLayout.labelWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
LineEdit {
|
|
|
|
id: addressLine
|
|
|
|
fontSize: mainLayout.lineEditFontSize
|
2016-07-20 19:28:11 +00:00
|
|
|
placeholderText: qsTr("ReadOnly wallet address displayed here") + translationManager.emptyString;
|
2016-06-26 15:04:45 +00:00
|
|
|
readOnly: true
|
|
|
|
width: mainLayout.editWidth
|
|
|
|
Layout.fillWidth: true
|
2016-10-03 23:14:09 +00:00
|
|
|
onTextChanged: cursorPosition = 0
|
|
|
|
|
2016-06-26 15:04:45 +00:00
|
|
|
IconButton {
|
|
|
|
imageSource: "../images/copyToClipboard.png"
|
|
|
|
onClicked: {
|
|
|
|
if (addressLine.text.length > 0) {
|
2017-04-03 16:51:55 +00:00
|
|
|
console.log(addressLine.text + " copied to clipboard")
|
2016-06-26 15:04:45 +00:00
|
|
|
clipboard.setText(addressLine.text)
|
2017-11-02 06:51:15 +00:00
|
|
|
appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3)
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-03 16:51:55 +00:00
|
|
|
GridLayout {
|
2016-06-26 15:04:45 +00:00
|
|
|
id: paymentIdRow
|
2017-04-03 16:51:55 +00:00
|
|
|
columns:2
|
2016-06-26 15:04:45 +00:00
|
|
|
Label {
|
2017-04-03 16:51:55 +00:00
|
|
|
Layout.columnSpan: 2
|
2016-06-26 15:04:45 +00:00
|
|
|
id: paymentIdLabel
|
2016-07-20 19:28:11 +00:00
|
|
|
text: qsTr("Payment ID") + translationManager.emptyString
|
2016-06-26 15:04:45 +00:00
|
|
|
width: mainLayout.labelWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LineEdit {
|
|
|
|
id: paymentIdLine
|
|
|
|
fontSize: mainLayout.lineEditFontSize
|
2017-03-03 17:18:55 +00:00
|
|
|
placeholderText: qsTr("16 hexadecimal characters") + translationManager.emptyString;
|
2016-06-26 15:04:45 +00:00
|
|
|
readOnly: false
|
2016-10-16 12:21:22 +00:00
|
|
|
onTextChanged: updatePaymentId(paymentIdLine.text)
|
2016-06-26 15:04:45 +00:00
|
|
|
|
|
|
|
width: mainLayout.editWidth
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
IconButton {
|
|
|
|
imageSource: "../images/copyToClipboard.png"
|
|
|
|
onClicked: {
|
|
|
|
if (paymentIdLine.text.length > 0) {
|
|
|
|
clipboard.setText(paymentIdLine.text)
|
2017-11-02 06:51:15 +00:00
|
|
|
appWindow.showStatusMessage(qsTr("Payment ID copied to clipboard"),3)
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: generatePaymentId
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
2017-03-09 00:28:24 +00:00
|
|
|
text: qsTr("Generate") + translationManager.emptyString;
|
2017-03-18 22:01:00 +00:00
|
|
|
onClicked: updatePaymentId()
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
2017-03-18 22:28:29 +00:00
|
|
|
|
|
|
|
StandardButton {
|
|
|
|
id: clearPaymentId
|
|
|
|
enabled: !!paymentIdLine.text
|
|
|
|
shadowReleasedColor: "#FF4304"
|
|
|
|
shadowPressedColor: "#B32D00"
|
|
|
|
releasedColor: "#FF6C3C"
|
|
|
|
pressedColor: "#FF4304"
|
|
|
|
text: qsTr("Clear") + translationManager.emptyString;
|
|
|
|
onClicked: updatePaymentId("")
|
|
|
|
}
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
2017-04-03 16:51:55 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
2017-01-07 19:20:40 +00:00
|
|
|
id: integratedAddressRow
|
|
|
|
Label {
|
|
|
|
id: integratedAddressLabel
|
|
|
|
text: qsTr("Integrated address") + translationManager.emptyString
|
|
|
|
width: mainLayout.labelWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LineEdit {
|
|
|
|
|
|
|
|
id: integratedAddressLine
|
|
|
|
fontSize: mainLayout.lineEditFontSize
|
2017-03-19 01:15:42 +00:00
|
|
|
placeholderText: qsTr("Generate payment ID for integrated address") + translationManager.emptyString
|
2017-01-07 19:20:40 +00:00
|
|
|
readOnly: true
|
|
|
|
width: mainLayout.editWidth
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
onTextChanged: cursorPosition = 0
|
|
|
|
|
|
|
|
IconButton {
|
|
|
|
imageSource: "../images/copyToClipboard.png"
|
|
|
|
onClicked: {
|
|
|
|
if (integratedAddressLine.text.length > 0) {
|
|
|
|
clipboard.setText(integratedAddressLine.text)
|
2017-11-02 06:51:15 +00:00
|
|
|
appWindow.showStatusMessage(qsTr("Integrated address copied to clipboard"),3)
|
2017-01-07 19:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2016-06-26 15:04:45 +00:00
|
|
|
|
2017-04-03 16:51:55 +00:00
|
|
|
ColumnLayout {
|
2016-11-20 12:36:14 +00:00
|
|
|
id: amountRow
|
|
|
|
Label {
|
|
|
|
id: amountLabel
|
|
|
|
text: qsTr("Amount") + translationManager.emptyString
|
|
|
|
width: mainLayout.labelWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LineEdit {
|
|
|
|
id: amountLine
|
|
|
|
fontSize: mainLayout.lineEditFontSize
|
2017-03-19 22:55:33 +00:00
|
|
|
placeholderText: qsTr("Amount to receive") + translationManager.emptyString
|
2016-11-20 12:36:14 +00:00
|
|
|
readOnly: false
|
|
|
|
width: mainLayout.editWidth
|
|
|
|
Layout.fillWidth: true
|
|
|
|
validator: DoubleValidator {
|
|
|
|
bottom: 0.0
|
|
|
|
top: 18446744.073709551615
|
|
|
|
decimals: 12
|
|
|
|
notation: DoubleValidator.StandardNotation
|
|
|
|
locale: "C"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-27 10:57:13 +00:00
|
|
|
RowLayout {
|
|
|
|
id: trackingRow
|
2017-08-08 09:07:44 +00:00
|
|
|
visible: !isAndroid && !isIOS
|
2016-11-27 10:57:13 +00:00
|
|
|
Label {
|
|
|
|
id: trackingLabel
|
|
|
|
textFormat: Text.RichText
|
|
|
|
text: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>\
|
|
|
|
Tracking <font size='2'> (</font><a href='#'>help</a><font size='2'>)</font>")
|
|
|
|
+ translationManager.emptyString
|
|
|
|
width: mainLayout.labelWidth
|
|
|
|
onLinkActivated: {
|
|
|
|
trackingHowToUseDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
|
|
|
|
trackingHowToUseDialog.text = qsTr(
|
|
|
|
"<p><font size='+2'>This is a simple sales tracker:</font></p>" +
|
|
|
|
"<p>Click Generate to create a random payment id for a new customer</p> " +
|
|
|
|
"<p>Let your customer scan that QR code to make a payment (if that customer has software which " +
|
|
|
|
"supports QR code scanning).</p>" +
|
|
|
|
"<p>This page will automatically scan the blockchain and the tx pool " +
|
|
|
|
"for incoming transactions using this QR code. If you input an amount, it will also check " +
|
|
|
|
"that incoming transactions total up to that amount.</p>" +
|
|
|
|
"It's up to you whether to accept unconfirmed transactions or not. It is likely they'll be " +
|
|
|
|
"confirmed in short order, but there is still a possibility they might not, so for larger " +
|
|
|
|
"values you may want to wait for one or more confirmation(s).</p>"
|
|
|
|
)
|
|
|
|
trackingHowToUseDialog.icon = StandardIcon.Information
|
|
|
|
trackingHowToUseDialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: trackingLine
|
|
|
|
anchors.top: trackingRow.top
|
|
|
|
textFormat: Text.RichText
|
|
|
|
text: ""
|
|
|
|
readOnly: true
|
|
|
|
width: mainLayout.editWidth
|
|
|
|
Layout.fillWidth: true
|
|
|
|
selectByMouse: true
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageDialog {
|
|
|
|
id: trackingHowToUseDialog
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
}
|
|
|
|
|
2017-01-23 04:15:49 +00:00
|
|
|
FileDialog {
|
|
|
|
id: qrFileDialog
|
|
|
|
title: "Please choose a name"
|
|
|
|
folder: shortcuts.pictures
|
|
|
|
selectExisting: false
|
|
|
|
nameFilters: [ "Image (*.png)"]
|
|
|
|
onAccepted: {
|
|
|
|
if( ! walletManager.saveQrCode(makeQRCodeString(), walletManager.urlToLocalPath(fileUrl))) {
|
|
|
|
console.log("Failed to save QrCode to file " + walletManager.urlToLocalPath(fileUrl) )
|
|
|
|
trackingHowToUseDialog.title = qsTr("Save QrCode") + translationManager.emptyString;
|
|
|
|
trackingHowToUseDialog.text = qsTr("Failed to save QrCode to ") + walletManager.urlToLocalPath(fileUrl) + translationManager.emptyString;
|
|
|
|
trackingHowToUseDialog.icon = StandardIcon.Error
|
|
|
|
trackingHowToUseDialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-08 09:07:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
Menu {
|
|
|
|
id: qrMenu
|
|
|
|
title: "QrCode"
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Save As") + translationManager.emptyString;
|
|
|
|
onTriggered: qrFileDialog.open()
|
|
|
|
}
|
2017-01-23 04:15:49 +00:00
|
|
|
}
|
|
|
|
|
2017-08-08 09:07:44 +00:00
|
|
|
Image {
|
|
|
|
id: qrCode
|
|
|
|
anchors.margins: 50 * scaleRatio
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.minimumHeight: mainLayout.qrCodeSize
|
|
|
|
smooth: false
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "image://qrcode/" + makeQRCodeString()
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.RightButton
|
|
|
|
onClicked: {
|
|
|
|
if (mouse.button == Qt.RightButton)
|
|
|
|
qrMenu.popup()
|
|
|
|
}
|
|
|
|
onPressAndHold: qrFileDialog.open()
|
2017-01-23 04:15:49 +00:00
|
|
|
}
|
|
|
|
}
|
2016-11-20 12:36:14 +00:00
|
|
|
}
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
|
|
|
|
2016-11-27 10:57:13 +00:00
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
interval: 2000; running: false; repeat: true
|
|
|
|
onTriggered: update()
|
|
|
|
}
|
|
|
|
|
2016-10-04 10:15:29 +00:00
|
|
|
function onPageCompleted() {
|
2016-06-26 15:04:45 +00:00
|
|
|
console.log("Receive page loaded");
|
2016-10-04 10:15:29 +00:00
|
|
|
|
2017-03-18 22:01:00 +00:00
|
|
|
if (appWindow.currentWallet) {
|
|
|
|
if (addressLine.text.length === 0 || addressLine.text !== appWindow.currentWallet.address) {
|
|
|
|
addressLine.text = appWindow.currentWallet.address
|
|
|
|
}
|
2016-10-04 10:15:29 +00:00
|
|
|
}
|
2017-03-18 22:01:00 +00:00
|
|
|
|
2016-11-27 10:57:13 +00:00
|
|
|
update()
|
|
|
|
timer.running = true
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|
|
|
|
|
2016-11-27 10:57:13 +00:00
|
|
|
function onPageClosed() {
|
|
|
|
timer.running = false
|
|
|
|
}
|
2016-06-26 15:04:45 +00:00
|
|
|
}
|