Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer details: replace Direction with Connection Type #163

Merged
merged 4 commits into from
Jan 10, 2021

Conversation

jonatack
Copy link
Member

@jonatack jonatack commented Dec 24, 2020

Screenshot from 2021-01-09 11-23-17

Closes #159.

@maflcko
Copy link
Contributor

maflcko commented Dec 24, 2020

Nice. Concept ACK

src/qt/guiutil.cpp Outdated Show resolved Hide resolved
@jonatack jonatack force-pushed the display-peer-conn-types branch 2 times, most recently from 41b97b9 to bf8135d Compare December 24, 2020 15:26
@hebasto
Copy link
Member

hebasto commented Dec 25, 2020

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

I have reviewed the code (bf8135d), and tested it.

src/qt/guiutil.h Outdated Show resolved Hide resolved
src/qt/guiutil.cpp Outdated Show resolved Hide resolved
src/qt/guiutil.cpp Outdated Show resolved Hide resolved
src/qt/forms/debugwindow.ui Outdated Show resolved Hide resolved
@jonatack jonatack force-pushed the display-peer-conn-types branch from bf8135d to 8e7f82a Compare December 25, 2020 17:12
@jonatack
Copy link
Member Author

Thanks for the excellent feedback @hebasto! Updated.

@hebasto
Copy link
Member

hebasto commented Dec 25, 2020

I have reviewed the code (8e7f82a), and tested it.

The following patch:

--- a/src/qt/forms/debugwindow.ui
+++ b/src/qt/forms/debugwindow.ui
@@ -1079,7 +1079,7 @@
                <item row="1" column="0">
                 <widget class="QLabel" name="peerConnectionTypeLabel">
                  <property name="toolTip">
-                  <string>The type of peer connection: Outbound Full Relay (default), Outbound Block Relay (does not relay transactions or addresses), Inbound (initiated by peer), Outbound Manual (added using RPC addnode or -addnode/-connect config options), Outbound Feeler (short-lived, for testing addresses), or Outbound Address Fetch (short-lived, for soliciting addresses).</string>
+                  <string>The type of peer connection: Outbound Full Relay (default), Outbound Block Relay (does not relay transactions or addresses), Inbound (initiated by peer), Outbound Manual (added using RPC %1 or %2/%3 config options), Outbound Feeler (short-lived, for testing addresses), or Outbound Address Fetch (short-lived, for soliciting addresses).</string>
                  </property>
                  <property name="text">
                   <string>Connection Type</string>
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -496,6 +496,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
     clear();
 
     GUIUtil::handleCloseWindowShortcut(this);
+
+    ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg("addnode").arg(QString(nonbreaking_hyphen) + "addnode").arg(QString(nonbreaking_hyphen) + "connect"));
 }
 
 RPCConsole::~RPCConsole()
  • removes RPC and option names from the translatable string
  • prevents effects like this
    DeepinScreenshot_select-area_20201225232751

@jonatack
Copy link
Member Author

Thanks @hebasto, tested and added your suggestion, updated the screenshot in the PR description.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6cd242c, tested on Linux Mint 20 (x86_64) + Qt 5.12.8.

Looks great:
Screenshot from 2020-12-25 23-52-27

src/net.h Outdated Show resolved Hide resolved
@jonatack
Copy link
Member Author

It was suggested to re-open here.

@jonatack jonatack reopened this Dec 28, 2020
@maflcko
Copy link
Contributor

maflcko commented Dec 28, 2020

Concept re-ACK. Thanks for re-opening.

@jonatack
Copy link
Member Author

Rebased.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK aef9693, since my previous review only rebased and the "p2p, rpc, refactor: remove CNodeStats::m_conn_type_string" commit added.

@jonatack jonatack force-pushed the display-peer-conn-types branch from aef9693 to 7098509 Compare January 2, 2021 09:13
@jonatack
Copy link
Member Author

jonatack commented Jan 2, 2021

Rebased git range-diff ae8f797 aef9693 7098509

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 7098509, only rebased since my previous review.

src/rpc/net.cpp Outdated Show resolved Hide resolved
@jonatack jonatack force-pushed the display-peer-conn-types branch from 7098509 to be8294f Compare January 2, 2021 21:39
@jonatack jonatack force-pushed the display-peer-conn-types branch from be8294f to 20fa975 Compare January 8, 2021 14:38
@jonatack
Copy link
Member Author

jonatack commented Jan 8, 2021

Rebased after the merge of bitcoin/bitcoin#20786.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 20fa975, only rebased since my previous review due to the conflict with bitcoin/bitcoin#20786, verified with

$ git range-diff master be8294ff428da7d13043b3f9a27d7ace1c2dadf4 20fa97560b2d27f94f556a570f3556356877b79f

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 20fa975

Tested on macOS Big Sur 11.1 with qt 5.15.2. Looks great!
Screen Shot 2021-01-08 at 11 01 46 AM

Small NIT: There's a lot of text in the tooltip. It would be nice if all the possible values were put into a list instead of separated by commas. It would look something like this, which to me would be an improvement.

See: Supported HTML Subset,

@jonatack
Copy link
Member Author

jonatack commented Jan 8, 2021

Better? If yes, bold or no?

Also, any opinions on Inbound being first in the list vs where it is currently.

Screenshot from 2021-01-09 00-04-04
Screenshot from 2021-01-08 23-57-49

@jarolrod
Copy link
Member

jarolrod commented Jan 8, 2021

@jonatack the list looks great! I think not-bold is better. I think that inbound can stay where it is. If i may, I would suggest one more thing:

Write the descriptions like this:
Outbound Block Relay: does not relay transactions or addresses

instead of:
Outbound Block Relay (does not relay transactions or addresses)

@jonatack
Copy link
Member Author

jonatack commented Jan 9, 2021

@jarolrod test with inbound first and your colon suggestion (agree, it's more readable)

Screenshot from 2021-01-09 01-10-03

@jarolrod
Copy link
Member

jarolrod commented Jan 9, 2021

@jonatack looks awesome 👍

@jonatack jonatack force-pushed the display-peer-conn-types branch from 20fa975 to b99fbd6 Compare January 9, 2021 10:29
@jonatack
Copy link
Member Author

jonatack commented Jan 9, 2021

Thanks @jarolrod. Updated in latest push, if you'd like to review/test. @hebasto, can you verify the changed tooltip code?

@hebasto
Copy link
Member

hebasto commented Jan 9, 2021

@hebasto, can you verify the changed tooltip code?

The used HTML code is valid.

But I'd prefer to keep the tooltip content in the form *.ui file. It makes usage of design tools (e.g., Qt Designer) much easier. In *.cpp file should be text substitution code only.

@jonatack jonatack force-pushed the display-peer-conn-types branch from b99fbd6 to 8341039 Compare January 9, 2021 12:43
@jonatack
Copy link
Member Author

jonatack commented Jan 9, 2021

@hebasto thanks--done.

jonatack and others added 3 commits January 9, 2021 13:49
@jonatack jonatack force-pushed the display-peer-conn-types branch from 8341039 to 06ba9b3 Compare January 9, 2021 12:50
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 06ba9b3, the tooltip content is organized as unordered list.

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 06ba9b3

<widget class="QLabel" name="label_23">
<widget class="QLabel" name="peerConnectionTypeLabel">
<property name="toolTip">
<string>The type of peer connection:&lt;ul&gt;&lt;li&gt;Inbound: initiated by peer&lt;/li&gt;&lt;li&gt;Outbound Full Relay: default&lt;/li&gt;&lt;li&gt;Outbound Block Relay: does not relay transactions or addresses&lt;/li&gt;&lt;li&gt;Outbound Manual: added using RPC %1 or %2/%3 configuration options&lt;/li&gt;&lt;li&gt;Outbound Feeler: short-lived, for testing addresses&lt;/li&gt;&lt;li&gt;Outbound Address Fetch: short-lived, for soliciting addresses&lt;/li&gt;&lt;/ul&gt;</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translation nit: How are translators supposed to translate :&lt;ul&gt;&lt;li&gt;? It might be better to say "Can be one of %s" and then use Join(translated_strings, ", ") or simply "Refer to the getpeerinfo RPC help for details on the connection types"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hebasto, if we replace the escaped markup with placeholders (as done here for the nonbreaking hyphen), is that still QT Designer-friendly? Can do it in #179.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translation nit: How are translators supposed to translate :&lt;ul&gt;&lt;li&gt;?

There was a discussion in private IRC with @jonatack:

<hebasto>
14:24:52 but I expect the translators' burden :)
14:25:39 hope that translators are aware of escaping :)

I'm not an expert in translation but I believe that :&lt;ul&gt;&lt;li&gt; is not a subject to translate as %1 or %2.

It might be better to say "Can be one of %s" and then use Join(translated_strings, ", ") or simply "Refer to the getpeerinfo RPC help for details on the connection types"?

Either of the suggested variants LGTM.

if we replace the escaped markup with placeholders (as done here for the nonbreaking hyphen), is that still QT Designer-friendly?

I think it is. But, tbh, I'd prefer more succinct @MarcoFalke's suggestions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Helpfulness and readability for users were the reasons for the iterations above and it seems best to not regress on those improvements with referring GUI users to the command line or dropping the readable list layout. I'll propose replacing the escaped markup with placeholders.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not a single placeholder for the whole unordered list? We still have a (shorter) tooltip in the form file, and make translators' life easier :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #180

@jonatack jonatack deleted the display-peer-conn-types branch January 10, 2021 10:01
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 10, 2021
laanwj added a commit that referenced this pull request Jan 27, 2021
79a2576 doc: update ConnectionType Doxygen documentation (Jon Atack)
f3153dc gui: improve markup handling of connection type tooltip (Jon Atack)
4f09615 gui: return inbound {full, block} relay type in peer details (Jon Atack)

Pull request description:

  Three follow-ups to #163:
  - return relay type for inbound peers
  - improve markup handling in the tooltip to facilitate translations
  - update ConnectionType doxygen documentation

  ![Screenshot from 2021-01-11 08-37-44](https://user-images.githubusercontent.com/2415484/104156081-50e69300-53e0-11eb-9b0f-880cb5626d68.png)

ACKs for top commit:
  hebasto:
    re-ACK 79a2576, only suggested changes since my [previous](#180 (review)) review.
  jarolrod:
    ACK 79a2576, tested on macOS 11.1 with Qt 5.15.2
  laanwj:
    Code review ACK 79a2576

Tree-SHA512: 4a8d8f8bfbaefd68e8d1bf3b20d29e4a8e8cfe97b2f8d59d3a4c338a50b61de0a67d97bd8646c04bd5df5a9679c4954b9b46e7cba24bb89f4d0e44e94cf9d66c
jonatack added a commit to jonatack/gui that referenced this pull request Jan 30, 2021
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace "Direction" with "Connection Type" in Peer Tab
7 participants