BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
bantablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2018 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 <memory>
11 
12 #include <QAbstractTableModel>
13 #include <QStringList>
14 
15 class ClientModel;
16 class BanTablePriv;
17 
18 namespace interfaces {
19  class Node;
20 }
21 
22 struct CCombinedBan {
25 };
26 
28 {
29 public:
30  BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) :
31  column(nColumn), order(fOrder) {}
32  bool operator()(const CCombinedBan& left, const CCombinedBan& right) const;
33 
34 private:
35  int column;
36  Qt::SortOrder order;
37 };
38 
43 class BanTableModel : public QAbstractTableModel
44 {
45  Q_OBJECT
46 
47 public:
48  explicit BanTableModel(interfaces::Node& node, ClientModel *parent = 0);
50  void startAutoRefresh();
51  void stopAutoRefresh();
52 
53  enum ColumnIndex {
54  Address = 0,
55  Bantime = 1
56  };
57 
60  int rowCount(const QModelIndex &parent) const;
61  int columnCount(const QModelIndex &parent) const;
62  QVariant data(const QModelIndex &index, int role) const;
63  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
64  QModelIndex index(int row, int column, const QModelIndex &parent) const;
65  Qt::ItemFlags flags(const QModelIndex &index) const;
66  void sort(int column, Qt::SortOrder order);
67  bool shouldShow();
70 public Q_SLOTS:
71  void refresh();
72 
73 private:
76  QStringList columns;
77  std::unique_ptr<BanTablePriv> priv;
78 };
79 
80 #endif // BITCOIN_QT_BANTABLEMODEL_H
int columnCount(const QModelIndex &parent) const
void startAutoRefresh()
BanTableModel(interfaces::Node &node, ClientModel *parent=0)
CSubNet subnet
Definition: bantablemodel.h:23
QVariant data(const QModelIndex &index, int role) const
ClientModel * clientModel
Definition: bantablemodel.h:75
QStringList columns
Definition: bantablemodel.h:76
QVariant headerData(int section, Qt::Orientation orientation, int role) const
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:77
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
Model for Bitcoin network client.
Definition: clientmodel.h:44
interfaces::Node & m_node
Definition: bantablemodel.h:74
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
Definition: bantablemodel.h:30
int rowCount(const QModelIndex &parent) const
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call...
Definition: bantablemodel.h:43
CBanEntry banEntry
Definition: bantablemodel.h:24
QModelIndex index(int row, int column, const QModelIndex &parent) const
Definition: addrdb.h:26
void sort(int column, Qt::SortOrder order)
Top-level interface for a bitcoin node (bsha3d process).
Definition: node.h:35
Qt::SortOrder order
Definition: bantablemodel.h:36
void stopAutoRefresh()
Qt::ItemFlags flags(const QModelIndex &index) const