@@ -25,7 +25,11 @@ Item {
25
25
property int headerSize: 32
26
26
property bool connected: nodeModel .numOutboundPeers > 0
27
27
property bool synced: nodeModel .verificationProgress > 0.999
28
+ property string syncProgress: formatProgressPercentage (nodeModel .verificationProgress * 100 )
28
29
property bool paused: false
30
+ property var syncState: formatRemainingSyncTime (nodeModel .remainingSyncTime )
31
+ property string syncTime: syncState .text
32
+ property bool estimating: syncState .estimating
29
33
30
34
activeFocusOnTab: true
31
35
@@ -94,15 +98,44 @@ Item {
94
98
Label {
95
99
id: subText
96
100
anchors .top : mainText .bottom
101
+ property bool estimating: root .estimating
97
102
anchors .horizontalCenter : root .horizontalCenter
98
103
font .family : " Inter"
99
104
font .styleName : " Semi Bold"
100
105
font .pixelSize : dial .width * (9 / 100 )
101
106
color: Theme .color .neutral4
102
107
103
- Behavior on color {
104
- ColorAnimation { duration: 150 }
108
+ Component .onCompleted : {
109
+ colorChanged .connect (function () {
110
+ if (! subText .estimating ) {
111
+ themeChange .restart ();
112
+ }
113
+ });
114
+
115
+ estimatingChanged .connect (function () {
116
+ if (subText .estimating ) {
117
+ estimatingTime .start ();
118
+ } else {
119
+ estimatingTime .stop ();
120
+ }
121
+ });
122
+
123
+ subText .estimatingChanged (subText .estimating );
124
+ }
125
+
126
+ ColorAnimation on color{
127
+ id: themeChange
128
+ target: subText
129
+ duration: 150
105
130
}
131
+
132
+ SequentialAnimation {
133
+ id: estimatingTime
134
+ loops: Animation .Infinite
135
+ ColorAnimation { target: subText; property: " color" ; from: subText .color ; to: Theme .color .neutral6 ; duration: 1000 }
136
+ ColorAnimation { target: subText; property: " color" ; from: Theme .color .neutral6 ; to: subText .color ; duration: 1000 }
137
+ }
138
+
106
139
}
107
140
108
141
PeersIndicator {
@@ -140,17 +173,17 @@ Item {
140
173
name: " IBD" ; when: ! synced && ! paused && connected
141
174
PropertyChanges {
142
175
target: root
143
- header: formatProgressPercentage ( nodeModel . verificationProgress * 100 )
144
- subText: formatRemainingSyncTime ( nodeModel . remainingSyncTime )
176
+ header: root . syncProgress
177
+ subText: root . syncTime
145
178
}
146
179
},
147
-
148
180
State {
149
181
name: " BLOCKCLOCK" ; when: synced && ! paused && connected
150
182
PropertyChanges {
151
183
target: root
152
184
header: Number (nodeModel .blockTipHeight ).toLocaleString (Qt .locale (), ' f' , 0 )
153
185
subText: " Blocktime"
186
+ estimating: false
154
187
}
155
188
},
156
189
@@ -161,6 +194,7 @@ Item {
161
194
header: " Paused"
162
195
headerSize: dial .width * (3 / 25 )
163
196
subText: " Tap to resume"
197
+ estimating: false
164
198
}
165
199
PropertyChanges {
166
200
target: bitcoinIcon
@@ -179,6 +213,7 @@ Item {
179
213
header: " Connecting"
180
214
headerSize: dial .width * (3 / 25 )
181
215
subText: " Please wait"
216
+ estimating: false
182
217
}
183
218
PropertyChanges {
184
219
target: bitcoinIcon
@@ -212,29 +247,55 @@ Item {
212
247
minutes %= 1440 ;
213
248
var hours = Math .floor (minutes / 60 );
214
249
minutes %= 60 ;
250
+ var result = " " ;
251
+ var estimatingStatus = false ;
215
252
216
253
if (weeks > 0 ) {
217
- return " ~" + weeks + (weeks === 1 ? " week" : " weeks" ) + " left" ;
254
+ return {
255
+ text: " ~" + weeks + (weeks === 1 ? " week" : " weeks" ) + " left" ,
256
+ estimating: false
257
+ };
218
258
}
219
259
if (days > 0 ) {
220
- return " ~" + days + (days === 1 ? " day" : " days" ) + " left" ;
260
+ return {
261
+ text: " ~" + days + (days === 1 ? " day" : " days" ) + " left" ,
262
+ estimating: false
263
+ };
221
264
}
222
265
if (hours >= 5 ) {
223
- return " ~" + hours + (hours === 1 ? " hour" : " hours" ) + " left" ;
266
+ return {
267
+ text: " ~" + hours + (hours === 1 ? " hour" : " hours" ) + " left" ,
268
+ estimating: false
269
+ };
224
270
}
225
271
if (hours > 0 ) {
226
- return " ~" + hours + " h " + minutes + " m" + " left" ;
272
+ return {
273
+ text: " ~" + hours + " h " + minutes + " m" + " left" ,
274
+ estimating: false
275
+ };
227
276
}
228
277
if (minutes >= 5 ) {
229
- return " ~" + minutes + (minutes === 1 ? " minute" : " minutes" ) + " left" ;
278
+ return {
279
+ text: " ~" + minutes + (minutes === 1 ? " minute" : " minutes" ) + " left" ,
280
+ estimating: false
281
+ };
230
282
}
231
283
if (minutes > 0 ) {
232
- return " ~" + minutes + " m " + seconds + " s" + " left" ;
284
+ return {
285
+ text: " ~" + minutes + " m " + seconds + " s" + " left" ,
286
+ estimating: false
287
+ };
233
288
}
234
289
if (seconds > 0 ) {
235
- return " ~" + seconds + (seconds === 1 ? " second" : " seconds" ) + " left" ;
290
+ return {
291
+ text: " ~" + seconds + (seconds === 1 ? " second" : " seconds" ) + " left" ,
292
+ estimating: false
293
+ };
294
+ } else {
295
+ return {
296
+ text: " Estimating" ,
297
+ estimating: true
298
+ };
236
299
}
237
-
238
- return " Estimating" ;
239
300
}
240
301
}
0 commit comments