aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-07-21 20:30:37 +0800
committerzelig <viktor.tron@gmail.com>2014-07-21 20:30:37 +0800
commit4d5a890b46a75fb644277bbf2a8c034cf2a13424 (patch)
tree7d37fddbcdbd218fe6e0e216aa3554380229d133 /ethereal
parent75a7a4c97c350e911f4d721e940a59c0740ae967 (diff)
parentf702e27485981562ed7b88ecd3f8485af4c61b62 (diff)
downloadgo-tangerine-4d5a890b46a75fb644277bbf2a8c034cf2a13424.tar.gz
go-tangerine-4d5a890b46a75fb644277bbf2a8c034cf2a13424.tar.zst
go-tangerine-4d5a890b46a75fb644277bbf2a8c034cf2a13424.zip
merge upstream
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/assets/debugger/debugger.qml2
-rw-r--r--ethereal/assets/qml/wallet.qml70
m---------ethereal/assets/samplecoin0
-rw-r--r--ethereal/debugger.go3
-rw-r--r--ethereal/flags.go2
-rw-r--r--ethereal/gui.go64
-rw-r--r--ethereal/main.go2
7 files changed, 109 insertions, 34 deletions
diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml
index fa56737a2..34fe01253 100644
--- a/ethereal/assets/debugger/debugger.qml
+++ b/ethereal/assets/debugger/debugger.qml
@@ -86,7 +86,7 @@ ApplicationWindow {
TableView {
id: asmTableView
width: 200
- TableViewColumn{ role: "value" ; title: "" ; width: 200 }
+ TableViewColumn{ role: "value" ; title: "" ; width: asmTableView.width - 2 }
model: asmModel
}
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml
index c783cde83..a79e4708c 100644
--- a/ethereal/assets/qml/wallet.qml
+++ b/ethereal/assets/qml/wallet.qml
@@ -419,30 +419,54 @@ ApplicationWindow {
}
}
- 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"
- }
+ 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
+ objectName: "syncProgressIndicator"
+ y: 3
+ width: 140
+ indeterminate: true
+ anchors.right: peerGroup.left
+ anchors.rightMargin: 5
+ }
+
+ 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 {
id: popup
visible: false
+ //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
property var block
width: root.width
height: 300
@@ -460,7 +484,7 @@ ApplicationWindow {
Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"}
Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"}
Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"}
- Text { text: '<b>Coinbase:</b> ' + coinbase; color: "#F2F2F2"}
+ Text { text: '<b>Coinbase:</b> &lt;' + name + '&gt; ' + coinbase; color: "#F2F2F2"}
Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"}
Text { text: '<b>Gas used:</b> ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"}
}
@@ -577,6 +601,7 @@ ApplicationWindow {
Window {
id: addPeerWin
+ //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
visible: false
minimumWidth: 230
maximumWidth: 230
@@ -686,9 +711,9 @@ ApplicationWindow {
}
if(initial){
- blockModel.append({number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
+ blockModel.append({number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
}else{
- blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
+ blockModel.insert(0, {number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
}
}
@@ -743,6 +768,7 @@ ApplicationWindow {
// ******************************************
Window {
id: peerWindow
+ //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
height: 200
width: 700
Rectangle {
diff --git a/ethereal/assets/samplecoin b/ethereal/assets/samplecoin
deleted file mode 160000
-Subproject 944fbaa31d51328b522c0cd55113716630b4cbc
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/flags.go b/ethereal/flags.go
index d5ca9f336..c9327c3d3 100644
--- a/ethereal/flags.go
+++ b/ethereal/flags.go
@@ -36,6 +36,7 @@ var LogLevel int
// flags specific to gui client
var AssetPath string
+//TODO: If we re-use the one defined in cmd.go the binary osx image crashes. If somebody finds out why we can dry this up.
func defaultAssetPath() string {
var assetPath string
// If the current working directory is the go-ethereum dir
@@ -60,7 +61,6 @@ func defaultAssetPath() string {
}
return assetPath
}
-
func defaultDataDir() string {
usr, _ := user.Current()
return path.Join(usr.HomeDir, ".ethereal")
diff --git a/ethereal/gui.go b/ethereal/gui.go
index eb0c50cc3..815bb267c 100644
--- a/ethereal/gui.go
+++ b/ethereal/gui.go
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/eth-go/ethminer"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
@@ -14,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
"math/big"
+ "strconv"
"strings"
"time"
)
@@ -41,6 +43,8 @@ type Gui struct {
Session string
clientIdentity *ethwire.SimpleClientIdentity
config *ethutil.ConfigManager
+
+ miner *ethminer.Miner
}
// Create GUI, but doesn't start it
@@ -125,6 +129,7 @@ func (gui *Gui) ToggleMining() {
txt = "Start mining"
} else {
utils.StartMining(gui.eth)
+ gui.miner = utils.GetMiner()
txt = "Stop mining"
}
@@ -244,7 +249,11 @@ func (gui *Gui) readPreviousTransactions() {
}
func (gui *Gui) processBlock(block *ethchain.Block, initial bool) {
- gui.win.Root().Call("addBlock", ethpub.NewPBlock(block), initial)
+ name := ethpub.FindNameInNameReg(gui.eth.StateManager(), block.Coinbase)
+ b := ethpub.NewPBlock(block)
+ b.Name = name
+
+ gui.win.Root().Call("addBlock", b, initial)
}
func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
@@ -263,20 +272,32 @@ 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()
- blockChan := make(chan ethreact.Event, 1)
- txChan := make(chan ethreact.Event, 1)
- objectChan := make(chan ethreact.Event, 1)
- peerChan := make(chan ethreact.Event, 1)
- ticker := time.NewTicker(5 * time.Second)
+ var (
+ blockChan = make(chan ethreact.Event, 1)
+ txChan = make(chan ethreact.Event, 1)
+ objectChan = make(chan ethreact.Event, 1)
+ peerChan = make(chan ethreact.Event, 1)
+ chainSyncChan = make(chan ethreact.Event, 1)
+ miningChan = make(chan ethreact.Event, 1)
+ )
+
+ 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.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
+
+ lastBlockLabel := gui.getObjectByName("lastBlockLabel")
go func() {
for {
@@ -319,18 +340,43 @@ 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()
case <-peerChan:
gui.setPeerInfo()
- case <-ticker.C:
+ case <-peerUpdateTicker.C:
gui.setPeerInfo()
+ case msg := <-miningChan:
+ if msg.Name == "miner:start" {
+ gui.miner = msg.Resource.(*ethminer.Miner)
+ } else {
+ gui.miner = nil
+ }
+ case <-generalUpdateTicker.C:
+ statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String()
+ if gui.miner != nil {
+ pow := gui.miner.GetPow()
+ if pow.GetHashrate() != 0 {
+ statusText = "Mining @ " + strconv.FormatInt(pow.GetHashrate(), 10) + "Khash - " + statusText
+ }
+ }
+ lastBlockLabel.Set("text", statusText)
}
}
}()
+
+ reactor := gui.eth.Reactor()
+
reactor.Subscribe("newBlock", blockChan)
reactor.Subscribe("newTx:pre", txChan)
reactor.Subscribe("newTx:post", txChan)
+ reactor.Subscribe("chainSync", chainSyncChan)
+ reactor.Subscribe("miner:start", miningChan)
+ reactor.Subscribe("miner:stop", miningChan)
nameReg := ethpub.EthereumConfig(gui.eth.StateManager()).NameReg()
if nameReg != nil {
@@ -357,7 +403,7 @@ func (gui *Gui) address() []byte {
}
func (gui *Gui) RegisterName(name string) {
- name = fmt.Sprintf("\"%s\"", name)
+ name = fmt.Sprintf("\"register\"\n\"%s\"", name)
gui.pub.Transact(gui.privateKey(), "NameReg", "", "10000", "10000000000000", name)
}
diff --git a/ethereal/main.go b/ethereal/main.go
index 645e8f2ce..e1cd43ace 100644
--- a/ethereal/main.go
+++ b/ethereal/main.go
@@ -10,7 +10,7 @@ import (
const (
ClientIdentifier = "Ethereal"
- Version = "0.5.16"
+ Version = "0.5.17"
)
func main() {