Skip to content

Introduce PeersIndicator component#127

Closed
hebasto wants to merge 4 commits into
bitcoin-core:mainfrom
hebasto:220603-peers
Closed

Introduce PeersIndicator component#127
hebasto wants to merge 4 commits into
bitcoin-core:mainfrom
hebasto:220603-peers

Conversation

@hebasto
Copy link
Copy Markdown
Member

@hebasto hebasto commented Jun 3, 2022

The reference design: https://bitcoindesign.github.io/Bitcoin-Core-App/assets/images/block-clock-connection-states-big.png

Design features implementation:

  • a single blinking dot
  • dots are lit up proportional to the count of the outbound peers

Looking for designers' Concept (N)ACK, and developers' notes regarding QML code.

Windows
macOS
Android

@hebasto hebasto changed the title Introduced PeersIndicator component Introduce PeersIndicator component Jun 3, 2022
Copy link
Copy Markdown
Contributor

@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.

the design specifies spacing of 5 between each connection dot, and that each connection dot be 3x3, see: https://www.figma.com/file/GaCoOSNHB2yMB9ThiDtred/Bitcoin-Core-App?node-id=3288%3A70945

With these changes, it'll look a bit small in its current demo. But it should look fine when it's a part of the block clock.

Comment thread src/qml/components/PeersIndicator.qml Outdated
implicitHeight: 16

Row {
spacing: 6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
spacing: 6
spacing: 5

Comment thread src/qml/components/PeersIndicator.qml Outdated
Repeater {
model: root.size
delegate: Rectangle {
width: 8
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
width: 8
width: 3

Comment thread src/qml/components/PeersIndicator.qml Outdated
model: root.size
delegate: Rectangle {
width: 8
height: 8
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
height: 8
height: 3

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Jun 3, 2022

Fixed circular dependency.

the design specifies spacing of 5 between each connection dot, and that each connection dot be 3x3, see: https://www.figma.com/file/GaCoOSNHB2yMB9ThiDtred/Bitcoin-Core-App?node-id=3288%3A70945

Thanks! Updated.

But now dots look like square pixels :)

cc @GBKS

@jarolrod
Copy link
Copy Markdown
Contributor

jarolrod commented Jun 3, 2022

@hebasto yes that is true, if we need to scale it, we can scale it from the current proportions. The orginal implementation looked a lot like the PageIndicator we had before.

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Jun 3, 2022

we can scale it from the current proportions

Talking about scaling, we should scale down, rather up.

Copy link
Copy Markdown
Contributor

@shaavan shaavan 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

  • The added code changes effectively introduce the progress indicator.
  • I was able to successfully compile and run the PR on Ubuntu 22.04 with Qt version 5.15.3
  • As @jarolrod mentioned, following the design guide precisely regarding sizing and spacing leads to dots being relatively smaller than the ones displayed in PR.

Demo:

According to this PR According design guide
Screencast from 04-06-22 01 35 41 AM IST Screencast from 04-06-22 01 37 59 AM IST

I have attached my notes for this PR.

Notes:

  1. The first commit replaces the “notify only about the total number of nodes change” to “notify about change in any type of nodes”. This change is necessary for the progress indicator component.
    1. This is done by introducing a new struct PeersNumByType, which tracks all the types of nodes along with the total number of nodes.
  2. The second commit introduces the variable to track the number of outbound peers connected and the total number of outbound peers that can connect.
  3. The third commit introduces the PageIndicator.qml file, which utilizes the above two variables to display a real-time indicator for the number of peers connected to our node.
  4. Commit four, including the PageIndicator.qml to the stub.qml file, allowing it to be displayed on the screen.

Comment thread src/qml/components/PeersIndicator.qml Outdated
Comment thread src/net.cpp
int num_block_relay{0};
int num_manual{0};
int num_inbound{0};
for (const auto* node : nodes_copy) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

36e20da

Correct me if I'm wrong but I think it's safe to use node without AddRef/Release because DeleteNode isn't called concurrently with CConnman::NotifyNumConnectionsChanged.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you mind elaborating? What change do you suggest?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's my point, I think the correct code is fine. Initially, I wondered if some AddRef/Release was needed.

import QtQuick 2.15
import "../controls"

Item {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

b0b36d6

This can be Row? Then can drop width and height bindings below.

Otherwise below should bind implicitWidth and implicitHeight.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This can be Row?

Yes, it can. But using Item provides better encapsulation and hiding implementation details. For example, PeersIndicator { padding: 42 } will fail in the current branch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Otherwise below should bind implicitWidth and implicitHeight.

Thanks! Updated.

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Jun 4, 2022

Updated 88b99c9 -> aad0ff4 (pr127.02 -> pr127.03, diff):

Otherwise below should bind implicitWidth and implicitHeight.

Comment thread src/qml/nodemodel.cpp
@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Jun 5, 2022

Updated aad0ff4 -> 179ca23 (pr127.03 -> pr127.04, diff):

  • addressed @jarolrod's comment
  • added blinking of the first dot according to the design
  • other small improvements (I hope)

@jarolrod
Copy link
Copy Markdown
Contributor

jarolrod commented Jun 6, 2022

concept ACK on node changes and QML changes. Node changes seem ready to open upstream

@GBKS GBKS mentioned this pull request Jul 13, 2022
@hebasto hebasto added the UX Designers' opinions are required label Jul 27, 2022
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

// The PeersIndicator component.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess there's no need for this line, just look at the path and name of the file

// file COPYING or http://www.opensource.org/licenses/mit-license.php.

// The PeersIndicator component.
// See reference design: https://bitcoindesign.github.io/Bitcoin-Core-App/assets/images/block-clock-connection-states-big.png
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps every component with a one to one link to a design file should have a link for easy reference to the design spec?

@jarolrod
Copy link
Copy Markdown
Contributor

jarolrod commented Feb 1, 2023

replaced by #236

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Feb 1, 2023

replaced by #236

Closed in favour of #236.

@hebasto hebasto closed this Feb 1, 2023
hebasto added a commit that referenced this pull request Feb 9, 2023
c7c73b8 qml: add PeersIndicator to BlockClock (jarolrod)
4f3368a qml: Add `PeersIndicator` component (Hennadii Stepanov)
b22b88b qml: Add `NodeModel::numOutboundPeers` property (Hennadii Stepanov)
475c63e net: Notify about connection number by type (Hennadii Stepanov)

Pull request description:

  This is a rebased version of, and replaces, #127

  Introduces the actual `PeersIndicator` component and adds it to the `BlockClock`

  | Dark Mode | Light Mode |
  | --------- | ---------- |
  | <img width="752" alt="Screen Shot 2023-01-31 at 12 48 23 AM" src="https://user-images.githubusercontent.com/23396902/215676831-6573a94f-2030-4bf2-b45b-9d325be42600.png"> | <img width="752" alt="Screen Shot 2023-01-31 at 12 49 09 AM" src="https://user-images.githubusercontent.com/23396902/215676882-96f82c03-43ff-449d-b5d9-d7016fb0540b.png"> |

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/236)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/236)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/236)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/236)

ACKs for top commit:
  johnny9:
    ACK c7c73b8

Tree-SHA512: f5af2cd53bcecdb9441f412e94ad6557c48aad7998c2da69f1e0174682a0761151ca72b27a094b12d3f9055dff61694b9205297f5a4db9559bd0ed0ff3c4fdca
johnny9 pushed a commit to johnny9/bitcoin-core-app that referenced this pull request Jul 4, 2025
…dd to BlockClock

fc34996 qml: add PeersIndicator to BlockClock (jarolrod)
5d0ea0e qml: Add `PeersIndicator` component (Hennadii Stepanov)
f5c2cd0 qml: Add `NodeModel::numOutboundPeers` property (Hennadii Stepanov)
475c63ef4752f7b79eca647072208f3a5be8d56e net: Notify about connection number by type (Hennadii Stepanov)

Pull request description:

  This is a rebased version of, and replaces, bitcoin-core/gui-qml#127

  Introduces the actual `PeersIndicator` component and adds it to the `BlockClock`

  | Dark Mode | Light Mode |
  | --------- | ---------- |
  | <img width="752" alt="Screen Shot 2023-01-31 at 12 48 23 AM" src="https://user-images.githubusercontent.com/23396902/215676831-6573a94f-2030-4bf2-b45b-9d325be42600.png"> | <img width="752" alt="Screen Shot 2023-01-31 at 12 49 09 AM" src="https://user-images.githubusercontent.com/23396902/215676882-96f82c03-43ff-449d-b5d9-d7016fb0540b.png"> |

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/236)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/236)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/236)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/236)

ACKs for top commit:
  johnny9:
    ACK fc34996

Tree-SHA512: f5af2cd53bcecdb9441f412e94ad6557c48aad7998c2da69f1e0174682a0761151ca72b27a094b12d3f9055dff61694b9205297f5a4db9559bd0ed0ff3c4fdca
tx-signer450 added a commit to tx-signer450/gui-qml that referenced this pull request Oct 20, 2025
…dd to BlockClock

fc34996357b8cb7830b1fbc26bc8f91575f88cff qml: add PeersIndicator to BlockClock (jarolrod)
5d0ea0ed5768109a60a86ec1a22e146812a1e021 qml: Add `PeersIndicator` component (Hennadii Stepanov)
f5c2cd044833e8365224f382692d27ddcfa8f3d9 qml: Add `NodeModel::numOutboundPeers` property (Hennadii Stepanov)
475c63ef4752f7b79eca647072208f3a5be8d56e net: Notify about connection number by type (Hennadii Stepanov)

Pull request description:

  This is a rebased version of, and replaces, bitcoin-core/gui-qml#127

  Introduces the actual `PeersIndicator` component and adds it to the `BlockClock`

  | Dark Mode | Light Mode |
  | --------- | ---------- |
  | <img width="752" alt="Screen Shot 2023-01-31 at 12 48 23 AM" src="https://user-images.githubusercontent.com/23396902/215676831-6573a94f-2030-4bf2-b45b-9d325be42600.png"> | <img width="752" alt="Screen Shot 2023-01-31 at 12 49 09 AM" src="https://user-images.githubusercontent.com/23396902/215676882-96f82c03-43ff-449d-b5d9-d7016fb0540b.png"> |

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/236)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/236)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/236)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/236)

ACKs for top commit:
  johnny9:
    ACK fc34996357b8cb7830b1fbc26bc8f91575f88cff

Tree-SHA512: f5af2cd53bcecdb9441f412e94ad6557c48aad7998c2da69f1e0174682a0761151ca72b27a094b12d3f9055dff61694b9205297f5a4db9559bd0ed0ff3c4fdca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs rebase UX Designers' opinions are required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants