Skip to content

Commit 4f3368a

Browse files
hebastoGBKS
authored andcommitted
qml: Add PeersIndicator component
Co-authored-by: Christoph Ono <[email protected]>
1 parent b22b88b commit 4f3368a

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ QML_RES_QML = \
333333
qml/components/ConnectionOptions.qml \
334334
qml/components/ConnectionSettings.qml \
335335
qml/components/DeveloperOptions.qml \
336+
qml/components/PeersIndicator.qml \
336337
qml/components/StorageLocations.qml \
337338
qml/components/StorageOptions.qml \
338339
qml/components/StorageSettings.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<file>components/BlockCounter.qml</file>
66
<file>components/ConnectionOptions.qml</file>
77
<file>components/ConnectionSettings.qml</file>
8+
<file>components/PeersIndicator.qml</file>
89
<file>components/DeveloperOptions.qml</file>
910
<file>components/StorageLocations.qml</file>
1011
<file>components/StorageOptions.qml</file>

src/qml/components/PeersIndicator.qml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Layouts 1.15
7+
import "../controls"
8+
9+
RowLayout {
10+
id: root
11+
required property int numOutboundPeers
12+
required property int maxNumOutboundPeers
13+
property int size: 5
14+
15+
spacing: 5
16+
Repeater {
17+
model: 5
18+
Rectangle {
19+
width: 3
20+
height: 3
21+
radius: width / 2
22+
color: Theme.color.neutral9
23+
opacity: (index === 0 && root.numOutboundPeers > 0) || (index + 1 <= root.size * root.numOutboundPeers / root.maxNumOutboundPeers) ? 0.95 : 0.45
24+
Behavior on opacity { OpacityAnimator { duration: 100 } }
25+
SequentialAnimation on opacity {
26+
loops: Animation.Infinite
27+
running: numOutboundPeers === 0 && index === 0
28+
SmoothedAnimation { to: 0; velocity: 2.2 }
29+
SmoothedAnimation { to: 1; velocity: 2.2 }
30+
}
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)