mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
gui: allow ConnectionTypeToQString to prepend direction optionally
This commit is contained in:
parent
6c6140846f
commit
6fc72bd6f0
3 changed files with 13 additions and 9 deletions
|
@ -766,15 +766,19 @@ QString NetworkToQString(Network net)
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ConnectionTypeToQString(ConnectionType conn_type)
|
QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction)
|
||||||
{
|
{
|
||||||
|
QString prefix;
|
||||||
|
if (prepend_direction) {
|
||||||
|
prefix = (conn_type == ConnectionType::INBOUND) ? QObject::tr("Inbound") : QObject::tr("Outbound") + " ";
|
||||||
|
}
|
||||||
switch (conn_type) {
|
switch (conn_type) {
|
||||||
case ConnectionType::INBOUND: return QObject::tr("Inbound");
|
case ConnectionType::INBOUND: return prefix;
|
||||||
case ConnectionType::OUTBOUND_FULL_RELAY: return QObject::tr("Outbound Full Relay");
|
case ConnectionType::OUTBOUND_FULL_RELAY: return prefix + QObject::tr("Full Relay");
|
||||||
case ConnectionType::BLOCK_RELAY: return QObject::tr("Outbound Block Relay");
|
case ConnectionType::BLOCK_RELAY: return prefix + QObject::tr("Block Relay");
|
||||||
case ConnectionType::MANUAL: return QObject::tr("Outbound Manual");
|
case ConnectionType::MANUAL: return prefix + QObject::tr("Manual");
|
||||||
case ConnectionType::FEELER: return QObject::tr("Outbound Feeler");
|
case ConnectionType::FEELER: return prefix + QObject::tr("Feeler");
|
||||||
case ConnectionType::ADDR_FETCH: return QObject::tr("Outbound Address Fetch");
|
case ConnectionType::ADDR_FETCH: return prefix + QObject::tr("Address Fetch");
|
||||||
} // no default case, so the compiler can warn about missing cases
|
} // no default case, so the compiler can warn about missing cases
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ namespace GUIUtil
|
||||||
QString NetworkToQString(Network net);
|
QString NetworkToQString(Network net);
|
||||||
|
|
||||||
/** Convert enum ConnectionType to QString */
|
/** Convert enum ConnectionType to QString */
|
||||||
QString ConnectionTypeToQString(ConnectionType conn_type);
|
QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction);
|
||||||
|
|
||||||
/** Convert seconds into a QString with days, hours, mins, secs */
|
/** Convert seconds into a QString with days, hours, mins, secs */
|
||||||
QString formatDurationStr(int secs);
|
QString formatDurationStr(int secs);
|
||||||
|
|
|
@ -1120,7 +1120,7 @@ void RPCConsole::updateDetailWidget()
|
||||||
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
|
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
|
||||||
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
|
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
|
||||||
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
|
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
|
||||||
ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type));
|
ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, /* prepend_direction */ true));
|
||||||
ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network));
|
ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network));
|
||||||
if (stats->nodeStats.m_permissionFlags == PF_NONE) {
|
if (stats->nodeStats.m_permissionFlags == PF_NONE) {
|
||||||
ui->peerPermissions->setText(tr("N/A"));
|
ui->peerPermissions->setText(tr("N/A"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue