Changeset View
Changeset View
Standalone View
Standalone View
src/qt/peertablemodel.cpp
Show All 40 Lines | bool NodeLessThan::operator()(const CNodeCombinedStats &left, | ||||
return false; | return false; | ||||
} | } | ||||
// private implementation | // private implementation | ||||
class PeerTablePriv { | class PeerTablePriv { | ||||
public: | public: | ||||
/** Local cache of peer information */ | /** Local cache of peer information */ | ||||
QList<CNodeCombinedStats> cachedNodeStats; | QList<CNodeCombinedStats> cachedNodeStats; | ||||
/** Column to sort nodes by */ | /** Column to sort nodes by (default to unsorted) */ | ||||
int sortColumn; | int sortColumn{-1}; | ||||
/** Order (ascending or descending) to sort nodes by */ | /** Order (ascending or descending) to sort nodes by */ | ||||
Qt::SortOrder sortOrder; | Qt::SortOrder sortOrder; | ||||
/** Index of rows by node ID */ | /** Index of rows by node ID */ | ||||
std::map<NodeId, int> mapNodeRows; | std::map<NodeId, int> mapNodeRows; | ||||
/** Pull a full list of peers from vNodes into our cache */ | /** Pull a full list of peers from vNodes into our cache */ | ||||
void refreshPeers(interfaces::Node &node) { | void refreshPeers(interfaces::Node &node) { | ||||
{ | { | ||||
Show All 37 Lines | public: | ||||
} | } | ||||
}; | }; | ||||
PeerTableModel::PeerTableModel(interfaces::Node &node, ClientModel *parent) | PeerTableModel::PeerTableModel(interfaces::Node &node, ClientModel *parent) | ||||
: QAbstractTableModel(parent), m_node(node), clientModel(parent), timer(0) { | : QAbstractTableModel(parent), m_node(node), clientModel(parent), timer(0) { | ||||
columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") | columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") | ||||
<< tr("Received") << tr("User Agent"); | << tr("Received") << tr("User Agent"); | ||||
priv.reset(new PeerTablePriv()); | priv.reset(new PeerTablePriv()); | ||||
// default to unsorted | |||||
priv->sortColumn = -1; | |||||
// set up timer for auto refresh | // set up timer for auto refresh | ||||
timer = new QTimer(this); | timer = new QTimer(this); | ||||
connect(timer, SIGNAL(timeout()), SLOT(refresh())); | connect(timer, SIGNAL(timeout()), SLOT(refresh())); | ||||
timer->setInterval(MODEL_UPDATE_DELAY); | timer->setInterval(MODEL_UPDATE_DELAY); | ||||
// load initial data | // load initial data | ||||
refresh(); | refresh(); | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |