Fabcoin Core  0.16.2
P2P Digital Currency
peertablemodel.h
Go to the documentation of this file.
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.
4 
5 #ifndef FABCOIN_QT_PEERTABLEMODEL_H
6 #define FABCOIN_QT_PEERTABLEMODEL_H
7 
8 #include <net_processing.h> // For CNodeStateStats
9 #include <net.h>
10 
11 #include <QAbstractTableModel>
12 #include <QStringList>
13 
14 class ClientModel;
15 class PeerTablePriv;
16 
17 QT_BEGIN_NAMESPACE
18 class QTimer;
19 QT_END_NAMESPACE
20 
25 };
26 
28 {
29 public:
30  NodeLessThan(int nColumn, Qt::SortOrder fOrder) :
31  column(nColumn), order(fOrder) {}
32  bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const;
33 
34 private:
35  int column;
36  Qt::SortOrder order;
37 };
38 
43 class PeerTableModel : public QAbstractTableModel
44 {
45  Q_OBJECT
46 
47 public:
48  explicit PeerTableModel(ClientModel *parent = 0);
49  ~PeerTableModel();
50  const CNodeCombinedStats *getNodeStats(int idx);
51  int getRowByNodeId(NodeId nodeid);
52  void startAutoRefresh();
53  void stopAutoRefresh();
54 
55  enum ColumnIndex {
56  NetNodeId = 0,
57  Address = 1,
58  Subversion = 2,
59  Ping = 3
60  };
61 
64  int rowCount(const QModelIndex &parent) const;
65  int columnCount(const QModelIndex &parent) const;
66  QVariant data(const QModelIndex &index, int role) const;
67  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
68  QModelIndex index(int row, int column, const QModelIndex &parent) const;
69  Qt::ItemFlags flags(const QModelIndex &index) const;
70  void sort(int column, Qt::SortOrder order);
73 public Q_SLOTS:
74  void refresh();
75 
76 private:
78  QStringList columns;
79  std::unique_ptr<PeerTablePriv> priv;
80  QTimer *timer;
81 };
82 
83 #endif // FABCOIN_QT_PEERTABLEMODEL_H
CNodeStateStats nodeStateStats
h160 Address
An Ethereum address: 20 bytes.
Definition: Common.h:62
QStringList columns
NodeLessThan(int nColumn, Qt::SortOrder fOrder)
Qt::SortOrder order
CNodeStats nodeStats
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call...
std::unique_ptr< PeerTablePriv > priv
int64_t NodeId
Definition: net.h:93
Model for Fabcoin network client.
Definition: clientmodel.h:38
ClientModel * clientModel
uint8_t const * data
Definition: sha3.h:19