Skip to content

Commit

Permalink
[Qt] format ping times in peers tab as ms
Browse files Browse the repository at this point in the history
- also align ping times to the right
  • Loading branch information
Philip Kaufmann committed Aug 4, 2014
1 parent 1913302 commit ead6737
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ QString formatServicesStr(uint64_t mask)

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
7 changes: 5 additions & 2 deletions src/qt/peertablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const

CNodeCombinedStats *rec = static_cast<CNodeCombinedStats*>(index.internalPointer());

if(role == Qt::DisplayRole)
{
if (role == Qt::DisplayRole) {
switch(index.column())
{
case Address:
Expand All @@ -163,7 +162,11 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
case Ping:
return GUIUtil::formatPingTime(rec->nodeStats.dPingTime);
}
} else if (role == Qt::TextAlignmentRole) {
if (index.column() == Ping)
return (int)(Qt::AlignRight | Qt::AlignVCenter);
}

return QVariant();
}

Expand Down

0 comments on commit ead6737

Please sign in to comment.