Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
qt
peertablemodel.h
Go to the documentation of this file.
1
// Copyright (c) 2011-present 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_PEERTABLEMODEL_H
6
#define BITCOIN_QT_PEERTABLEMODEL_H
7
8
#include <
net_processing.h
>
9
#include <net.h>
10
11
#include <QAbstractTableModel>
12
#include <QList>
13
#include <QModelIndex>
14
#include <QStringList>
15
#include <QVariant>
16
17
class
PeerTablePriv;
18
19
namespace
interfaces
{
20
class
Node
;
21
}
22
23
QT_BEGIN_NAMESPACE
24
class
QTimer;
25
QT_END_NAMESPACE
26
27
struct
CNodeCombinedStats
{
28
CNodeStats
nodeStats
;
29
CNodeStateStats
nodeStateStats
;
30
bool
fNodeStateStatsAvailable
;
31
};
32
Q_DECLARE_METATYPE(
CNodeCombinedStats
*)
33
34
38
class
PeerTableModel
: public QAbstractTableModel
39
{
40
Q_OBJECT
41
42
public
:
43
explicit
PeerTableModel
(
interfaces::Node
&
node
, QObject* parent);
44
~PeerTableModel
();
45
void
startAutoRefresh
();
46
void
stopAutoRefresh
();
47
48
enum
ColumnIndex
{
49
NetNodeId
= 0,
50
Age
,
51
Address
,
52
Direction
,
53
ConnectionType
,
54
Network
,
55
Ping
,
56
Sent
,
57
Received
,
58
Subversion
59
};
60
61
enum
{
62
StatsRole
= Qt::UserRole,
63
};
64
67
int
rowCount(
const
QModelIndex& parent = QModelIndex())
const override
;
68
int
columnCount(
const
QModelIndex& parent = QModelIndex())
const override
;
69
QVariant data(
const
QModelIndex& index,
int
role = Qt::DisplayRole)
const override
;
70
QVariant headerData(
int
section, Qt::Orientation orientation,
int
role = Qt::DisplayRole)
const override
;
71
QModelIndex index(
int
row,
int
column,
const
QModelIndex& parent = QModelIndex())
const override
;
72
Qt::ItemFlags
flags
(
const
QModelIndex &index)
const override
;
74
75
public
Q_SLOTS:
76
void
refresh();
77
78
private
:
80
QList<CNodeCombinedStats>
m_peers_data
{};
81
interfaces::Node
&
m_node
;
82
const
QStringList
columns
{
83
/*: Title of Peers Table column which contains a
84
unique number used to identify a connection. */
85
tr(
"Peer"
),
86
/*: Title of Peers Table column which indicates the duration (length of time)
87
since the peer connection started. */
88
tr(
"Age"
),
89
/*: Title of Peers Table column which contains the
90
IP/Onion/I2P address of the connected peer. */
91
tr(
"Address"
),
92
/*: Title of Peers Table column which indicates the direction
93
the peer connection was initiated from. */
94
tr(
"Direction"
),
95
/*: Title of Peers Table column which describes the type of
96
peer connection. The "type" describes why the connection exists. */
97
tr(
"Type"
),
98
/*: Title of Peers Table column which states the network the peer
99
connected through. */
100
tr(
"Network"
),
101
/*: Title of Peers Table column which indicates the current latency
102
of the connection with the peer. */
103
tr(
"Ping"
),
104
/*: Title of Peers Table column which indicates the total amount of
105
network information we have sent to the peer. */
106
tr(
"Sent"
),
107
/*: Title of Peers Table column which indicates the total amount of
108
network information we have received from the peer. */
109
tr(
"Received"
),
110
/*: Title of Peers Table column which contains the peer's
111
User Agent string. */
112
tr(
"User Agent"
)};
113
QTimer*
timer
{
nullptr
};
114
};
115
116
#endif
// BITCOIN_QT_PEERTABLEMODEL_H
flags
int flags
Definition
bitcoin-tx.cpp:529
CNodeStats
Definition
net.h:192
PeerTableModel::ColumnIndex
ColumnIndex
Definition
peertablemodel.h:48
PeerTableModel::Address
@ Address
Definition
peertablemodel.h:51
PeerTableModel::ConnectionType
@ ConnectionType
Definition
peertablemodel.h:53
PeerTableModel::Ping
@ Ping
Definition
peertablemodel.h:55
PeerTableModel::Network
@ Network
Definition
peertablemodel.h:54
PeerTableModel::NetNodeId
@ NetNodeId
Definition
peertablemodel.h:49
PeerTableModel::Sent
@ Sent
Definition
peertablemodel.h:56
PeerTableModel::Subversion
@ Subversion
Definition
peertablemodel.h:58
PeerTableModel::Age
@ Age
Definition
peertablemodel.h:50
PeerTableModel::Direction
@ Direction
Definition
peertablemodel.h:52
PeerTableModel::Received
@ Received
Definition
peertablemodel.h:57
PeerTableModel::StatsRole
@ StatsRole
Definition
peertablemodel.h:62
PeerTableModel::stopAutoRefresh
void stopAutoRefresh()
Definition
peertablemodel.cpp:37
PeerTableModel::m_node
interfaces::Node & m_node
Definition
peertablemodel.h:81
PeerTableModel::timer
QTimer * timer
Definition
peertablemodel.h:113
PeerTableModel::m_peers_data
QList< CNodeCombinedStats > m_peers_data
Internal peer data structure.
Definition
peertablemodel.h:80
PeerTableModel::~PeerTableModel
~PeerTableModel()
PeerTableModel::columns
const QStringList columns
Definition
peertablemodel.h:82
PeerTableModel::PeerTableModel
PeerTableModel(interfaces::Node &node, QObject *parent)
Definition
peertablemodel.cpp:17
PeerTableModel::startAutoRefresh
void startAutoRefresh()
Definition
peertablemodel.cpp:32
interfaces::Node
Top-level interface for a bitcoin node (bitcoind process).
Definition
node.h:70
interfaces
Definition
interfaces.cpp:41
node
Definition
messages.h:21
net_processing.h
CNodeCombinedStats
Definition
peertablemodel.h:27
CNodeCombinedStats::nodeStateStats
CNodeStateStats nodeStateStats
Definition
peertablemodel.h:29
CNodeCombinedStats::nodeStats
CNodeStats nodeStats
Definition
peertablemodel.h:28
CNodeCombinedStats::fNodeStateStatsAvailable
bool fNodeStateStatsAvailable
Definition
peertablemodel.h:30
CNodeStateStats
Definition
net_processing.h:53
Generated on
for Bitcoin Core by
1.17.0