Bitcoin Core 28.99.0
P2P Digital Currency
bantablemodel.h
Go to the documentation of this file.
1// Copyright (c) 2011-2021 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 <memory>
12
13#include <QAbstractTableModel>
14#include <QStringList>
15
16class BanTablePriv;
17
18namespace interfaces {
19 class Node;
20}
21
25};
26
28{
29public:
30 BannedNodeLessThan(int nColumn, Qt::SortOrder fOrder) :
31 column(nColumn), order(fOrder) {}
32 bool operator()(const CCombinedBan& left, const CCombinedBan& right) const;
33
34private:
35 int column;
36 Qt::SortOrder order;
37};
38
43class BanTableModel : public QAbstractTableModel
44{
45 Q_OBJECT
46
47public:
48 explicit BanTableModel(interfaces::Node& node, QObject* parent);
52
55 Bantime = 1
56 };
57
60 int rowCount(const QModelIndex &parent) const override;
61 int columnCount(const QModelIndex &parent) const override;
62 QVariant data(const QModelIndex &index, int role) const override;
63 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
64 QModelIndex index(int row, int column, const QModelIndex &parent) const override;
65 Qt::ItemFlags flags(const QModelIndex &index) const override;
66 void sort(int column, Qt::SortOrder order) override;
69 bool shouldShow();
70
71 bool unban(const QModelIndex& index);
72
73public Q_SLOTS:
74 void refresh();
75
76private:
78 QStringList columns;
79 std::unique_ptr<BanTablePriv> priv;
80};
81
82#endif // BITCOIN_QT_BANTABLEMODEL_H
Qt model providing information about banned peers, similar to the "getpeerinfo" RPC call.
Definition: bantablemodel.h:44
std::unique_ptr< BanTablePriv > priv
Definition: bantablemodel.h:79
QVariant data(const QModelIndex &index, int role) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
interfaces::Node & m_node
Definition: bantablemodel.h:77
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()
bool unban(const QModelIndex &index)
QStringList columns
Definition: bantablemodel.h:78
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:30
Qt::SortOrder order
Definition: bantablemodel.h:36
bool operator()(const CCombinedBan &left, const CCombinedBan &right) const
Definition: net_types.h:15
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:71
Definition: messages.h:20
CBanEntry banEntry
Definition: bantablemodel.h:24
CSubNet subnet
Definition: bantablemodel.h:23