Bitcoin ABC  0.24.7
P2P Digital Currency
bantablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_BANTABLEMODEL_H
6 #define BITCOIN_QT_BANTABLEMODEL_H
7 
8 #include <net.h>
9 
10 #include <QAbstractTableModel>
11 #include <QStringList>
12 
13 #include <memory>
14 
15 class BanTablePriv;
16 
17 namespace interfaces {
18 class Node;
19 }
20 
21 struct CCombinedBan {
24 };
25 
27 public:
28  BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
29  : column(nColumn), order(fOrder) {}
30  bool operator()(const CCombinedBan &left, const CCombinedBan &right) const;
31 
32 private:
33  int column;
34  Qt::SortOrder order;
35 };
36 
41 class BanTableModel : public QAbstractTableModel {
42  Q_OBJECT
43 
44 public:
45  explicit BanTableModel(interfaces::Node &node, QObject *parent);
47  void startAutoRefresh();
48  void stopAutoRefresh();
49 
50  enum ColumnIndex { Address = 0, Bantime = 1 };
51 
54  int rowCount(const QModelIndex &parent) const override;
55  int columnCount(const QModelIndex &parent) const override;
56  QVariant data(const QModelIndex &index, int role) const override;
57  QVariant headerData(int section, Qt::Orientation orientation,
58  int role) const override;
59  QModelIndex index(int row, int column,
60  const QModelIndex &parent) const override;
61  Qt::ItemFlags flags(const QModelIndex &index) const override;
62  void sort(int column, Qt::SortOrder order) override;
65  bool shouldShow();
66 
67 public Q_SLOTS:
68  void refresh();
69 
70 private:
72  QStringList columns;
73  std::unique_ptr<BanTablePriv> priv;
74 };
75 
76 #endif // BITCOIN_QT_BANTABLEMODEL_H
interfaces
Definition: dummywallet.cpp:12
CCombinedBan
Definition: bantablemodel.h:21
BanTableModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Definition: bantablemodel.cpp:125
CCombinedBan::banEntry
CBanEntry banEntry
Definition: bantablemodel.h:23
BannedNodeLessThan::operator()
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
Definition: bantablemodel.cpp:18
BanTableModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: bantablemodel.cpp:135
BannedNodeLessThan::order
Qt::SortOrder order
Definition: bantablemodel.h:34
BanTableModel
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
Definition: bantablemodel.h:41
BanTableModel::Bantime
@ Bantime
Definition: bantablemodel.h:50
BanTableModel::BanTableModel
BanTableModel(interfaces::Node &node, QObject *parent)
Definition: bantablemodel.cpp:81
CCombinedBan::subnet
CSubNet subnet
Definition: bantablemodel.h:22
BanTableModel::startAutoRefresh
void startAutoRefresh()
BanTableModel::sort
void sort(int column, Qt::SortOrder order) override
Definition: bantablemodel.cpp:161
BanTableModel::stopAutoRefresh
void stopAutoRefresh()
BanTableModel::~BanTableModel
~BanTableModel()
Definition: bantablemodel.cpp:90
CSubNet
Definition: netaddress.h:465
BanTableModel::ColumnIndex
ColumnIndex
Definition: bantablemodel.h:50
interfaces::Node
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:55
BanTableModel::shouldShow
bool shouldShow()
Definition: bantablemodel.cpp:167
BanTableModel::index
QModelIndex index(int row, int column, const QModelIndex &parent) const override
Definition: bantablemodel.cpp:144
BannedNodeLessThan
Definition: bantablemodel.h:26
BanTableModel::priv
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:73
BannedNodeLessThan::BannedNodeLessThan
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
Definition: bantablemodel.h:28
BanTableModel::columnCount
int columnCount(const QModelIndex &parent) const override
Definition: bantablemodel.cpp:99
CBanEntry
Definition: addrdb.h:21
BanTableModel::rowCount
int rowCount(const QModelIndex &parent) const override
Definition: bantablemodel.cpp:94
BanTableModel::m_node
interfaces::Node & m_node
Definition: bantablemodel.h:71
net.h
BanTableModel::data
QVariant data(const QModelIndex &index, int role) const override
Definition: bantablemodel.cpp:104
BanTableModel::refresh
void refresh()
Definition: bantablemodel.cpp:155
BannedNodeLessThan::column
int column
Definition: bantablemodel.h:33
BanTableModel::columns
QStringList columns
Definition: bantablemodel.h:72
BanTablePriv
Definition: bantablemodel.cpp:39
BanTableModel::Address
@ Address
Definition: bantablemodel.h:50