diff options
| author | Riccardo Spagni <ric@spagni.net> | 2016-11-11 12:44:31 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2016-11-11 12:44:31 +0200 |
| commit | 573049d871b6de895eca94a3f46884eaece07ae9 (patch) | |
| tree | fcc866ae81a8c1eb15ca986d5f093ec09797585f /src/libwalletqt/Wallet.cpp | |
| parent | 1b9c864c74642a4233490d786e45b99ec1c49dfb (diff) | |
| parent | 66692be7cf048a89c0c36af2c36de09be6fa3698 (diff) | |
| download | monzero-gui-573049d871b6de895eca94a3f46884eaece07ae9.tar.gz monzero-gui-573049d871b6de895eca94a3f46884eaece07ae9.tar.xz monzero-gui-573049d871b6de895eca94a3f46884eaece07ae9.zip | |
Merge pull request #134
66692be createTransactionAsync(): removed reference to WalletManager (Jacob Brydolf)
f8e2e5d asynchronous transaction + show splash (Jacob Brydolf)
62060e1 wallet::createTransactionAsync pass variables to listener (Jacob Brydolf)
00ea5d6 added Wallet::createTransactionAsync() (Jacob Brydolf)
Diffstat (limited to 'src/libwalletqt/Wallet.cpp')
| -rw-r--r-- | src/libwalletqt/Wallet.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 18ded2c8..78cb6949 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -10,6 +10,7 @@ #include <QDebug> #include <QUrl> #include <QTimer> +#include <QtConcurrent/QtConcurrent> namespace { static const int DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS = 10; @@ -211,10 +212,29 @@ PendingTransaction *Wallet::createTransaction(const QString &dst_addr, const QSt Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction( dst_addr.toStdString(), payment_id.toStdString(), amount, mixin_count, static_cast<Bitmonero::PendingTransaction::Priority>(priority)); - PendingTransaction * result = new PendingTransaction(ptImpl, this); + PendingTransaction * result = new PendingTransaction(ptImpl,0); return result; } + +void Wallet::createTransactionAsync(const QString &dst_addr, const QString &payment_id, + quint64 amount, quint32 mixin_count, + PendingTransaction::Priority priority) +{ + QFuture<PendingTransaction*> future = QtConcurrent::run(this, &Wallet::createTransaction, + dst_addr, payment_id,amount, 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); + }); +} + + + void Wallet::disposeTransaction(PendingTransaction *t) { m_walletImpl->disposeTransaction(t->m_pimpl); |
