Merge #11997: [tests] util_tests.cpp: actually check ignored args
[bitcoinplatinum.git] / src / qt / bantablemodel.h
bloba54f8793d0089fc2c3a48a9b3d302e3f4642db4b
1 // Copyright (c) 2011-2017 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.
5 #ifndef BITCOIN_QT_BANTABLEMODEL_H
6 #define BITCOIN_QT_BANTABLEMODEL_H
8 #include <net.h>
10 #include <QAbstractTableModel>
11 #include <QStringList>
13 class ClientModel;
14 class BanTablePriv;
16 struct CCombinedBan {
17 CSubNet subnet;
18 CBanEntry banEntry;
21 class BannedNodeLessThan
23 public:
24 BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) :
25 column(nColumn), order(fOrder) {}
26 bool operator()(const CCombinedBan& left, const CCombinedBan& right) const;
28 private:
29 int column;
30 Qt::SortOrder order;
33 /**
34 Qt model providing information about connected peers, similar to the
35 "getpeerinfo" RPC call. Used by the rpc console UI.
37 class BanTableModel : public QAbstractTableModel
39 Q_OBJECT
41 public:
42 explicit BanTableModel(ClientModel *parent = 0);
43 ~BanTableModel();
44 void startAutoRefresh();
45 void stopAutoRefresh();
47 enum ColumnIndex {
48 Address = 0,
49 Bantime = 1
52 /** @name Methods overridden from QAbstractTableModel
53 @{*/
54 int rowCount(const QModelIndex &parent) const;
55 int columnCount(const QModelIndex &parent) const;
56 QVariant data(const QModelIndex &index, int role) const;
57 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
58 QModelIndex index(int row, int column, const QModelIndex &parent) const;
59 Qt::ItemFlags flags(const QModelIndex &index) const;
60 void sort(int column, Qt::SortOrder order);
61 bool shouldShow();
62 /*@}*/
64 public Q_SLOTS:
65 void refresh();
67 private:
68 ClientModel *clientModel;
69 QStringList columns;
70 std::unique_ptr<BanTablePriv> priv;
73 #endif // BITCOIN_QT_BANTABLEMODEL_H