Changeset View
Changeset View
Standalone View
Standalone View
src/qt/peertablemodel.cpp
// 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. | ||||
#include <qt/peertablemodel.h> | #include <qt/peertablemodel.h> | ||||
#include <qt/clientmodel.h> | |||||
#include <qt/guiconstants.h> | #include <qt/guiconstants.h> | ||||
#include <qt/guiutil.h> | #include <qt/guiutil.h> | ||||
#include <interfaces/node.h> | #include <interfaces/node.h> | ||||
#include <utility> | #include <utility> | ||||
#include <QDebug> | #include <QDebug> | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | CNodeCombinedStats *index(int idx) { | ||||
if (idx >= 0 && idx < cachedNodeStats.size()) { | if (idx >= 0 && idx < cachedNodeStats.size()) { | ||||
return &cachedNodeStats[idx]; | return &cachedNodeStats[idx]; | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
}; | }; | ||||
PeerTableModel::PeerTableModel(interfaces::Node &node, ClientModel *parent) | PeerTableModel::PeerTableModel(interfaces::Node &node, QObject *parent) | ||||
: QAbstractTableModel(parent), m_node(node), clientModel(parent), | : QAbstractTableModel(parent), m_node(node), timer(nullptr) { | ||||
timer(nullptr) { | |||||
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()); | ||||
// set up timer for auto refresh | // set up timer for auto refresh | ||||
timer = new QTimer(this); | timer = new QTimer(this); | ||||
connect(timer, &QTimer::timeout, this, &PeerTableModel::refresh); | connect(timer, &QTimer::timeout, this, &PeerTableModel::refresh); | ||||
timer->setInterval(MODEL_UPDATE_DELAY); | timer->setInterval(MODEL_UPDATE_DELAY); | ||||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |