diff options
author | obscuren <geffobscura@gmail.com> | 2014-09-25 01:57:22 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-09-25 01:57:22 +0800 |
commit | 6ecbbe4006b8d1c5b40e3b268cd78a6b57605018 (patch) | |
tree | 2cae25e87799396d256d53696141f89ff2df97c9 | |
parent | acfb5b85fbd48e2096652552e65c3c7000faca8f (diff) | |
download | go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.tar go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.tar.gz go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.tar.bz2 go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.tar.lz go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.tar.xz go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.tar.zst go-tangerine-6ecbbe4006b8d1c5b40e3b268cd78a6b57605018.zip |
Download indicator
-rw-r--r-- | mist/assets/qml/wallet.qml | 15 | ||||
-rw-r--r-- | mist/gui.go | 21 |
2 files changed, 23 insertions, 13 deletions
diff --git a/mist/assets/qml/wallet.qml b/mist/assets/qml/wallet.qml index 6075b621b..885d09116 100644 --- a/mist/assets/qml/wallet.qml +++ b/mist/assets/qml/wallet.qml @@ -254,6 +254,7 @@ ApplicationWindow { statusBar: StatusBar { height: 32 + id: statusBar RowLayout { Button { id: miningButton @@ -294,16 +295,16 @@ ApplicationWindow { } ProgressBar { - id: syncProgressIndicator - visible: false - objectName: "syncProgressIndicator" + id: downloadIndicator + value: 0 + visible: true + objectName: "downloadIndicator" y: 3 - width: 140 - indeterminate: true - anchors.right: peerGroup.left - anchors.rightMargin: 5 + x: statusBar.width / 2 - this.width / 2 + width: 160 } + RowLayout { id: peerGroup y: 7 diff --git a/mist/gui.go b/mist/gui.go index f80e46761..299a441c0 100644 --- a/mist/gui.go +++ b/mist/gui.go @@ -385,14 +385,13 @@ func (gui *Gui) update() { ) peerUpdateTicker := time.NewTicker(5 * time.Second) - generalUpdateTicker := time.NewTicker(1 * time.Second) + generalUpdateTicker := time.NewTicker(500 * time.Millisecond) statsUpdateTicker := time.NewTicker(5 * time.Second) state := gui.eth.StateManager().TransState() unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance))) - gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate()) lastBlockLabel := gui.getObjectByName("lastBlockLabel") miningLabel := gui.getObjectByName("miningLabel") @@ -439,9 +438,6 @@ func (gui *Gui) update() { state.UpdateStateObject(object) } - case msg := <-chainSyncChan: - sync := msg.Resource.(bool) - gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", sync) case <-objectChan: gui.loadAddressBook() @@ -464,9 +460,22 @@ func (gui *Gui) update() { miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") } + blockLength := gui.eth.BlockPool().BlocksProcessed + chainLength := gui.eth.BlockPool().ChainLength + + var ( + pct float64 = 1.0 / float64(chainLength) * float64(blockLength) + dlWidget = gui.win.Root().ObjectByName("downloadIndicator") + ) + if pct < 1.0 { + dlWidget.Set("visible", true) + dlWidget.Set("value", pct) + } else { + dlWidget.Set("visible", false) + } + case <-statsUpdateTicker.C: gui.setStatsPane() - } } }() |