Changeset View
Changeset View
Standalone View
Standalone View
src/qt/rpcconsole.cpp
Show All 11 Lines | |||||
#include "qt/bantablemodel.h" | #include "qt/bantablemodel.h" | ||||
#include "qt/clientmodel.h" | #include "qt/clientmodel.h" | ||||
#include "qt/guiutil.h" | #include "qt/guiutil.h" | ||||
#include "qt/platformstyle.h" | #include "qt/platformstyle.h" | ||||
#include "qt/walletmodel.h" | #include "qt/walletmodel.h" | ||||
#include "chainparams.h" | #include "chainparams.h" | ||||
#include "config.h" | #include "config.h" | ||||
#include "interfaces/node.h" | |||||
#include "netbase.h" | #include "netbase.h" | ||||
#include "rpc/client.h" | #include "rpc/client.h" | ||||
#include "rpc/server.h" | #include "rpc/server.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include <univalue.h> | #include <univalue.h> | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
▲ Show 20 Lines • Show All 609 Lines • ▼ Show 20 Lines | void RPCConsole::setClientModel(ClientModel *model) { | ||||
ui->trafficGraph->setClientModel(model); | ui->trafficGraph->setClientModel(model); | ||||
if (model && clientModel->getPeerTableModel() && | if (model && clientModel->getPeerTableModel() && | ||||
clientModel->getBanTableModel()) { | clientModel->getBanTableModel()) { | ||||
// Keep up to date with client | // Keep up to date with client | ||||
setNumConnections(model->getNumConnections()); | setNumConnections(model->getNumConnections()); | ||||
connect(model, SIGNAL(numConnectionsChanged(int)), this, | connect(model, SIGNAL(numConnectionsChanged(int)), this, | ||||
SLOT(setNumConnections(int))); | SLOT(setNumConnections(int))); | ||||
setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), | interfaces::Node &node = clientModel->node(); | ||||
model->getVerificationProgress(nullptr), false); | setNumBlocks(node.getNumBlocks(), | ||||
QDateTime::fromTime_t(node.getLastBlockTime()), | |||||
node.getVerificationProgress(), false); | |||||
connect(model, SIGNAL(numBlocksChanged(int, QDateTime, double, bool)), | connect(model, SIGNAL(numBlocksChanged(int, QDateTime, double, bool)), | ||||
this, SLOT(setNumBlocks(int, QDateTime, double, bool))); | this, SLOT(setNumBlocks(int, QDateTime, double, bool))); | ||||
updateNetworkState(); | updateNetworkState(); | ||||
connect(model, SIGNAL(networkActiveChanged(bool)), this, | connect(model, SIGNAL(networkActiveChanged(bool)), this, | ||||
SLOT(setNetworkActive(bool))); | SLOT(setNetworkActive(bool))); | ||||
updateTrafficStats(model->getTotalBytesRecv(), | updateTrafficStats(node.getTotalBytesRecv(), node.getTotalBytesSent()); | ||||
model->getTotalBytesSent()); | |||||
connect(model, SIGNAL(bytesChanged(quint64, quint64)), this, | connect(model, SIGNAL(bytesChanged(quint64, quint64)), this, | ||||
SLOT(updateTrafficStats(quint64, quint64))); | SLOT(updateTrafficStats(quint64, quint64))); | ||||
connect(model, SIGNAL(mempoolSizeChanged(long, size_t)), this, | connect(model, SIGNAL(mempoolSizeChanged(long, size_t)), this, | ||||
SLOT(setMempoolSize(long, size_t))); | SLOT(setMempoolSize(long, size_t))); | ||||
// set up peer table | // set up peer table | ||||
ui->peerWidget->setModel(model->getPeerTableModel()); | ui->peerWidget->setModel(model->getPeerTableModel()); | ||||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | QString connections = | ||||
QString::number(clientModel->getNumConnections()) + " ("; | QString::number(clientModel->getNumConnections()) + " ("; | ||||
connections += | connections += | ||||
tr("In:") + " " + | tr("In:") + " " + | ||||
QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / "; | QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / "; | ||||
connections += | connections += | ||||
tr("Out:") + " " + | tr("Out:") + " " + | ||||
QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")"; | QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")"; | ||||
if (!clientModel->getNetworkActive()) { | if (!clientModel->node().getNetworkActive()) { | ||||
connections += " (" + tr("Network activity disabled") + ")"; | connections += " (" + tr("Network activity disabled") + ")"; | ||||
} | } | ||||
ui->numberOfConnections->setText(connections); | ui->numberOfConnections->setText(connections); | ||||
} | } | ||||
void RPCConsole::setNumConnections(int count) { | void RPCConsole::setNumConnections(int count) { | ||||
if (!clientModel) { | if (!clientModel) { | ||||
▲ Show 20 Lines • Show All 453 Lines • Show Last 20 Lines |