Hide peers details
Add a close (X) button to the Peers Detail panel. Reuse the same icon used in the Console Tab. The close button deselects the peer highlighted in the PeerTableView and hides the detail panel.
fixes #485
Co-authored-by: @w0xlt <[email protected]>

Tooltip message for better UX.

Is there a better icon to use for a "close" action?
We don't have a "clear" icon in the repo - but something like this would be more appropriate for "clear console". So reusing the (X) icon seems prudent.
close file icon
Since it's possible to select multiple peers, but only one shows in the panel, perhaps leaving the "close" button is best, but don't have it deselect?
I split this PR into 2 commits so others can experiment with adding the button to src/qt/forms/debugwindow.ui Feel free to fetch this branch and experiment.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #bitcoin/bitcoin/25923 (p2p: always provide CNodeStateStats and getpeerinfo/netinfo/gui updates by jonatack)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
@w0xlt any suggestions on reducing the diff in the .ui file would be appreciated - this is left unsquashed to allow for suggestions/variations
@RandyMcMillan
You can delete the last commit (git reset --hard 718589f) and apply the patch below.
diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui
index 15e0d3fad..ad671b02e 100644
--- a/src/qt/forms/debugwindow.ui
+++ b/src/qt/forms/debugwindow.ui
@@ -984,6 +984,117 @@
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="peerHeading">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ <property name="cursor">
+ <cursorShape>IBeamCursor</cursorShape>
+ </property>
+ <property name="text">
+ <string>Select a peer to view detailed information.</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignHCenter|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="hidePeersDetail" native="true">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <widget class="QToolButton" name="hidePeersDetailButton">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>32</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Hide Peers Detail</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string />
+ </property>
+ <property name="icon">
+ <iconset resource="../bitcoin.qrc">
+ <normaloff>:/icons/remove</normaloff>
+ :/icons/remove
+ </iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>22</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+X</string>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item>
<widget class="QLabel" name="peerHeading">
<property name="sizePolicy">
@w0xlt - applied the patch - thanks for the collaboration! attribution included in commit message. I also implemented @promag's suggestion - much more prudent approach! - thanks!
Commit: 2ae79d0954c46862535114c0d3f7bcfe2837918f
screen shot
tACK 2ae79d0 on ARM M1/macOS/Monterey 12.1 (Qt 5.15.2)
To avoid re-adding diff junk to the debugwindow.ui file - I prefer to add translator comments in a follow up PR.
@RandyMcMillan Still working on this PR?
rebase: d59363aaa0f39da8f27fead0b8e5b0c1a5a32226