Merge bitcoin-core/gui#505: Hide peers details

41a1a8615d gui: Hide peers details (@RandyMcMillan)

Pull request description:

  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 <w0xlt@users.noreply.github.com>

ACKs for top commit:
  pablomartin4btc:
    re ACK 41a1a8615d
  hebasto:
    ACK 41a1a8615d, tested on Ubuntu 23.10.

Tree-SHA512: fc692891eec61bd1e6878f2433b478de3c69bf0b3ce3471f2faafda6f63d371e2cc125ae8290fd2ac3e4d8659031b79d85665318cfc5a9481e967ef99d245f9c
This commit is contained in:
Hennadii Stepanov 2024-07-30 17:41:36 +01:00
commit d367a4e36f
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 113 additions and 36 deletions

View file

@ -984,42 +984,117 @@
</size> </size>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
<item> <item>
<widget class="QLabel" name="peerHeading"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="sizePolicy"> <property name="topMargin">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <number>0</number>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> <property name="bottomMargin">
</sizepolicy> <number>0</number>
</property> </property>
<property name="minimumSize"> <item>
<size> <widget class="QLabel" name="peerHeading">
<width>0</width> <property name="sizePolicy">
<height>32</height> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="font"> </sizepolicy>
<font> </property>
<pointsize>10</pointsize> <property name="minimumSize">
</font> <size>
</property> <width>0</width>
<property name="cursor"> <height>32</height>
<cursorShape>IBeamCursor</cursorShape> </size>
</property> </property>
<property name="text"> <property name="font">
<string>Select a peer to view detailed information.</string> <font>
</property> <pointsize>10</pointsize>
<property name="alignment"> </font>
<set>Qt::AlignHCenter|Qt::AlignTop</set> </property>
</property> <property name="cursor">
<property name="wordWrap"> <cursorShape>IBeamCursor</cursorShape>
<bool>true</bool> </property>
</property> <property name="text">
<property name="textInteractionFlags"> <string>Select a peer to view detailed information.</string>
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> </property>
</property> <property name="alignment">
</widget> <set>Qt::AlignHCenter|Qt::AlignTop</set>
</item> </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> <item>
<widget class="QScrollArea" name="scrollArea"> <widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable"> <property name="widgetResizable">

View file

@ -560,6 +560,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
ui->lineEdit->setMaxLength(16 * 1024 * 1024); ui->lineEdit->setMaxLength(16 * 1024 * 1024);
ui->messagesWidget->installEventFilter(this); ui->messagesWidget->installEventFilter(this);
connect(ui->hidePeersDetailButton, &QAbstractButton::clicked, this, &RPCConsole::clearSelectedNode);
connect(ui->clearButton, &QAbstractButton::clicked, [this] { clear(); }); connect(ui->clearButton, &QAbstractButton::clicked, [this] { clear(); });
connect(ui->fontBiggerButton, &QAbstractButton::clicked, this, &RPCConsole::fontBigger); connect(ui->fontBiggerButton, &QAbstractButton::clicked, this, &RPCConsole::fontBigger);
connect(ui->fontSmallerButton, &QAbstractButton::clicked, this, &RPCConsole::fontSmaller); connect(ui->fontSmallerButton, &QAbstractButton::clicked, this, &RPCConsole::fontSmaller);
@ -1251,6 +1252,7 @@ void RPCConsole::updateDetailWidget()
ui->peerRelayTxes->setText(stats->nodeStateStats.m_relay_txs ? ts.yes : ts.no); ui->peerRelayTxes->setText(stats->nodeStateStats.m_relay_txs ? ts.yes : ts.no);
} }
ui->hidePeersDetailButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove")));
ui->peersTabRightPanel->show(); ui->peersTabRightPanel->show();
} }