Bitcoin ABC  0.22.12
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);
46  ~BanTableModel();
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;
63  bool shouldShow();
66 public Q_SLOTS:
67  void refresh();
68 
69 private:
71  QStringList columns;
72  std::unique_ptr<BanTablePriv> priv;
73 };
74 
75 #endif // BITCOIN_QT_BANTABLEMODEL_H
CSubNet subnet
Definition: bantablemodel.h:22
QStringList columns
Definition: bantablemodel.h:71
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:72
interfaces::Node & m_node
Definition: bantablemodel.h:70
int flags
Definition: bitcoin-tx.cpp:529
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
Definition: bantablemodel.h:28
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call...
Definition: bantablemodel.h:41
CBanEntry banEntry
Definition: bantablemodel.h:23
Definition: addrdb.h:21
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:45
Qt::SortOrder order
Definition: bantablemodel.h:34