Wallet::daemonBlockChainHeight(); BC sync progress in GUI

This commit is contained in:
Ilya Kitaev
2016-09-26 22:55:25 +03:00
parent 7e769b3a87
commit f402fd9e7d
5 changed files with 84 additions and 16 deletions

View File

@@ -2,11 +2,11 @@
#define WALLET_H
#include <QObject>
#include <QTime>
#include "wallet/wallet2_api.h" // we need to have an access to the Bitmonero::Wallet::Status enum here;
#include "PendingTransaction.h" // we need to have an access to the PendingTransaction::Priority enum here;
namespace Bitmonero {
class Wallet; // forward declaration
}
@@ -28,7 +28,6 @@ class Wallet : public QObject
Q_PROPERTY(TransactionHistory * history READ history)
Q_PROPERTY(QString paymentId READ paymentId WRITE setPaymentId)
public:
enum Status {
Status_Ok = Bitmonero::Wallet::Status_Ok,
@@ -77,10 +76,17 @@ public:
Q_INVOKABLE void setTrustedDaemon(bool arg);
//! returns balance
quint64 balance() const;
Q_INVOKABLE quint64 balance() const;
//! returns unlocked balance
quint64 unlockedBalance() const;
Q_INVOKABLE quint64 unlockedBalance() const;
//! returns current wallet's block height
//! (can be less than daemon's blockchain height when wallet sync in progress)
Q_INVOKABLE quint64 blockChainHeight() const;
//! returns daemon's blockchain height
Q_INVOKABLE quint64 daemonBlockChainHeight() const;
//! refreshes the wallet
Q_INVOKABLE bool refresh();
@@ -89,6 +95,12 @@ public:
//! refreshes the wallet asynchronously
Q_INVOKABLE void refreshAsync();
//! setup auto-refresh interval in seconds
Q_INVOKABLE void setAutoRefreshInterval(int seconds);
//! return auto-refresh interval in seconds
Q_INVOKABLE int autoRefreshInterval() const;
//! creates transaction
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr, const QString &payment_id,
quint64 amount, quint32 mixin_count,
@@ -138,6 +150,9 @@ private:
// history lifetime managed by wallet;
TransactionHistory * m_history;
QString m_paymentId;
mutable QTime m_daemonBlockChainHeightTime;
mutable quint64 m_daemonBlockChainHeight;
int m_daemonBlockChainHeightTtl;
};