Browse Source

[Qt] extend rpc console peers tab

- add node id, ping wait, whitelisted and common height
- rephrase some labels to make them easier to understand for users
0.13
Philip Kaufmann 10 years ago
parent
commit
1b0db7b984
  1. 122
      src/qt/forms/rpcconsole.ui
  2. 1
      src/qt/peertablemodel.cpp
  3. 18
      src/qt/rpcconsole.cpp

122
src/qt/forms/rpcconsole.ui

@ -745,13 +745,36 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_30">
<property name="text">
<string>Whitelisted</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="peerWhitelisted">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_23"> <widget class="QLabel" name="label_23">
<property name="text"> <property name="text">
<string>Direction</string> <string>Direction</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="1" column="2">
<widget class="QLabel" name="peerDirection"> <widget class="QLabel" name="peerDirection">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -767,14 +790,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="label_21">
<property name="text"> <property name="text">
<string>Version</string> <string>Version</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="2" column="2">
<widget class="QLabel" name="peerVersion"> <widget class="QLabel" name="peerVersion">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -790,14 +813,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_28"> <widget class="QLabel" name="label_28">
<property name="text"> <property name="text">
<string>User Agent</string> <string>User Agent</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="3" column="2">
<widget class="QLabel" name="peerSubversion"> <widget class="QLabel" name="peerSubversion">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -813,14 +836,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Services</string> <string>Services</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="4" column="2">
<widget class="QLabel" name="peerServices"> <widget class="QLabel" name="peerServices">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -839,7 +862,7 @@
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_29"> <widget class="QLabel" name="label_29">
<property name="text"> <property name="text">
<string>Starting Height</string> <string>Starting Block</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -862,7 +885,7 @@
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_27"> <widget class="QLabel" name="label_27">
<property name="text"> <property name="text">
<string>Sync Height</string> <string>Synced Headers</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -883,13 +906,36 @@
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Synced Blocks</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="peerCommonHeight">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_24"> <widget class="QLabel" name="label_24">
<property name="text"> <property name="text">
<string>Ban Score</string> <string>Ban Score</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="2"> <item row="8" column="2">
<widget class="QLabel" name="peerBanScore"> <widget class="QLabel" name="peerBanScore">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -905,14 +951,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_22"> <widget class="QLabel" name="label_22">
<property name="text"> <property name="text">
<string>Connection Time</string> <string>Connection Time</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="2"> <item row="9" column="2">
<widget class="QLabel" name="peerConnTime"> <widget class="QLabel" name="peerConnTime">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -928,14 +974,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="10" column="0">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
<string>Last Send</string> <string>Last Send</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="2"> <item row="10" column="2">
<widget class="QLabel" name="peerLastSend"> <widget class="QLabel" name="peerLastSend">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -951,14 +997,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="11" column="0">
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="label_19">
<property name="text"> <property name="text">
<string>Last Receive</string> <string>Last Receive</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="2"> <item row="11" column="2">
<widget class="QLabel" name="peerLastRecv"> <widget class="QLabel" name="peerLastRecv">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -974,14 +1020,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0"> <item row="12" column="0">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>Bytes Sent</string> <string>Bytes Sent</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="2"> <item row="12" column="2">
<widget class="QLabel" name="peerBytesSent"> <widget class="QLabel" name="peerBytesSent">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -997,14 +1043,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="0"> <item row="13" column="0">
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_20">
<property name="text"> <property name="text">
<string>Bytes Received</string> <string>Bytes Received</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="2"> <item row="13" column="2">
<widget class="QLabel" name="peerBytesRecv"> <widget class="QLabel" name="peerBytesRecv">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -1020,14 +1066,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="0"> <item row="14" column="0">
<widget class="QLabel" name="label_26"> <widget class="QLabel" name="label_26">
<property name="text"> <property name="text">
<string>Ping Time</string> <string>Ping Time</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="2"> <item row="14" column="2">
<widget class="QLabel" name="peerPingTime"> <widget class="QLabel" name="peerPingTime">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -1043,14 +1089,40 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="0"> <item row="15" column="0">
<widget class="QLabel" name="peerPingWaitLabel">
<property name="toolTip">
<string>The duration of a currently outstanding ping.</string>
</property>
<property name="text">
<string>Ping Wait</string>
</property>
</widget>
</item>
<item row="15" column="2">
<widget class="QLabel" name="peerPingWait">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="label_timeoffset"> <widget class="QLabel" name="label_timeoffset">
<property name="text"> <property name="text">
<string>Time Offset</string> <string>Time Offset</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="2"> <item row="16" column="2">
<widget class="QLabel" name="timeoffset"> <widget class="QLabel" name="timeoffset">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
@ -1066,7 +1138,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1"> <item row="17" column="1">
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>

1
src/qt/peertablemodel.cpp

@ -68,6 +68,7 @@ public:
CNodeCombinedStats stats; CNodeCombinedStats stats;
stats.nodeStateStats.nMisbehavior = 0; stats.nodeStateStats.nMisbehavior = 0;
stats.nodeStateStats.nSyncHeight = -1; stats.nodeStateStats.nSyncHeight = -1;
stats.nodeStateStats.nCommonHeight = -1;
stats.fNodeStateStatsAvailable = false; stats.fNodeStateStatsAvailable = false;
pnode->copyStats(stats.nodeStats); pnode->copyStats(stats.nodeStats);
cachedNodeStats.append(stats); cachedNodeStats.append(stats);

18
src/qt/rpcconsole.cpp

@ -611,7 +611,8 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
cachedNodeid = stats->nodeStats.nodeid; cachedNodeid = stats->nodeStats.nodeid;
// update the detail ui with latest node information // update the detail ui with latest node information
QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName)); QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " ");
peerAddrDetails += tr("(node id: %1)").arg(QString::number(stats->nodeStats.nodeid));
if (!stats->nodeStats.addrLocal.empty()) if (!stats->nodeStats.addrLocal.empty())
peerAddrDetails += "<br />" + tr("via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal)); peerAddrDetails += "<br />" + tr("via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal));
ui->peerHeading->setText(peerAddrDetails); ui->peerHeading->setText(peerAddrDetails);
@ -622,11 +623,13 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
ui->peerBytesRecv->setText(FormatBytes(stats->nodeStats.nRecvBytes)); ui->peerBytesRecv->setText(FormatBytes(stats->nodeStats.nRecvBytes));
ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nTimeConnected)); ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nTimeConnected));
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime)); ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime));
ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingWait));
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
ui->peerVersion->setText(QString("%1").arg(stats->nodeStats.nVersion)); ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion)));
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound")); ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound"));
ui->peerHeight->setText(QString("%1").arg(stats->nodeStats.nStartingHeight)); ui->peerHeight->setText(QString("%1").arg(QString::number(stats->nodeStats.nStartingHeight)));
ui->peerWhitelisted->setText(stats->nodeStats.fWhitelisted ? tr("Yes") : tr("No"));
// This check fails for example if the lock was busy and // This check fails for example if the lock was busy and
// nodeStateStats couldn't be fetched. // nodeStateStats couldn't be fetched.
@ -639,9 +642,12 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
ui->peerSyncHeight->setText(QString("%1").arg(stats->nodeStateStats.nSyncHeight)); ui->peerSyncHeight->setText(QString("%1").arg(stats->nodeStateStats.nSyncHeight));
else else
ui->peerSyncHeight->setText(tr("Unknown")); ui->peerSyncHeight->setText(tr("Unknown"));
} else {
ui->peerBanScore->setText(tr("Fetching...")); // Common height is init to -1
ui->peerSyncHeight->setText(tr("Fetching...")); if (stats->nodeStateStats.nCommonHeight > -1)
ui->peerCommonHeight->setText(QString("%1").arg(stats->nodeStateStats.nCommonHeight));
else
ui->peerCommonHeight->setText(tr("Unknown"));
} }
ui->detailWidget->show(); ui->detailWidget->show();

Loading…
Cancel
Save