13 #include "validation.h"
26 if (
order == Qt::DescendingOrder)
27 std::swap(pLeft, pRight);
61 std::vector<CNodeStats> vstats;
81 stats.fNodeStateStatsAvailable =
GetNodeStateStats(stats.nodeStats.nodeid, stats.nodeStateStats);
115 columns << tr(
"NodeID") << tr(
"Address/Hostname") << tr(
"Version") << tr(
"Ping Time");
121 timer =
new QTimer();
123 timer->setInterval(MODEL_UPDATE_DELAY);
154 if (!
index.isValid())
159 if (role == Qt::DisplayRole) {
160 switch(
index.column()) {
170 }
else if (role == Qt::TextAlignmentRole) {
172 return (
int)(Qt::AlignRight | Qt::AlignVCenter);
180 if (orientation == Qt::Horizontal) {
181 if (role == Qt::DisplayRole && section <
columns.size()) {
190 if (!
index.isValid())
191 return Qt::NoItemFlags;
193 Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
203 return createIndex(row, column,
data);
205 return QModelIndex();
216 Q_EMIT layoutAboutToBeChanged();
218 Q_EMIT layoutChanged();
Model for PIVX network client.
bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const
QModelIndex index(int row, int column, const QModelIndex &parent) const
QVariant data(const QModelIndex &index, int role) const
int rowCount(const QModelIndex &parent) const
PeerTableModel(ClientModel *parent=0)
const CNodeCombinedStats * getNodeStats(int idx)
int getRowByNodeId(NodeId nodeid)
QVariant headerData(int section, Qt::Orientation orientation, int role) const
void sort(int column, Qt::SortOrder order)
Qt::ItemFlags flags(const QModelIndex &index) const
int columnCount(const QModelIndex &parent) const
void refreshPeers()
Pull a full list of peers from vNodes into our cache.
int sortColumn
Column to sort nodes by.
CNodeCombinedStats * index(int idx)
QList< CNodeCombinedStats > cachedNodeStats
Local cache of peer information.
Qt::SortOrder sortOrder
Order (ascending or descending) to sort nodes by.
std::map< NodeId, int > mapNodeRows
Index of rows by node ID.
std::unique_ptr< CConnman > g_connman
QString formatPingTime(double dPingTime)
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats)
Get statistics from node state.
RecursiveMutex cs_main
Global state.
CNodeStateStats nodeStateStats
bool fNodeStateStatsAvailable
#define TRY_LOCK(cs, name)