aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-04-17 15:37:36 -0400
committerJohn Newbery <john@johnnewbery.com>2018-04-04 16:52:40 -0400
commitfe6f27e6ea68a139d3a98b30a53706008ef8b132 (patch)
treeb464ec4ceb05146ccd8c2f4e7f44559546a6e72c /src/qt/clientmodel.h
parent5fba3af21e44ab7552c57782de430c1f4cfd6697 (diff)
Remove direct bitcoin calls from qt/clientmodel.cpp
Diffstat (limited to 'src/qt/clientmodel.h')
-rw-r--r--src/qt/clientmodel.h36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 1118bc31b3..9faa10b87e 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -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;