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)

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
<img width="1199" alt="Screen Shot 2021-01-09 at 8 47 42 PM" src="https://user-images.githubusercontent.com/23396902/104112401-5c409e00-52bc-11eb-8e82-292c4208e535.png">
Thanks! Though I should drop the relay type from inbound or check if full or block (same in -netinfo).
Concept ACK.
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:
- return pLeft->m_conn_type < pRight->m_conn_type;
+ 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
To improve maintainability maybe explicitly assign a value to the first element only? It will make future insert/remove diffs smaller.
done
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");
case ConnectionType::INBOUND: return relay_txes ? QObject::tr("Full Relay") : QObject::tr("Block Relay");
This seems equivalent to me, but thanks for looking! done.
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):

re-ACK 9f76ba6597cd5d984bac0fa5c076e6b123dba22c, tested on macOS Big Sur 11.1 (Qt 5.15.2)
Why are Outbound/Inbound strings better than arrows?
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 arrowsWords use a lot more space than arrows... It's not unreasonable to have details show more .. detail :p
Why 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.
Agree. And the GUI uses words for the direction in the main info tab.
(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)
(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

I suppose we could also do icons with an arrow and tiny in/out text under it
There, how does this look? https://github.com/jonatack/gui/compare/add-peers-dir-and-type-columns...luke-jr:tmp_gui_peers_dir_arrows
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.
<img width="740" alt="Screen Shot 2021-01-18 at 12 40 44 PM" src="https://user-images.githubusercontent.com/23396902/104948049-a562b300-598a-11eb-9610-19455e69a7a1.png">
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 don't like the text form... As-is, IIRC this creates horizontal scrolling because it doesn't all fit in the window.
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...
This current PR with 2 ACKs is my preferred version among the various proposals I have seen.
I propose that further refinements be done in a follow-up (not by me ;).
Something I didn't get to yet - was to separate the uacomment and give it its own column. This could be very useful for some other ideas Ive been thinking about.
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.
<img width="1215" alt="pr179-spanishtest" src="https://user-images.githubusercontent.com/23396902/108216677-bbd26a80-7100-11eb-8309-b0152a143e0b.png">
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)
