diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-18 17:57:58 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-18 17:57:58 +0800 |
commit | 34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a (patch) | |
tree | 4a563d3a7ce84f0bf62e231c82c4d91f0cb35851 | |
parent | 44296c0b33de5f6c2ff28c6a0fd528d6ccd04dec (diff) | |
download | go-tangerine-34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a.tar.gz go-tangerine-34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a.tar.zst go-tangerine-34e2ab9f9fac7067fa4a4dbe6170283f1d9c682a.zip |
Added block update
-rw-r--r-- | ethereal/assets/qml/wallet.qml | 52 | ||||
-rw-r--r-- | ethereal/debugger.go | 3 | ||||
-rw-r--r-- | ethereal/gui.go | 15 |
3 files changed, 47 insertions, 23 deletions
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 592698d8e..bb1f60260 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -419,6 +419,17 @@ ApplicationWindow { } } + Label { + y: 6 + id: lastBlockLabel + objectName: "lastBlockLabel" + visible: true + text: "" + font.pixelSize: 10 + anchors.right: peerGroup.left + anchors.rightMargin: 5 + } + ProgressBar { id: syncProgressIndicator visible: false @@ -426,29 +437,30 @@ ApplicationWindow { y: 3 width: 140 indeterminate: true - anchors.right: peerLabel.left + anchors.right: peerGroup.left anchors.rightMargin: 5 } - Label { - y: 7 - anchors.right: peerImage.left - anchors.rightMargin: 5 - id: peerLabel - font.pixelSize: 8 - text: "0 / 0" - } - Image { - y: 7 - id: peerImage - anchors.right: parent.right - width: 10; height: 10 - MouseArea { - onDoubleClicked: peerWindow.visible = true - anchors.fill: parent - } - source: "../network.png" - } + RowLayout { + id: peerGroup + y: 7 + anchors.right: parent.right + MouseArea { + onDoubleClicked: peerWindow.visible = true + anchors.fill: parent + } + + Label { + id: peerLabel + font.pixelSize: 8 + text: "0 / 0" + } + Image { + id: peerImage + width: 10; height: 10 + source: "../network.png" + } + } } Window { diff --git a/ethereal/debugger.go b/ethereal/debugger.go index 997c2e8dd..7742b1627 100644 --- a/ethereal/debugger.go +++ b/ethereal/debugger.go @@ -17,6 +17,8 @@ type DebuggerWindow struct { vm *ethchain.Vm Db *Debugger + + state *ethchain.State } func NewDebuggerWindow(lib *UiLib) *DebuggerWindow { @@ -53,6 +55,7 @@ func (self *DebuggerWindow) SetCode(code string) { func (self *DebuggerWindow) SetData(data string) { self.win.Set("dataText", data) } + func (self *DebuggerWindow) SetAsm(data []byte) { self.win.Root().Call("clearAsm") diff --git a/ethereal/gui.go b/ethereal/gui.go index 9a65ff3d0..ad701a584 100644 --- a/ethereal/gui.go +++ b/ethereal/gui.go @@ -266,6 +266,10 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) { gui.win.Root().Call("setWalletValue", str) } +func (self *Gui) getObjectByName(objectName string) qml.Object { + return self.win.Root().ObjectByName(objectName) +} + // Simple go routine function that updates the list of peers in the GUI func (gui *Gui) update() { reactor := gui.eth.Reactor() @@ -289,13 +293,16 @@ func (gui *Gui) update() { } reactor.Subscribe("peerList", peerChan) - ticker := time.NewTicker(5 * time.Second) + peerUpdateTicker := time.NewTicker(5 * time.Second) + generalUpdateTicker := time.NewTicker(1 * 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()).Amount))) - gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate()) + gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate()) + + lastBlockLabel := gui.getObjectByName("lastBlockLabel") for { select { @@ -345,8 +352,10 @@ func (gui *Gui) update() { gui.loadAddressBook() case <-peerChan: gui.setPeerInfo() - case <-ticker.C: + case <-peerUpdateTicker.C: gui.setPeerInfo() + case <-generalUpdateTicker.C: + lastBlockLabel.Set("text", "#"+gui.eth.BlockChain().CurrentBlock.Number.String()) } } } |