This pull:
- adds a sortable
Typecolumn to the GUI Peers tab window - updates the peer details row to
Direction/Type, so theTypecolumn without a direction makes sense (the tooltip is also updated)

Type column to peers window, update peer details name/tooltip
#179
This pull:
Type column to the GUI Peers tab windowDirection/Type, so the Type column without a direction makes sense (the tooltip is also updated)
ACK 09aa053dc5a83826265aa575ee61f99f0f76287a
I love this! I was just thinking about how this would be a good feature today, you beat me to it. Code looks good to me. Tested on macOS Big Sur 11.1 with Qt 5.15.2
28@@ -29,6 +29,10 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
29 return pLeft->nodeid < pRight->nodeid;
30 case PeerTableModel::Address:
31 return pLeft->addrName.compare(pRight->addrName) < 0;
32+ case PeerTableModel::Direction:
33+ return pLeft->fInbound > pRight->fInbound;
34+ case PeerTableModel::ConnectionType:
35+ return pLeft->m_conn_type < pRight->m_conn_type;
Memo to myself, if we prefer to sort alphabetically by type name rather than by enum order:
0- return pLeft->m_conn_type < pRight->m_conn_type;
1+ return GUIUtil::ConnectionTypeToShortQString(pLeft->m_conn_type, pLeft->fRelayTxes) < GUIUtil::ConnectionTypeToShortQString(pRight->m_conn_type, pRight->fRelayTxes);
68+ Direction = 2,
69+ Network = 3,
70+ Ping = 4,
71+ Sent = 5,
72+ Received = 6,
73+ Subversion = 7
776@@ -777,6 +777,19 @@ QString ConnectionTypeToQString(ConnectionType conn_type)
777 assert(false);
778 }
779
780+QString ConnectionTypeToShortQString(ConnectionType conn_type, bool relay_txes)
781+{
782+ switch (conn_type) {
783+ case ConnectionType::INBOUND: return QObject::tr(relay_txes ? "Full Relay" : "Block Relay");
0 case ConnectionType::INBOUND: return relay_txes ? QObject::tr("Full Relay") : QObject::tr("Block Relay");
It is not equivalent for the lupdate tool:
When Qt’s translation tool, lupdate, is used to process a set of source files, the text wrapped in
tr()calls is stored in a section of the translation file that corresponds to its translation context.
ACK 9f76ba6597cd5d984bac0fa5c076e6b123dba22c, tested on Linux Mint 20.1 (Qt 5.12.8):

Why are Outbound/Inbound strings better than arrows?
Good question. I proposed words instead of arrows for these reasons:
-getinfo and -netinfo both also use words for the direction rather than arrowsWhy are Outbound/Inbound strings better than arrows?
Words use a lot more space than arrows… It’s not unreasonable to have details show more .. detail :p
Actually, words simplify the GUI for new-comers, as an “arrow up” does not imply “outbound” at all.
(If space is an issue we could use in/out instead of inbound/outbound, as that is the wording in the GUI info tab, -getinfo, and -netinfo)
I was thinking about it from the beginning, but it won’t work for some translations.
(If space is an issue we could use in/out instead of inbound/outbound, as that is the wording in the GUI info tab, -getinfo, and -netinfo)
I think we should stick with inbound/outbound. Even if you changed to in/out wouldn’t Direction keep the tab at about the same size
I was thinking something more like this:
I was thinking something more like this:
jonatack/gui@add-peers-dir-and-type-columns…luke-jr:tmp_gui_peers_dir_arrows
Below is a screenshot of what your branch looks like for me, font issue with the arrows. Anyways, my vote is still for inbound/outbound

Screenshot is taken from Luke-jr’s branch
I guess we should get some designer opinion on this: @Bosch-0 what do you think about this icon vs inbound/outbound text.
I think this idea has a lot of potential, but as this iteration I would still vote for inbound/outbound text. I think it’s more informative and fits in better with translations. Also I think Direction and Type should remain adjacent.
Thanks @luke-jr for the proposals and to @jarolrod for the screenshot renderings (a thought, no need to hide addresses if you test on signet or testnet, and signet starts up the fastest of all the chains.)
<->This has 2 tested ACKs; @luke-jr if you could ACK as well this could go in and open the door for your proposed follow-up.
I suppose we could also do icons with an arrow and tiny in/out text under it
Any text within icons causes translation issues, no?
This worked for me…

Most of the issues you may run into - I already figured out…
https://github.com/jonatack/gui/compare/add-peers-dir-and-type-columns...luke-jr:tmp_gui_peers_dir_arrows is now translation-friendly…
I’m still weak concept nack on inbound/outbound as strings in the table. I think it’s worse than the status quo, so would rather this not be merged as-is.
Ready for review again. Three changes from the previous version:
Direction column, which had 2 ACKs but also a light NACK and which can be decided later in another pullType column, following the logic of merged #203Connection Type field is renamed to Direction/Type, so the Type column without a direction makes sense. Its tooltip is also updated.I hope the translations work correctly in this latest push. @hebasto, @jarolrod, @luke-jr, @RandyMcMillan, would you mind having another look?
Updated the PR description and screenshot with this one:

ACK be4cf4832f117ab5f97e1367f7bdcb5361de0dae
Tested with Spanish translations. The text added in the tooltip and text associated with the Type column will need translations.
Tested ACK https://github.com/bitcoin-core/gui/commit/be4cf4832f117ab5f97e1367f7bdcb5361de0dae on Ubuntu 20.04 on VMWare.

Removing “Peer” from the “Peer Id” column would allow for more prudent use of space. Otherwise it should be translatable. A simple “ID” or “id” would be better. I think all caps “ID” is better imo.
Maybe Type and Network should be left justified?
NOTE: #202
PR #202 is going to allow for more info/columns to be added - and more info displayed “at a glance”. As more columns are added - the columns can be adjusted for a tighter fit and/or column stretching in a resize event.
ACK 6fc72bd6f030c8b49e8b9f68188413766a239d73
macOS 10.14.6 (18G103)
