@@ -22,7 +22,11 @@ Item {
22
22
property int headerSize: 32
23
23
property bool connected: nodeModel .numOutboundPeers > 0
24
24
property bool synced: nodeModel .verificationProgress > 0.999
25
+ property string syncProgress: formatProgressPercentage (nodeModel .verificationProgress * 100 )
25
26
property bool paused: false
27
+ property var syncState: formatRemainingSyncTime (nodeModel .remainingSyncTime )
28
+ property string syncTime: syncState .text
29
+ property bool estimating: syncState .estimating
26
30
27
31
activeFocusOnTab: true
28
32
@@ -82,15 +86,44 @@ Item {
82
86
Label {
83
87
id: subText
84
88
anchors .top : mainText .bottom
89
+ property bool estimating: root .estimating
85
90
anchors .horizontalCenter : root .horizontalCenter
86
91
font .family : " Inter"
87
92
font .styleName : " Semi Bold"
88
93
font .pixelSize : 18
89
94
color: Theme .color .neutral4
90
95
91
- Behavior on color {
92
- ColorAnimation { duration: 150 }
96
+ Component .onCompleted : {
97
+ colorChanged .connect (function () {
98
+ if (! subText .estimating ) {
99
+ themeChange .restart ();
100
+ }
101
+ });
102
+
103
+ estimatingChanged .connect (function () {
104
+ if (subText .estimating ) {
105
+ estimatingTime .start ();
106
+ } else {
107
+ estimatingTime .stop ();
108
+ }
109
+ });
110
+
111
+ subText .estimatingChanged (subText .estimating );
112
+ }
113
+
114
+ ColorAnimation on color{
115
+ id: themeChange
116
+ target: subText
117
+ duration: 150
93
118
}
119
+
120
+ SequentialAnimation {
121
+ id: estimatingTime
122
+ loops: Animation .Infinite
123
+ ColorAnimation { target: subText; property: " color" ; from: subText .color ; to: Theme .color .neutral6 ; duration: 1000 }
124
+ ColorAnimation { target: subText; property: " color" ; from: Theme .color .neutral6 ; to: subText .color ; duration: 1000 }
125
+ }
126
+
94
127
}
95
128
96
129
PeersIndicator {
@@ -119,17 +152,17 @@ Item {
119
152
name: " IBD" ; when: ! synced && ! paused && connected
120
153
PropertyChanges {
121
154
target: root
122
- header: formatProgressPercentage ( nodeModel . verificationProgress * 100 )
123
- subText: formatRemainingSyncTime ( nodeModel . remainingSyncTime )
155
+ header: root . syncProgress
156
+ subText: root . syncTime
124
157
}
125
158
},
126
-
127
159
State {
128
160
name: " BLOCKCLOCK" ; when: synced && ! paused && connected
129
161
PropertyChanges {
130
162
target: root
131
163
header: Number (nodeModel .blockTipHeight ).toLocaleString (Qt .locale (), ' f' , 0 )
132
164
subText: " Blocktime"
165
+ estimating: false
133
166
}
134
167
},
135
168
@@ -140,6 +173,7 @@ Item {
140
173
header: " Paused"
141
174
headerSize: 24
142
175
subText: " Tap to resume"
176
+ estimating: false
143
177
}
144
178
PropertyChanges {
145
179
target: bitcoinIcon
@@ -158,6 +192,7 @@ Item {
158
192
header: " Connecting"
159
193
headerSize: 24
160
194
subText: " Please wait"
195
+ estimating: false
161
196
}
162
197
PropertyChanges {
163
198
target: bitcoinIcon
@@ -191,29 +226,55 @@ Item {
191
226
minutes %= 1440 ;
192
227
var hours = Math .floor (minutes / 60 );
193
228
minutes %= 60 ;
229
+ var result = " " ;
230
+ var estimatingStatus = false ;
194
231
195
232
if (weeks > 0 ) {
196
- return " ~" + weeks + (weeks === 1 ? " week" : " weeks" ) + " left" ;
233
+ return {
234
+ text: " ~" + weeks + (weeks === 1 ? " week" : " weeks" ) + " left" ,
235
+ estimating: false
236
+ };
197
237
}
198
238
if (days > 0 ) {
199
- return " ~" + days + (days === 1 ? " day" : " days" ) + " left" ;
239
+ return {
240
+ text: " ~" + days + (days === 1 ? " day" : " days" ) + " left" ,
241
+ estimating: false
242
+ };
200
243
}
201
244
if (hours >= 5 ) {
202
- return " ~" + hours + (hours === 1 ? " hour" : " hours" ) + " left" ;
245
+ return {
246
+ text: " ~" + hours + (hours === 1 ? " hour" : " hours" ) + " left" ,
247
+ estimating: false
248
+ };
203
249
}
204
250
if (hours > 0 ) {
205
- return " ~" + hours + " h " + minutes + " m" + " left" ;
251
+ return {
252
+ text: " ~" + hours + " h " + minutes + " m" + " left" ,
253
+ estimating: false
254
+ };
206
255
}
207
256
if (minutes >= 5 ) {
208
- return " ~" + minutes + (minutes === 1 ? " minute" : " minutes" ) + " left" ;
257
+ return {
258
+ text: " ~" + minutes + (minutes === 1 ? " minute" : " minutes" ) + " left" ,
259
+ estimating: false
260
+ };
209
261
}
210
262
if (minutes > 0 ) {
211
- return " ~" + minutes + " m " + seconds + " s" + " left" ;
263
+ return {
264
+ text: " ~" + minutes + " m " + seconds + " s" + " left" ,
265
+ estimating: false
266
+ };
212
267
}
213
268
if (seconds > 0 ) {
214
- return " ~" + seconds + (seconds === 1 ? " second" : " seconds" ) + " left" ;
269
+ return {
270
+ text: " ~" + seconds + (seconds === 1 ? " second" : " seconds" ) + " left" ,
271
+ estimating: false
272
+ };
273
+ } else {
274
+ return {
275
+ text: " Estimating" ,
276
+ estimating: true
277
+ };
215
278
}
216
-
217
- return " Estimating" ;
218
279
}
219
280
}
0 commit comments