Remove includes in .cpp files for things the corresponding .h file already included
[bitcoinplatinum.git] / src / qt / peertablemodel.h
blobe41fe4bb03b95c73bbdcab7b6ae6a2e4fb61fe5c
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.
5 #ifndef BITCOIN_QT_PEERTABLEMODEL_H
6 #define BITCOIN_QT_PEERTABLEMODEL_H
8 #include <net_processing.h> // For CNodeStateStats
9 #include <net.h>
11 #include <QAbstractTableModel>
12 #include <QStringList>
14 class ClientModel;
15 class PeerTablePriv;
17 QT_BEGIN_NAMESPACE
18 class QTimer;
19 QT_END_NAMESPACE
21 struct CNodeCombinedStats {
22 CNodeStats nodeStats;
23 CNodeStateStats nodeStateStats;
24 bool fNodeStateStatsAvailable;
27 class NodeLessThan
29 public:
30 NodeLessThan(int nColumn, Qt::SortOrder fOrder) :
31 column(nColumn), order(fOrder) {}
32 bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const;
34 private:
35 int column;
36 Qt::SortOrder order;
39 /**
40 Qt model providing information about connected peers, similar to the
41 "getpeerinfo" RPC call. Used by the rpc console UI.
43 class PeerTableModel : public QAbstractTableModel
45 Q_OBJECT
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();
55 enum ColumnIndex {
56 NetNodeId = 0,
57 Address = 1,
58 Ping = 2,
59 Sent = 3,
60 Received = 4,
61 Subversion = 5
64 /** @name Methods overridden from QAbstractTableModel
65 @{*/
66 int rowCount(const QModelIndex &parent) const;
67 int columnCount(const QModelIndex &parent) const;
68 QVariant data(const QModelIndex &index, int role) const;
69 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
70 QModelIndex index(int row, int column, const QModelIndex &parent) const;
71 Qt::ItemFlags flags(const QModelIndex &index) const;
72 void sort(int column, Qt::SortOrder order);
73 /*@}*/
75 public Q_SLOTS:
76 void refresh();
78 private:
79 ClientModel *clientModel;
80 QStringList columns;
81 std::unique_ptr<PeerTablePriv> priv;
82 QTimer *timer;
85 #endif // BITCOIN_QT_PEERTABLEMODEL_H