Raven Core  3.0.0
P2P Digital Currency
bantablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_QT_BANTABLEMODEL_H
7 #define RAVEN_QT_BANTABLEMODEL_H
8 
9 #include "net.h"
10 
11 #include <QAbstractTableModel>
12 #include <QStringList>
13 
14 class ClientModel;
15 class BanTablePriv;
16 
17 struct CCombinedBan {
20 };
21 
23 {
24 public:
25  BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) :
26  column(nColumn), order(fOrder) {}
27  bool operator()(const CCombinedBan& left, const CCombinedBan& right) const;
28 
29 private:
30  int column;
31  Qt::SortOrder order;
32 };
33 
38 class BanTableModel : public QAbstractTableModel
39 {
40  Q_OBJECT
41 
42 public:
43  explicit BanTableModel(ClientModel *parent = 0);
44  ~BanTableModel();
45  void startAutoRefresh();
46  void stopAutoRefresh();
47 
48  enum ColumnIndex {
49  Address = 0,
50  Bantime = 1
51  };
52 
55  int rowCount(const QModelIndex &parent) const;
56  int columnCount(const QModelIndex &parent) const;
57  QVariant data(const QModelIndex &index, int role) const;
58  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
59  QModelIndex index(int row, int column, const QModelIndex &parent) const;
60  Qt::ItemFlags flags(const QModelIndex &index) const;
61  void sort(int column, Qt::SortOrder order);
62  bool shouldShow();
65 public Q_SLOTS:
66  void refresh();
67 
68 private:
70  QStringList columns;
71  std::unique_ptr<BanTablePriv> priv;
72 };
73 
74 #endif // RAVEN_QT_BANTABLEMODEL_H
int flags
Definition: raven-tx.cpp:500
CSubNet subnet
Definition: bantablemodel.h:18
ClientModel * clientModel
Definition: bantablemodel.h:69
QStringList columns
Definition: bantablemodel.h:70
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:71
Model for Raven network client.
Definition: clientmodel.h:39
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
Definition: bantablemodel.h:25
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call...
Definition: bantablemodel.h:38
CBanEntry banEntry
Definition: bantablemodel.h:19
Definition: addrdb.h:27
Qt::SortOrder order
Definition: bantablemodel.h:31