Changeset View
Changeset View
Standalone View
Standalone View
src/qt/peertablemodel.h
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_QT_PEERTABLEMODEL_H | #ifndef BITCOIN_QT_PEERTABLEMODEL_H | ||||
#define BITCOIN_QT_PEERTABLEMODEL_H | #define BITCOIN_QT_PEERTABLEMODEL_H | ||||
#include <net.h> | #include <net.h> | ||||
#include <net_processing.h> // For CNodeStateStats | #include <net_processing.h> // For CNodeStateStats | ||||
#include <QAbstractTableModel> | #include <QAbstractTableModel> | ||||
#include <QStringList> | #include <QStringList> | ||||
#include <memory> | #include <memory> | ||||
class ClientModel; | |||||
class PeerTablePriv; | class PeerTablePriv; | ||||
namespace interfaces { | namespace interfaces { | ||||
class Node; | class Node; | ||||
} | } | ||||
QT_BEGIN_NAMESPACE | QT_BEGIN_NAMESPACE | ||||
class QTimer; | class QTimer; | ||||
Show All 20 Lines | |||||
/** | /** | ||||
* Qt model providing information about connected peers, similar to the | * Qt model providing information about connected peers, similar to the | ||||
* "getpeerinfo" RPC call. Used by the rpc console UI. | * "getpeerinfo" RPC call. Used by the rpc console UI. | ||||
*/ | */ | ||||
class PeerTableModel : public QAbstractTableModel { | class PeerTableModel : public QAbstractTableModel { | ||||
Q_OBJECT | Q_OBJECT | ||||
public: | public: | ||||
explicit PeerTableModel(interfaces::Node &node, | explicit PeerTableModel(interfaces::Node &node, QObject *parent); | ||||
ClientModel *parent = nullptr); | |||||
~PeerTableModel(); | ~PeerTableModel(); | ||||
const CNodeCombinedStats *getNodeStats(int idx); | const CNodeCombinedStats *getNodeStats(int idx); | ||||
int getRowByNodeId(NodeId nodeid); | int getRowByNodeId(NodeId nodeid); | ||||
void startAutoRefresh(); | void startAutoRefresh(); | ||||
void stopAutoRefresh(); | void stopAutoRefresh(); | ||||
enum ColumnIndex { | enum ColumnIndex { | ||||
NetNodeId = 0, | NetNodeId = 0, | ||||
Show All 17 Lines | public: | ||||
void sort(int column, Qt::SortOrder order) override; | void sort(int column, Qt::SortOrder order) override; | ||||
/*@}*/ | /*@}*/ | ||||
public Q_SLOTS: | public Q_SLOTS: | ||||
void refresh(); | void refresh(); | ||||
private: | private: | ||||
interfaces::Node &m_node; | interfaces::Node &m_node; | ||||
ClientModel *clientModel; | |||||
QStringList columns; | QStringList columns; | ||||
std::unique_ptr<PeerTablePriv> priv; | std::unique_ptr<PeerTablePriv> priv; | ||||
QTimer *timer; | QTimer *timer; | ||||
}; | }; | ||||
#endif // BITCOIN_QT_PEERTABLEMODEL_H | #endif // BITCOIN_QT_PEERTABLEMODEL_H |