diff --git a/MiddlePanel.qml b/MiddlePanel.qml index 28d6f137..edb4963d 100644 --- a/MiddlePanel.qml +++ b/MiddlePanel.qml @@ -30,7 +30,7 @@ import QtQuick 2.2 Rectangle { color: "#F0EEEE" - signal paymentClicked(string address, string paymentId, double amount, double fee, int privacyLevel) + signal paymentClicked(string address, string paymentId, double amount, int mixinCount) states: [ State { @@ -84,7 +84,7 @@ Rectangle { target: loader.item onPaymentClicked : { console.log("MiddlePanel: paymentClicked") - paymentClicked(address, paymentId, amount, fee, privacyLevel) + paymentClicked(address, paymentId, amount, mixinCount) } } diff --git a/main.qml b/main.qml index e193ae29..e6dcef64 100644 --- a/main.qml +++ b/main.qml @@ -169,15 +169,15 @@ ApplicationWindow { return wallets.length > 0; } - function handlePayment(address, paymentId, amount, fee, privacyLevel) { - console.log("Process payment here: ", address, paymentId, amount, fee, privacyLevel) + function handlePayment(address, paymentId, amount, mixinCount) { + console.log("Process payment here: ", address, paymentId, amount, mixinCount) // TODO: handle payment id // TODO: handle fee; // TODO: handle mixins var amountxmr = walletManager.amountFromString(amount); console.log("integer amount: ", amountxmr); - var pendingTransaction = wallet.createTransaction(address, amountxmr); + var pendingTransaction = wallet.createTransaction(address, amountxmr, mixinCount); if (pendingTransaction.status !== PendingTransaction.Status_Ok) { console.error("Can't create transaction: ", pendingTransaction.errorString); } else { diff --git a/pages/Transfer.qml b/pages/Transfer.qml index f215ab27..e3f96997 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -30,10 +30,19 @@ import QtQuick 2.0 import "../components" Rectangle { - signal paymentClicked(string address, string paymentId, double amount, double fee, int privacyLevel) + signal paymentClicked(string address, string paymentId, double amount, int mixinCount) color: "#F0EEEE" + function scaleValueToMixinCount(scaleValue) { + var scaleToMixinCount = [2,3,4,5,5,5,6,7,8,9,10,15,20,25]; + if (scaleValue < scaleToMixinCount.length) { + return scaleToMixinCount[scaleValue]; + } else { + return 0; + } + } + Label { id: amountLabel @@ -125,6 +134,10 @@ Rectangle { anchors.leftMargin: 17 anchors.rightMargin: 17 anchors.topMargin: 5 + onFillLevelChanged: { + print ("PrivacyLevel changed:" + fillLevel) + print ("mixin count:" + scaleValueToMixinCount(fillLevel)) + } } @@ -230,7 +243,7 @@ Rectangle { if (addressLine.text.length > 0 && amountLine.text.length > 0) { console.log("paymentClicked") - paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, 0.0002, 1) + paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel)) } } } diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 901075b6..4e6b6787 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -88,10 +88,10 @@ bool Wallet::refresh() return result; } -PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount) +PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount, quint32 mixin_count) { Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction( - dst_addr.toStdString(), amount); + dst_addr.toStdString(), amount, mixin_count); PendingTransaction * result = new PendingTransaction(ptImpl, this); return result; } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index f8263040..4991476a 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -76,7 +76,7 @@ public: //! creates transaction Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr, - quint64 amount); + quint64 amount, quint32 mixin_count); //! deletes transaction and frees memory Q_INVOKABLE void disposeTransaction(PendingTransaction * t);