Skip to content

Commit 7e9daad

Browse files
committed
Merge #328: Remember network traffic graph scale
213c4e7 qml: remember network traffic graph scale (jarolrod) Pull request description: This is nice to have but also fixes an issue in the UI when selecting a time scale, moving away from the graph, then coming back to the graph: ## master | select 1hr | leave, then come back | select 5 min again| | ---------- | --------------------- | ----------------- | | <img width="642" alt="Screen Shot 2023-04-21 at 1 10 15 AM" src="https://user-images.githubusercontent.com/23396902/233546043-3b9240d2-94b8-4a19-866d-25d59982959d.png"> | <img width="641" alt="Screen Shot 2023-04-21 at 1 10 28 AM" src="https://user-images.githubusercontent.com/23396902/233546097-0c06393f-d1c0-41f6-a002-637bf40c05fb.png"> | <img width="643" alt="Screen Shot 2023-04-21 at 1 10 39 AM" src="https://user-images.githubusercontent.com/23396902/233546112-5878a7ea-c001-4b09-864a-aeee3da6b290.png"> | ## PR | select 1hr | leave, then come back | select 5 min again| | ---------- | --------------------- | ----------------- | | <img width="752" alt="Screen Shot 2023-04-21 at 1 14 13 AM" src="https://user-images.githubusercontent.com/23396902/233546333-0999aaab-1924-420c-9105-604a758d30d6.png"> | <img width="752" alt="Screen Shot 2023-04-21 at 1 14 19 AM" src="https://user-images.githubusercontent.com/23396902/233546353-502a676c-c567-46d1-b64a-62bac2a5e53d.png"> | <img width="752" alt="Screen Shot 2023-04-21 at 1 14 21 AM" src="https://user-images.githubusercontent.com/23396902/233546369-bbdd405b-19cd-4b92-b1fb-d4f2a27f2b65.png"> | [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/unsecure_win_gui.zip?branch=pull/328) [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/unsecure_mac_gui.zip?branch=pull/328) [![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/unsecure_mac_arm64_gui.zip?branch=pull/328) [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/unsecure_android_apk.zip?branch=pull/328) ACKs for top commit: johnny9: ACK 213c4e7 Tree-SHA512: c4683912b34f280774f209cc598245da07a08a9c8181435ce1501a66a95f19c78205472189452d062e8bd8df13f158e6e8a032a305f08047668fb88ebb0edf5d
2 parents c9492c7 + 213c4e7 commit 7e9daad

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

src/qml/pages/node/NetworkTraffic.qml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77
import QtQuick.Layouts 1.15
8+
import Qt.labs.settings 1.0
89
import "../../controls"
910
import "../../components"
1011

1112
import org.bitcoincore.qt 1.0
1213

1314
InformationPage {
1415
id: root
15-
property int maxSamples: 300
16+
property int trafficGraphScale: 300
17+
18+
Settings {
19+
id: settings
20+
property alias trafficGraphScale: root.trafficGraphScale
21+
}
22+
1623
bannerActive: false
1724
bold: true
1825
headerText: qsTr("Network Traffic")
@@ -41,64 +48,68 @@ InformationPage {
4148
anchors.centerIn: parent
4249
anchors.margins: 3
4350
spacing: 5
51+
4452
ToggleButton {
4553
text: qsTr("5 min")
4654
autoExclusive: true
47-
checked: true
55+
checked: root.trafficGraphScale === 300
4856
bgRadius: 3
4957
textColor: Theme.color.neutral9
5058
textActiveColor: Theme.color.neutral0
5159
bgActiveColor: Theme.color.neutral9
5260
bgDefaultColor: Theme.color.neutral3
5361

5462
onClicked: {
55-
root.maxSamples = 300
56-
networkTrafficTower.updateFilterWindowSize(root.maxSamples / 10)
63+
root.trafficGraphScale = 300
64+
networkTrafficTower.updateFilterWindowSize(root.trafficGraphScale / 10)
5765
}
5866
}
5967

6068
ToggleButton {
6169
text: qsTr("1 hour")
6270
autoExclusive: true
71+
checked: root.trafficGraphScale === 3600
6372
bgRadius: 3
6473
textColor: Theme.color.neutral9
6574
textActiveColor: Theme.color.neutral0
6675
bgActiveColor: Theme.color.neutral9
6776
bgDefaultColor: Theme.color.neutral3
6877

6978
onClicked: {
70-
root.maxSamples = 3600
71-
networkTrafficTower.updateFilterWindowSize(root.maxSamples / 10)
79+
root.trafficGraphScale = 3600
80+
networkTrafficTower.updateFilterWindowSize(root.trafficGraphScale / 10)
7281
}
7382
}
7483

7584
ToggleButton {
7685
text: qsTr("12 hours")
7786
autoExclusive: true
87+
checked: root.trafficGraphScale === 3600 * 12
7888
bgRadius: 3
7989
textColor: Theme.color.neutral9
8090
textActiveColor: Theme.color.neutral0
8191
bgActiveColor: Theme.color.neutral9
8292
bgDefaultColor: Theme.color.neutral3
8393

8494
onClicked: {
85-
root.maxSamples = 3600 * 12
86-
networkTrafficTower.updateFilterWindowSize(root.maxSamples / 10)
95+
root.trafficGraphScale = 3600 * 12
96+
networkTrafficTower.updateFilterWindowSize(root.trafficGraphScale / 10)
8797
}
8898
}
8999

90100
ToggleButton {
91101
text: qsTr("1 day")
92102
autoExclusive: true
103+
checked: root.trafficGraphScale === 3600 * 24
93104
bgRadius: 3
94105
textColor: Theme.color.neutral9
95106
textActiveColor: Theme.color.neutral0
96107
bgActiveColor: Theme.color.neutral9
97108
bgDefaultColor: Theme.color.neutral3
98109

99110
onClicked: {
100-
root.maxSamples = 3600 * 24
101-
networkTrafficTower.updateFilterWindowSize(root.maxSamples / 10)
111+
root.trafficGraphScale = 3600 * 24
112+
networkTrafficTower.updateFilterWindowSize(root.trafficGraphScale / 10)
102113
}
103114
}
104115
}
@@ -118,7 +129,7 @@ InformationPage {
118129
fillColor: Theme.color.green
119130
lineColor: Theme.color.green
120131
markerLineColor: Theme.color.neutral2
121-
maxSamples: root.maxSamples
132+
maxSamples: root.trafficGraphScale
122133
maxValue: networkTrafficTower.maxReceivedRateBps
123134
valueList: networkTrafficTower.receivedRateList
124135
maxRateBps: networkTrafficTower.maxReceivedRateBps
@@ -137,7 +148,7 @@ InformationPage {
137148
fillColor: Theme.color.blue
138149
lineColor: Theme.color.blue
139150
markerLineColor: Theme.color.neutral2
140-
maxSamples: root.maxSamples
151+
maxSamples: root.trafficGraphScale
141152
maxValue: networkTrafficTower.maxSentRateBps
142153
valueList: networkTrafficTower.sentRateList
143154
maxRateBps: networkTrafficTower.maxSentRateBps

0 commit comments

Comments
 (0)