diff options
| author | Ilya Kitaev <mbg033@gmail.com> | 2016-07-13 15:24:40 +0300 |
|---|---|---|
| committer | Ilya Kitaev <mbg033@gmail.com> | 2016-07-13 15:24:40 +0300 |
| commit | d9f031ec2a3b6dc256ea138a8aa8326e41130e4b (patch) | |
| tree | 1b0a658b6dfeb39fd2af7d507c61d845a72257db /src | |
| parent | c027922cb710ca78e400c30268f5ceaec10a7e49 (diff) | |
| download | monzero-gui-d9f031ec2a3b6dc256ea138a8aa8326e41130e4b.tar.gz monzero-gui-d9f031ec2a3b6dc256ea138a8aa8326e41130e4b.tar.xz monzero-gui-d9f031ec2a3b6dc256ea138a8aa8326e41130e4b.zip | |
Async API integration in progress
Diffstat (limited to 'src')
| -rw-r--r-- | src/libwalletqt/Wallet.cpp | 44 | ||||
| -rw-r--r-- | src/libwalletqt/Wallet.h | 9 |
2 files changed, 53 insertions, 0 deletions
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index e6368ad2..3697984e 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -14,6 +14,45 @@ namespace { } +class WalletListenerImpl : public Bitmonero::WalletListener +{ +public: + WalletListenerImpl(Wallet * w) + : m_wallet(w) + { + + } + + virtual void moneySpent(const std::string &txId, uint64_t amount) + { + // TODO + Q_UNUSED(txId) + Q_UNUSED(amount) + } + + virtual void moneyReceived(const std::string &txId, uint64_t amount) + { + // TODO + Q_UNUSED(txId) + Q_UNUSED(amount) + } + + virtual void updated() + { + emit m_wallet->updated(); + } + + // called when wallet refreshed by background thread or explicitly + virtual void refreshed() + { + emit m_wallet->refreshed(); + } + +private: + Wallet * m_wallet; +}; + + QString Wallet::getSeed() const { @@ -88,6 +127,11 @@ bool Wallet::refresh() return result; } +void Wallet::refreshAsync() +{ + m_walletImpl->refreshAsync(); +} + PendingTransaction *Wallet::createTransaction(const QString &dst_addr, const QString &payment_id, quint64 amount, quint32 mixin_count, PendingTransaction::Priority priority) diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 241b89d8..4d6a1ea0 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -77,6 +77,10 @@ public: //! refreshes the wallet Q_INVOKABLE bool refresh(); + + //! refreshes the wallet asynchronously + Q_INVOKABLE void refreshAsync(); + //! creates transaction Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr, const QString &payment_id, quint64 amount, quint32 mixin_count, @@ -103,6 +107,10 @@ public: signals: void updated(); + // emitted when refresh process finished (could take a long time) + // signalling only after we + void refreshed(); + private: Wallet(Bitmonero::Wallet *w, QObject * parent = 0); @@ -110,6 +118,7 @@ private: private: friend class WalletManager; + friend class WalletListenerImpl; //! libwallet's Bitmonero::Wallet * m_walletImpl; // history lifetime managed by wallet; |
