Skip to content

Commit 0e01340

Browse files
committed
qml: introduce NetworkIndicator component
Signals to the user what network they are running under when not on the main network.
1 parent b48f4f2 commit 0e01340

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ QML_RES_QML = \
335335
qml/components/ConnectionSettings.qml \
336336
qml/components/DeveloperOptions.qml \
337337
qml/components/PeersIndicator.qml \
338+
qml/components/NetworkIndicator.qml \
338339
qml/components/StorageLocations.qml \
339340
qml/components/StorageOptions.qml \
340341
qml/components/StorageSettings.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<file>components/ConnectionSettings.qml</file>
99
<file>components/PeersIndicator.qml</file>
1010
<file>components/DeveloperOptions.qml</file>
11+
<file>components/NetworkIndicator.qml</file>
1112
<file>components/StorageLocations.qml</file>
1213
<file>components/StorageOptions.qml</file>
1314
<file>components/StorageSettings.qml</file>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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.Controls 2.15
7+
import "../controls"
8+
import "../components"
9+
10+
import org.bitcoincore.qt 1.0
11+
12+
Button {
13+
id: root
14+
property color bgColor
15+
property int textSize: 18
16+
font.family: "Inter"
17+
font.styleName: "Regular"
18+
font.pixelSize: root.textSize
19+
padding: 7
20+
state: chainModel.currentNetworkName
21+
contentItem: Text {
22+
text: root.text
23+
font: root.font
24+
color: Theme.color.white
25+
horizontalAlignment: Text.AlignHCenter
26+
verticalAlignment: Text.AlignVCenter
27+
}
28+
background: Rectangle {
29+
id: bg
30+
color: root.bgColor
31+
radius: 2
32+
}
33+
states: [
34+
State {
35+
name: "MAIN"
36+
PropertyChanges {
37+
target: root
38+
visible: false
39+
}
40+
},
41+
State {
42+
name: "TEST"
43+
PropertyChanges {
44+
target: root
45+
visible: true
46+
text: qsTr("Test Network")
47+
bgColor: Theme.color.green
48+
}
49+
},
50+
State {
51+
name: "SIGNET"
52+
PropertyChanges {
53+
target: root
54+
visible: true
55+
text: qsTr("Signet Network")
56+
bgColor: Theme.color.amber
57+
}
58+
},
59+
State {
60+
name: "REGTEST"
61+
PropertyChanges {
62+
target: root
63+
visible: true
64+
text: qsTr("Regtest Mode")
65+
bgColor: Theme.color.blue
66+
}
67+
}
68+
]
69+
}

0 commit comments

Comments
 (0)