Introduce PeersIndicator component#127
Conversation
PeersIndicator componentPeersIndicator component
jarolrod
left a comment
There was a problem hiding this comment.
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.
| implicitHeight: 16 | ||
|
|
||
| Row { | ||
| spacing: 6 |
There was a problem hiding this comment.
| spacing: 6 | |
| spacing: 5 |
| Repeater { | ||
| model: root.size | ||
| delegate: Rectangle { | ||
| width: 8 |
There was a problem hiding this comment.
| width: 8 | |
| width: 3 |
| model: root.size | ||
| delegate: Rectangle { | ||
| width: 8 | ||
| height: 8 |
There was a problem hiding this comment.
| height: 8 | |
| height: 3 |
|
Fixed circular dependency.
Thanks! Updated. But now dots look like square pixels :) cc @GBKS |
|
@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. |
Talking about scaling, we should scale down, rather up. |
shaavan
left a comment
There was a problem hiding this comment.
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 |
|---|---|
![]() |
![]() |
I have attached my notes for this PR.
Notes:
- 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.
- This is done by introducing a new struct PeersNumByType, which tracks all the types of nodes along with the total number of nodes.
- The second commit introduces the variable to track the number of outbound peers connected and the total number of outbound peers that can connect.
- 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.
- Commit four, including the PageIndicator.qml to the stub.qml file, allowing it to be displayed on the screen.
| int num_block_relay{0}; | ||
| int num_manual{0}; | ||
| int num_inbound{0}; | ||
| for (const auto* node : nodes_copy) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Do you mind elaborating? What change do you suggest?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
This can be Row? Then can drop width and height bindings below.
Otherwise below should bind implicitWidth and implicitHeight.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Otherwise below should bind
implicitWidthandimplicitHeight.
Thanks! Updated.
Co-authored-by: Christoph Ono <chri@sto.ph>
|
concept ACK on node changes and QML changes. Node changes seem ready to open upstream |
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| // The PeersIndicator component. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Perhaps every component with a one to one link to a design file should have a link for easy reference to the design spec?
|
replaced by #236 |
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"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/236) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/236) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/236) [](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
…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"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/236) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/236) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/236) [](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
…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"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/236) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/236) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/236) [](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


The reference design: https://bitcoindesign.github.io/Bitcoin-Core-App/assets/images/block-clock-connection-states-big.png
Design features implementation:
Looking for designers' Concept (N)ACK, and developers' notes regarding QML code.