Bitcoin ABC 0.30.5
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 <addrdb.h>
9#include <net.h>
10
11#include <QAbstractTableModel>
12#include <QStringList>
13
14#include <memory>
15
16class BanTablePriv;
17
18namespace interfaces {
19class Node;
20}
21
25};
26
28public:
29 BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
30 : column(nColumn), order(fOrder) {}
31 bool operator()(const CCombinedBan &left, const CCombinedBan &right) const;
32
33private:
34 int column;
35 Qt::SortOrder order;
36};
37
42class BanTableModel : public QAbstractTableModel {
43 Q_OBJECT
44
45public:
46 explicit BanTableModel(interfaces::Node &node, QObject *parent);
50
51 enum ColumnIndex { Address = 0, Bantime = 1 };
52
55 int rowCount(const QModelIndex &parent) const override;
56 int columnCount(const QModelIndex &parent) const override;
57 QVariant data(const QModelIndex &index, int role) const override;
58 QVariant headerData(int section, Qt::Orientation orientation,
59 int role) const override;
60 QModelIndex index(int row, int column,
61 const QModelIndex &parent) const override;
62 Qt::ItemFlags flags(const QModelIndex &index) const override;
63 void sort(int column, Qt::SortOrder order) override;
66 bool shouldShow();
67
68public Q_SLOTS:
69 void refresh();
70
71private:
73 QStringList columns;
74 std::unique_ptr<BanTablePriv> priv;
75};
76
77#endif // BITCOIN_QT_BANTABLEMODEL_H
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
Definition: bantablemodel.h:42
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:74
QVariant data(const QModelIndex &index, int role) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
interfaces::Node & m_node
Definition: bantablemodel.h:72
int columnCount(const QModelIndex &parent) const override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
void stopAutoRefresh()
void sort(int column, Qt::SortOrder order) override
int rowCount(const QModelIndex &parent) const override
void startAutoRefresh()
QStringList columns
Definition: bantablemodel.h:73
QModelIndex index(int row, int column, const QModelIndex &parent) const override
BanTableModel(interfaces::Node &node, QObject *parent)
BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder)
Definition: bantablemodel.h:29
Qt::SortOrder order
Definition: bantablemodel.h:35
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
Definition: addrdb.h:30
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:59
Definition: init.h:28
CBanEntry banEntry
Definition: bantablemodel.h:24
CSubNet subnet
Definition: bantablemodel.h:23