PIVX Core  5.6.99
P2P Digital Currency
bantablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin Core developers
2 // Copyright (c) 2018 The PIVX 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 PIVX_QT_BANTABLEMODEL_H
7 #define PIVX_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);
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 // PIVX_QT_BANTABLEMODEL_H
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
Definition: bantablemodel.h:39
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:71
QVariant data(const QModelIndex &index, int role) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
int rowCount(const QModelIndex &parent) const
BanTableModel(ClientModel *parent=0)
void sort(int column, Qt::SortOrder order)
Qt::ItemFlags flags(const QModelIndex &index) const
void stopAutoRefresh()
int columnCount(const QModelIndex &parent) const
void startAutoRefresh()
QStringList columns
Definition: bantablemodel.h:70
QModelIndex index(int row, int column, const QModelIndex &parent) const
ClientModel * clientModel
Definition: bantablemodel.h:69
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
Definition: bantablemodel.h:25
Qt::SortOrder order
Definition: bantablemodel.h:31
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
Definition: addrdb.h:29
Model for PIVX network client.
Definition: clientmodel.h:50
CBanEntry banEntry
Definition: bantablemodel.h:19
CSubNet subnet
Definition: bantablemodel.h:18