Changeset View
Changeset View
Standalone View
Standalone View
src/qt/rpcconsole.cpp
Show First 20 Lines • Show All 1,131 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void RPCConsole::on_sldGraphRange_valueChanged(int value) { | void RPCConsole::on_sldGraphRange_valueChanged(int value) { | ||||
const int multiplier = 5; // each position on the slider represents 5 min | const int multiplier = 5; // each position on the slider represents 5 min | ||||
int mins = value * multiplier; | int mins = value * multiplier; | ||||
setTrafficGraphRange(mins); | setTrafficGraphRange(mins); | ||||
} | } | ||||
QString RPCConsole::FormatBytes(quint64 bytes) { | |||||
if (bytes < 1024) { | |||||
return QString(tr("%1 B")).arg(bytes); | |||||
} | |||||
if (bytes < 1024 * 1024) { | |||||
return QString(tr("%1 KB")).arg(bytes / 1024); | |||||
} | |||||
if (bytes < 1024 * 1024 * 1024) { | |||||
return QString(tr("%1 MB")).arg(bytes / 1024 / 1024); | |||||
} | |||||
return QString(tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); | |||||
} | |||||
void RPCConsole::setTrafficGraphRange(int mins) { | void RPCConsole::setTrafficGraphRange(int mins) { | ||||
ui->trafficGraph->setGraphRangeMins(mins); | ui->trafficGraph->setGraphRangeMins(mins); | ||||
ui->lblGraphRange->setText(GUIUtil::formatDurationStr(mins * 60)); | ui->lblGraphRange->setText(GUIUtil::formatDurationStr(mins * 60)); | ||||
} | } | ||||
void RPCConsole::updateTrafficStats(quint64 totalBytesIn, | void RPCConsole::updateTrafficStats(quint64 totalBytesIn, | ||||
quint64 totalBytesOut) { | quint64 totalBytesOut) { | ||||
ui->lblBytesIn->setText(FormatBytes(totalBytesIn)); | ui->lblBytesIn->setText(GUIUtil::formatBytes(totalBytesIn)); | ||||
ui->lblBytesOut->setText(FormatBytes(totalBytesOut)); | ui->lblBytesOut->setText(GUIUtil::formatBytes(totalBytesOut)); | ||||
} | } | ||||
void RPCConsole::peerSelected(const QItemSelection &selected, | void RPCConsole::peerSelected(const QItemSelection &selected, | ||||
const QItemSelection &deselected) { | const QItemSelection &deselected) { | ||||
Q_UNUSED(deselected); | Q_UNUSED(deselected); | ||||
if (!clientModel || !clientModel->getPeerTableModel() || | if (!clientModel || !clientModel->getPeerTableModel() || | ||||
selected.indexes().isEmpty()) | selected.indexes().isEmpty()) | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | ui->peerLastSend->setText( | ||||
? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - | ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - | ||||
stats->nodeStats.nLastSend) | stats->nodeStats.nLastSend) | ||||
: tr("never")); | : tr("never")); | ||||
ui->peerLastRecv->setText( | ui->peerLastRecv->setText( | ||||
stats->nodeStats.nLastRecv | stats->nodeStats.nLastRecv | ||||
? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - | ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - | ||||
stats->nodeStats.nLastRecv) | stats->nodeStats.nLastRecv) | ||||
: tr("never")); | : tr("never")); | ||||
ui->peerBytesSent->setText(FormatBytes(stats->nodeStats.nSendBytes)); | ui->peerBytesSent->setText( | ||||
ui->peerBytesRecv->setText(FormatBytes(stats->nodeStats.nRecvBytes)); | GUIUtil::formatBytes(stats->nodeStats.nSendBytes)); | ||||
ui->peerBytesRecv->setText( | |||||
GUIUtil::formatBytes(stats->nodeStats.nRecvBytes)); | |||||
ui->peerConnTime->setText(GUIUtil::formatDurationStr( | ui->peerConnTime->setText(GUIUtil::formatDurationStr( | ||||
GetSystemTimeInSeconds() - stats->nodeStats.nTimeConnected)); | GetSystemTimeInSeconds() - stats->nodeStats.nTimeConnected)); | ||||
ui->peerPingTime->setText( | ui->peerPingTime->setText( | ||||
GUIUtil::formatPingTime(stats->nodeStats.dPingTime)); | GUIUtil::formatPingTime(stats->nodeStats.dPingTime)); | ||||
ui->peerPingWait->setText( | ui->peerPingWait->setText( | ||||
GUIUtil::formatPingTime(stats->nodeStats.dPingWait)); | GUIUtil::formatPingTime(stats->nodeStats.dPingWait)); | ||||
ui->peerMinPing->setText( | ui->peerMinPing->setText( | ||||
GUIUtil::formatPingTime(stats->nodeStats.dMinPing)); | GUIUtil::formatPingTime(stats->nodeStats.dMinPing)); | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |