aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-04-17 16:02:44 -0400
committerJohn Newbery <john@johnnewbery.com>2018-04-04 16:52:40 -0400
commit3034a462a5d30144cf0ec801d07f0c8c36d560f3 (patch)
tree13e518ccabc2cb1e91aaab1d7edbe0d814f510ec /src/qt
parente0b66a3b7c5d3a079636d61fcf611bb6b36c7bc1 (diff)
Remove direct bitcoin calls from qt/bantablemodel.cpp
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bantablemodel.cpp11
-rw-r--r--src/qt/bantablemodel.h7
-rw-r--r--src/qt/clientmodel.cpp2
3 files changed, 13 insertions, 7 deletions
diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp
index c89c90e118..cbd67d70ab 100644
--- a/src/qt/bantablemodel.cpp
+++ b/src/qt/bantablemodel.cpp
@@ -8,6 +8,7 @@
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
+#include <interface/node.h>
#include <sync.h>
#include <utiltime.h>
@@ -45,11 +46,10 @@ public:
Qt::SortOrder sortOrder;
/** Pull a full list of banned nodes from CNode into our cache */
- void refreshBanlist()
+ void refreshBanlist(interface::Node& node)
{
banmap_t banMap;
- if(g_connman)
- g_connman->GetBanned(banMap);
+ node.getBanned(banMap);
cachedBanlist.clear();
#if QT_VERSION >= 0x040700
@@ -82,8 +82,9 @@ public:
}
};
-BanTableModel::BanTableModel(ClientModel *parent) :
+BanTableModel::BanTableModel(interface::Node& node, ClientModel *parent) :
QAbstractTableModel(parent),
+ m_node(node),
clientModel(parent)
{
columns << tr("IP/Netmask") << tr("Banned Until");
@@ -168,7 +169,7 @@ QModelIndex BanTableModel::index(int row, int column, const QModelIndex &parent)
void BanTableModel::refresh()
{
Q_EMIT layoutAboutToBeChanged();
- priv->refreshBanlist();
+ priv->refreshBanlist(m_node);
Q_EMIT layoutChanged();
}
diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h
index a54f8793d0..fcb364d40b 100644
--- a/src/qt/bantablemodel.h
+++ b/src/qt/bantablemodel.h
@@ -13,6 +13,10 @@
class ClientModel;
class BanTablePriv;
+namespace interface {
+ class Node;
+}
+
struct CCombinedBan {
CSubNet subnet;
CBanEntry banEntry;
@@ -39,7 +43,7 @@ class BanTableModel : public QAbstractTableModel
Q_OBJECT
public:
- explicit BanTableModel(ClientModel *parent = 0);
+ explicit BanTableModel(interface::Node& node, ClientModel *parent = 0);
~BanTableModel();
void startAutoRefresh();
void stopAutoRefresh();
@@ -65,6 +69,7 @@ public Q_SLOTS:
void refresh();
private:
+ interface::Node& m_node;
ClientModel *clientModel;
QStringList columns;
std::unique_ptr<BanTablePriv> priv;
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 84cfb79549..1dbfc815b6 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -43,7 +43,7 @@ ClientModel::ClientModel(interface::Node& node, OptionsModel *_optionsModel, QOb
cachedBestHeaderHeight = -1;
cachedBestHeaderTime = -1;
peerTableModel = new PeerTableModel(m_node, this);
- banTableModel = new BanTableModel(this);
+ banTableModel = new BanTableModel(m_node, this);
pollTimer = new QTimer(this);
connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer()));
pollTimer->start(MODEL_UPDATE_DELAY);