Turbo mining flag

This commit is contained in:
obscuren 2014-08-21 20:13:38 +02:00
parent 48a99d23cd
commit 6d171ff511
2 changed files with 36 additions and 4 deletions

View File

@ -157,6 +157,21 @@ ApplicationWindow {
}) })
} }
} }
MenuSeparator {}
MenuItem {
id: miningSpeed
text: "Mining: Turbo"
onTriggered: {
gui.toggleTurboMining()
if(text == "Mining: Turbo") {
text = "Mining: Normal";
} else {
text = "Mining: Turbo";
}
}
}
} }
Menu { Menu {
@ -218,6 +233,15 @@ ApplicationWindow {
} }
} }
Label {
y: 6
objectName: "miningLabel"
visible: true
font.pixelSize: 10
anchors.right: lastBlockLabel.left
anchors.rightMargin: 5
}
Label { Label {
y: 6 y: 6
id: lastBlockLabel id: lastBlockLabel

View File

@ -150,10 +150,14 @@ func (gui *Gui) ToggleMining() {
if gui.eth.Mining { if gui.eth.Mining {
utils.StopMining(gui.eth) utils.StopMining(gui.eth)
txt = "Start mining" txt = "Start mining"
gui.getObjectByName("miningLabel").Set("visible", false)
} else { } else {
utils.StartMining(gui.eth) utils.StartMining(gui.eth)
gui.miner = utils.GetMiner() gui.miner = utils.GetMiner()
txt = "Stop mining" txt = "Stop mining"
gui.getObjectByName("miningLabel").Set("visible", true)
} }
gui.win.Root().Set("miningButtonText", txt) gui.win.Root().Set("miningButtonText", txt)
@ -415,6 +419,7 @@ func (gui *Gui) update() {
gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate()) gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
lastBlockLabel := gui.getObjectByName("lastBlockLabel") lastBlockLabel := gui.getObjectByName("lastBlockLabel")
miningLabel := gui.getObjectByName("miningLabel")
go func() { go func() {
for { for {
@ -476,13 +481,12 @@ func (gui *Gui) update() {
} }
case <-generalUpdateTicker.C: case <-generalUpdateTicker.C:
statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String() statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String()
lastBlockLabel.Set("text", statusText)
if gui.miner != nil { if gui.miner != nil {
pow := gui.miner.GetPow() pow := gui.miner.GetPow()
if pow.GetHashrate() != 0 { miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
statusText = "Mining @ " + strconv.FormatInt(pow.GetHashrate(), 10) + "Khash - " + statusText
}
} }
lastBlockLabel.Set("text", statusText)
} }
} }
}() }()
@ -548,6 +552,10 @@ func (gui *Gui) GetCustomIdentifier() string {
return gui.clientIdentity.GetCustomIdentifier() return gui.clientIdentity.GetCustomIdentifier()
} }
func (gui *Gui) ToggleTurboMining() {
gui.miner.ToggleTurbo()
}
// functions that allow Gui to implement interface ethlog.LogSystem // functions that allow Gui to implement interface ethlog.LogSystem
func (gui *Gui) SetLogLevel(level ethlog.LogLevel) { func (gui *Gui) SetLogLevel(level ethlog.LogLevel) {
gui.logLevel = level gui.logLevel = level