diff --git a/main.qml b/main.qml index 2a8dc0df..2e8d432c 100644 --- a/main.qml +++ b/main.qml @@ -386,6 +386,14 @@ ApplicationWindow { // deleting transaction object, we don't want memleaks currentWallet.disposeTransaction(transaction); + } else if (transaction.txCount == 0) { + informationPopup.title = qsTr("No unmixable outputs to sweep") + translationManager.emptyString + informationPopup.text = qsTr("No unmixable outputs to sweep") + translationManager.emptyString + informationPopup.icon = StandardIcon.Information + informationPopup.onCloseCallback = null + informationPopup.open() + // deleting transaction object, we don't want memleaks + currentWallet.disposeTransaction(transaction); } else { console.log("Transaction created, amount: " + walletManager.displayAmount(transaction.amount) + ", fee: " + walletManager.displayAmount(transaction.fee)); @@ -394,13 +402,13 @@ ApplicationWindow { transactionConfirmationPopup.title = qsTr("Confirmation") + translationManager.emptyString transactionConfirmationPopup.text = qsTr("Please confirm transaction:\n") - + qsTr("\nAddress: ") + address - + qsTr("\nPayment ID: ") + paymentId + + (address === "" ? "" : (qsTr("\nAddress: ") + address)) + + (paymentId === "" ? "" : (qsTr("\nPayment ID: ") + paymentId)) + qsTr("\n\nAmount: ") + walletManager.displayAmount(transaction.amount) + qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee) + qsTr("\n\nMixin: ") + mixinCount + qsTr("\n\Number of transactions: ") + transaction.txCount - + qsTr("\n\nDescription: ") + transactionDescription + + (transactionDescription === "" ? "" : (qsTr("\n\nDescription: ") + transactionDescription)) + translationManager.emptyString transactionConfirmationPopup.icon = StandardIcon.Question transactionConfirmationPopup.open() diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 9f15bb06..5f3cd5f3 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -242,6 +242,22 @@ PendingTransaction *Wallet::createTransactionAll(const QString &dst_addr, const return result; } +void Wallet::createTransactionAllAsync(const QString &dst_addr, const QString &payment_id, + quint32 mixin_count, + PendingTransaction::Priority priority) +{ + QFuture future = QtConcurrent::run(this, &Wallet::createTransactionAll, + dst_addr, payment_id, mixin_count, priority); + QFutureWatcher * watcher = new QFutureWatcher(); + watcher->setFuture(future); + connect(watcher, &QFutureWatcher::finished, + this, [this, watcher,dst_addr,payment_id,mixin_count]() { + QFuture future = watcher->future(); + watcher->deleteLater(); + emit transactionCreated(future.result(),dst_addr,payment_id,mixin_count); + }); +} + PendingTransaction *Wallet::createSweepUnmixableTransaction() { Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createSweepUnmixableTransaction(); @@ -249,6 +265,19 @@ PendingTransaction *Wallet::createSweepUnmixableTransaction() return result; } +void Wallet::createSweepUnmixableTransactionAsync() +{ + QFuture future = QtConcurrent::run(this, &Wallet::createSweepUnmixableTransaction); + QFutureWatcher * watcher = new QFutureWatcher(); + watcher->setFuture(future); + connect(watcher, &QFutureWatcher::finished, + this, [this, watcher]() { + QFuture future = watcher->future(); + watcher->deleteLater(); + emit transactionCreated(future.result(),"","",0); + }); +} + void Wallet::disposeTransaction(PendingTransaction *t) { m_walletImpl->disposeTransaction(t->m_pimpl); diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 65d955ba..14308ce5 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -136,9 +136,16 @@ public: Q_INVOKABLE PendingTransaction * createTransactionAll(const QString &dst_addr, const QString &payment_id, quint32 mixin_count, PendingTransaction::Priority priority); + //! creates async transaction with all outputs + Q_INVOKABLE void createTransactionAllAsync(const QString &dst_addr, const QString &payment_id, + quint32 mixin_count, PendingTransaction::Priority priority); + //! creates sweep unmixable transaction Q_INVOKABLE PendingTransaction * createSweepUnmixableTransaction(); + //! creates async sweep unmixable transaction + Q_INVOKABLE void createSweepUnmixableTransactionAsync(); + //! deletes transaction and frees memory Q_INVOKABLE void disposeTransaction(PendingTransaction * t);