mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
[Qt] format ping times in peers tab as ms
- also align ping times to the right
This commit is contained in:
parent
1913302fb7
commit
ead6737b87
2 changed files with 6 additions and 3 deletions
|
@ -806,7 +806,7 @@ QString formatServicesStr(uint64_t mask)
|
||||||
|
|
||||||
QString formatPingTime(double dPingTime)
|
QString formatPingTime(double dPingTime)
|
||||||
{
|
{
|
||||||
return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 s")).arg(QString::number(dPingTime, 'f', 3));
|
return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GUIUtil
|
} // namespace GUIUtil
|
||||||
|
|
|
@ -152,8 +152,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
||||||
CNodeCombinedStats *rec = static_cast<CNodeCombinedStats*>(index.internalPointer());
|
CNodeCombinedStats *rec = static_cast<CNodeCombinedStats*>(index.internalPointer());
|
||||||
|
|
||||||
if(role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole) {
|
||||||
{
|
|
||||||
switch(index.column())
|
switch(index.column())
|
||||||
{
|
{
|
||||||
case Address:
|
case Address:
|
||||||
|
@ -163,7 +162,11 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
|
||||||
case Ping:
|
case Ping:
|
||||||
return GUIUtil::formatPingTime(rec->nodeStats.dPingTime);
|
return GUIUtil::formatPingTime(rec->nodeStats.dPingTime);
|
||||||
}
|
}
|
||||||
|
} else if (role == Qt::TextAlignmentRole) {
|
||||||
|
if (index.column() == Ping)
|
||||||
|
return (int)(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue