Remove direct bitcoin calls from qt/clientmodel.cpp

This commit is contained in:
Russell Yanofsky
2017-04-17 15:37:36 -04:00
committed by John Newbery
parent 5fba3af21e
commit fe6f27e6ea
9 changed files with 232 additions and 142 deletions

View File

@@ -9,6 +9,7 @@
#include <QDateTime>
#include <atomic>
#include <memory>
class BanTableModel;
class OptionsModel;
@@ -16,6 +17,11 @@ class PeerTableModel;
class CBlockIndex;
namespace interface {
class Handler;
class Node;
}
QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE
@@ -40,37 +46,21 @@ class ClientModel : public QObject
Q_OBJECT
public:
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
explicit ClientModel(interface::Node& node, OptionsModel *optionsModel, QObject *parent = 0);
~ClientModel();
interface::Node& node() const { return m_node; }
OptionsModel *getOptionsModel();
PeerTableModel *getPeerTableModel();
BanTableModel *getBanTableModel();
//! Return number of connections, default is in- and outbound (total)
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
int getNumBlocks() const;
int getHeaderTipHeight() const;
int64_t getHeaderTipTime() const;
//! Return number of transactions in the mempool
long getMempoolSize() const;
//! Return the dynamic memory usage of the mempool
size_t getMempoolDynamicUsage() const;
quint64 getTotalBytesRecv() const;
quint64 getTotalBytesSent() const;
double getVerificationProgress(const CBlockIndex *tip) const;
QDateTime getLastBlockDate() const;
//! Return true if core is doing initial block download
bool inInitialBlockDownload() const;
//! Returns enum BlockSource of the current importing/syncing state
enum BlockSource getBlockSource() const;
//! Return true if network activity in core is enabled
bool getNetworkActive() const;
//! Toggle network activity state in core
void setNetworkActive(bool active);
//! Return warnings to be displayed in status bar
QString getStatusBarWarnings() const;
@@ -85,6 +75,14 @@ public:
mutable std::atomic<int64_t> cachedBestHeaderTime;
private:
interface::Node& m_node;
std::unique_ptr<interface::Handler> m_handler_show_progress;
std::unique_ptr<interface::Handler> m_handler_notify_num_connections_changed;
std::unique_ptr<interface::Handler> m_handler_notify_network_active_changed;
std::unique_ptr<interface::Handler> m_handler_notify_alert_changed;
std::unique_ptr<interface::Handler> m_handler_banned_list_changed;
std::unique_ptr<interface::Handler> m_handler_notify_block_tip;
std::unique_ptr<interface::Handler> m_handler_notify_header_tip;
OptionsModel *optionsModel;
PeerTableModel *peerTableModel;
BanTableModel *banTableModel;