gui icon indicating copy to clipboard operation
gui copied to clipboard

Hide peers details

Open RandyMcMillan opened this issue 4 years ago • 23 comments

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]>

RandyMcMillan avatar Dec 12 '21 23:12 RandyMcMillan

Screen Shot 2021-12-12 at 6 41 53 PM

RandyMcMillan avatar Dec 12 '21 23:12 RandyMcMillan

Tooltip message for better UX.

Screen Shot 2021-12-12 at 6 45 24 PM

RandyMcMillan avatar Dec 12 '21 23:12 RandyMcMillan

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 close file icon

RandyMcMillan avatar Dec 13 '21 16:12 RandyMcMillan

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?

luke-jr avatar Dec 13 '21 22:12 luke-jr

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.

RandyMcMillan avatar Dec 14 '21 22:12 RandyMcMillan

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.

DrahtBot avatar Dec 30 '21 10:12 DrahtBot

@w0xlt any suggestions on reducing the diff in the .ui file would be appreciated - this is left unsquashed to allow for suggestions/variations

RandyMcMillan avatar Jan 23 '22 23:01 RandyMcMillan

@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 avatar Jan 28 '22 22:01 w0xlt

@w0xlt - applied the patch - thanks for the collaboration! attribution included in commit message. I also implemented @promag's suggestion - much more prudent approach! - thanks!

RandyMcMillan avatar Jan 29 '22 21:01 RandyMcMillan

Commit: 2ae79d0954c46862535114c0d3f7bcfe2837918f

screen shot screen shot

RandyMcMillan avatar Jan 29 '22 21:01 RandyMcMillan

tACK 2ae79d0 on ARM M1/macOS/Monterey 12.1 (Qt 5.15.2)

rsafier avatar Jan 29 '22 22:01 rsafier

To avoid re-adding diff junk to the debugwindow.ui file - I prefer to add translator comments in a follow up PR.

RandyMcMillan avatar Jan 31 '22 16:01 RandyMcMillan

@RandyMcMillan Still working on this PR?

hebasto avatar Oct 26 '22 16:10 hebasto

rebase: d59363aaa0f39da8f27fead0b8e5b0c1a5a32226

RandyMcMillan avatar Nov 15 '22 19:11 RandyMcMillan