From fcbf99a30a15b445c35d70a8a781190a2739845b Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 30 May 2014 11:50:30 +0200 Subject: [PATCH] Minor GUI updates * IceCream => IceCREAM * Added coin base to block info --- ethereal/assets/debugger/debugger.qml | 2 +- ethereal/assets/qml/wallet.qml | 65 +++++++++++++-------------- ethereal/ui/gui.go | 18 ++++++++ 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 84d9a07323..ca67e857d8 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -8,7 +8,7 @@ import Ethereum 1.0 ApplicationWindow { visible: false - title: "IceCream" + title: "IceCREAM" minimumWidth: 1280 minimumHeight: 900 width: 1290 diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index cfe005507f..2ab1f31dec 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -245,10 +245,25 @@ ApplicationWindow { width: 500 } + + property var addressModel: ListModel { + id: addressModel + } + TableView { + id: addressView + width: parent.width + height: 200 + anchors.bottom: logView.top + TableViewColumn{ role: "name"; title: "name" } + TableViewColumn{ role: "address"; title: "address"; width: 300} + + model: addressModel + } + + property var logModel: ListModel { id: logModel } - TableView { id: logView width: parent.width @@ -342,13 +357,13 @@ ApplicationWindow { visible: false property var block width: root.width - height: 240 + height: 300 Component{ id: blockDetailsDelegate Rectangle { color: "#252525" width: popup.width - height: 200 + height: 150 Column { anchors.leftMargin: 10 anchors.topMargin: 5 @@ -357,6 +372,7 @@ ApplicationWindow { Text { text: '

Block details

'; color: "#F2F2F2"} Text { text: 'Block number: ' + number; color: "#F2F2F2"} Text { text: 'Hash: ' + hash; color: "#F2F2F2"} + Text { text: 'Coinbase: ' + coinbase; color: "#F2F2F2"} Text { text: 'Block found at: ' + prettyTime; color: "#F2F2F2"} } } @@ -365,7 +381,7 @@ ApplicationWindow { model: singleBlock delegate: blockDetailsDelegate anchors.top: parent.top - height: 70 + height: 100 anchors.leftMargin: 20 id: listViewThing Layout.maximumHeight: 40 @@ -390,7 +406,7 @@ ApplicationWindow { if(tx.data) { popup.showContractData(tx) }else{ - popup.height = 230 + popup.height = 440 } } } @@ -404,7 +420,7 @@ ApplicationWindow { contractLabel.text = "

Transaction ran contract " + tx.address + "

" contractData.text = tx.rawData } - popup.height = 400 + popup.height = 540 } Rectangle { @@ -456,7 +472,7 @@ ApplicationWindow { } function setDetails(block){ singleBlock.set(0,block) - popup.height = 230 + popup.height = 300 transactionModel.clear() if(block.txs != undefined){ for(var i = 0; i < block.txs.count; ++i) { @@ -620,36 +636,15 @@ ApplicationWindow { } } - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num-1) - } - - function clearAsm() { - asmModel.clear() - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } function addDebugMessage(message){ - console.log("WOOP:") debuggerLog.append({value: message}) } - function clearStack() { - stackModel.clear() + function addAddress(address) { + addressModel.append({name: address.name, address: address.address}) + } + function clearAddress() { + addressModel.clear() } function loadPlugin(name) { @@ -683,9 +678,9 @@ ApplicationWindow { } if(initial){ - blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) }else{ - blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 9a8673a1cf..d08c1b1182 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -110,6 +110,7 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) { win := gui.createWindow(component) go gui.setInitialBlockChain() + go gui.loadAddressBook() go gui.readPreviousTransactions() go gui.update() @@ -147,6 +148,19 @@ func (gui *Gui) setInitialBlockChain() { } } +type address struct { + Name, Address string +} + +var namereg = ethutil.FromHex("bb5f186604d057c1c5240ca2ae0f6430138ac010") + +func (gui *Gui) loadAddressBook() { + gui.win.Root().Call("clearAddress") + gui.eth.StateManager().CurrentState().GetStateObject(namereg).State().EachStorage(func(name string, value *ethutil.Value) { + gui.win.Root().Call("addAddress", struct{ Name, Address string }{name, ethutil.Hex(value.Bytes())}) + }) +} + func (gui *Gui) readPreviousTransactions() { it := gui.txDb.Db().NewIterator(nil, nil) for it.Next() { @@ -191,10 +205,12 @@ func (gui *Gui) update() { blockChan := make(chan ethutil.React, 1) txChan := make(chan ethutil.React, 1) + objectChan := make(chan ethutil.React, 1) reactor.Subscribe("newBlock", blockChan) reactor.Subscribe("newTx:pre", txChan) reactor.Subscribe("newTx:post", txChan) + reactor.Subscribe("object:"+string(namereg), objectChan) state := gui.eth.StateManager().TransState() @@ -241,6 +257,8 @@ func (gui *Gui) update() { state.UpdateStateObject(object) } + case <-objectChan: + gui.loadAddressBook() } } }