Skip to content

Commit 6ecbbe4

Browse files
committed
Download indicator
1 parent acfb5b8 commit 6ecbbe4

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

mist/assets/qml/wallet.qml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ ApplicationWindow {
254254

255255
statusBar: StatusBar {
256256
height: 32
257+
id: statusBar
257258
RowLayout {
258259
Button {
259260
id: miningButton
@@ -294,16 +295,16 @@ ApplicationWindow {
294295
}
295296

296297
ProgressBar {
297-
id: syncProgressIndicator
298-
visible: false
299-
objectName: "syncProgressIndicator"
298+
id: downloadIndicator
299+
value: 0
300+
visible: true
301+
objectName: "downloadIndicator"
300302
y: 3
301-
width: 140
302-
indeterminate: true
303-
anchors.right: peerGroup.left
304-
anchors.rightMargin: 5
303+
x: statusBar.width / 2 - this.width / 2
304+
width: 160
305305
}
306306

307+
307308
RowLayout {
308309
id: peerGroup
309310
y: 7

mist/gui.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,13 @@ func (gui *Gui) update() {
385385
)
386386

387387
peerUpdateTicker := time.NewTicker(5 * time.Second)
388-
generalUpdateTicker := time.NewTicker(1 * time.Second)
388+
generalUpdateTicker := time.NewTicker(500 * time.Millisecond)
389389
statsUpdateTicker := time.NewTicker(5 * time.Second)
390390

391391
state := gui.eth.StateManager().TransState()
392392

393393
unconfirmedFunds := new(big.Int)
394394
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance)))
395-
gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
396395

397396
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
398397
miningLabel := gui.getObjectByName("miningLabel")
@@ -439,9 +438,6 @@ func (gui *Gui) update() {
439438

440439
state.UpdateStateObject(object)
441440
}
442-
case msg := <-chainSyncChan:
443-
sync := msg.Resource.(bool)
444-
gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", sync)
445441

446442
case <-objectChan:
447443
gui.loadAddressBook()
@@ -464,9 +460,22 @@ func (gui *Gui) update() {
464460
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
465461
}
466462

463+
blockLength := gui.eth.BlockPool().BlocksProcessed
464+
chainLength := gui.eth.BlockPool().ChainLength
465+
466+
var (
467+
pct float64 = 1.0 / float64(chainLength) * float64(blockLength)
468+
dlWidget = gui.win.Root().ObjectByName("downloadIndicator")
469+
)
470+
if pct < 1.0 {
471+
dlWidget.Set("visible", true)
472+
dlWidget.Set("value", pct)
473+
} else {
474+
dlWidget.Set("visible", false)
475+
}
476+
467477
case <-statsUpdateTicker.C:
468478
gui.setStatsPane()
469-
470479
}
471480
}
472481
}()

0 commit comments

Comments
 (0)