diff options
| author | moneromooo.monero <moneromooo.monero@users.noreply.github.com> | 2016-11-11 21:54:17 +0000 |
|---|---|---|
| committer | moneromooo.monero <moneromooo.monero@users.noreply.github.com> | 2016-11-12 19:24:51 +0000 |
| commit | 111248f410da5133bb6c8051b674536fb4ca121f (patch) | |
| tree | a9a14b239a5e5b04a7478dd791853eb69df0bafd /src/libwalletqt/Wallet.cpp | |
| parent | c779b376fc06c1912b896549b5f39c4a6ef0ec5a (diff) | |
| download | monzero-gui-111248f410da5133bb6c8051b674536fb4ca121f.tar.gz monzero-gui-111248f410da5133bb6c8051b674536fb4ca121f.tar.xz monzero-gui-111248f410da5133bb6c8051b674536fb4ca121f.zip | |
Make the new sweep functions use async transactions
Diffstat (limited to 'src/libwalletqt/Wallet.cpp')
| -rw-r--r-- | src/libwalletqt/Wallet.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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<PendingTransaction*> future = QtConcurrent::run(this, &Wallet::createTransactionAll, + dst_addr, payment_id, mixin_count, priority); + QFutureWatcher<PendingTransaction*> * watcher = new QFutureWatcher<PendingTransaction*>(); + watcher->setFuture(future); + connect(watcher, &QFutureWatcher<PendingTransaction*>::finished, + this, [this, watcher,dst_addr,payment_id,mixin_count]() { + QFuture<PendingTransaction*> 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<PendingTransaction*> future = QtConcurrent::run(this, &Wallet::createSweepUnmixableTransaction); + QFutureWatcher<PendingTransaction*> * watcher = new QFutureWatcher<PendingTransaction*>(); + watcher->setFuture(future); + connect(watcher, &QFutureWatcher<PendingTransaction*>::finished, + this, [this, watcher]() { + QFuture<PendingTransaction*> future = watcher->future(); + watcher->deleteLater(); + emit transactionCreated(future.result(),"","",0); + }); +} + void Wallet::disposeTransaction(PendingTransaction *t) { m_walletImpl->disposeTransaction(t->m_pimpl); |
