Skip to content

Commit 6d171ff

Browse files
committed
Turbo mining flag
1 parent 48a99d2 commit 6d171ff

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

ethereal/assets/qml/wallet.qml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,21 @@ ApplicationWindow {
157157
})
158158
}
159159
}
160+
161+
MenuSeparator {}
162+
163+
MenuItem {
164+
id: miningSpeed
165+
text: "Mining: Turbo"
166+
onTriggered: {
167+
gui.toggleTurboMining()
168+
if(text == "Mining: Turbo") {
169+
text = "Mining: Normal";
170+
} else {
171+
text = "Mining: Turbo";
172+
}
173+
}
174+
}
160175
}
161176

162177
Menu {
@@ -218,6 +233,15 @@ ApplicationWindow {
218233
}
219234
}
220235

236+
Label {
237+
y: 6
238+
objectName: "miningLabel"
239+
visible: true
240+
font.pixelSize: 10
241+
anchors.right: lastBlockLabel.left
242+
anchors.rightMargin: 5
243+
}
244+
221245
Label {
222246
y: 6
223247
id: lastBlockLabel

ethereal/gui.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,14 @@ func (gui *Gui) ToggleMining() {
150150
if gui.eth.Mining {
151151
utils.StopMining(gui.eth)
152152
txt = "Start mining"
153+
154+
gui.getObjectByName("miningLabel").Set("visible", false)
153155
} else {
154156
utils.StartMining(gui.eth)
155157
gui.miner = utils.GetMiner()
156158
txt = "Stop mining"
159+
160+
gui.getObjectByName("miningLabel").Set("visible", true)
157161
}
158162

159163
gui.win.Root().Set("miningButtonText", txt)
@@ -415,6 +419,7 @@ func (gui *Gui) update() {
415419
gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
416420

417421
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
422+
miningLabel := gui.getObjectByName("miningLabel")
418423

419424
go func() {
420425
for {
@@ -476,13 +481,12 @@ func (gui *Gui) update() {
476481
}
477482
case <-generalUpdateTicker.C:
478483
statusText := "#" + gui.eth.BlockChain().CurrentBlock.Number.String()
484+
lastBlockLabel.Set("text", statusText)
485+
479486
if gui.miner != nil {
480487
pow := gui.miner.GetPow()
481-
if pow.GetHashrate() != 0 {
482-
statusText = "Mining @ " + strconv.FormatInt(pow.GetHashrate(), 10) + "Khash - " + statusText
483-
}
488+
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
484489
}
485-
lastBlockLabel.Set("text", statusText)
486490
}
487491
}
488492
}()
@@ -548,6 +552,10 @@ func (gui *Gui) GetCustomIdentifier() string {
548552
return gui.clientIdentity.GetCustomIdentifier()
549553
}
550554

555+
func (gui *Gui) ToggleTurboMining() {
556+
gui.miner.ToggleTurbo()
557+
}
558+
551559
// functions that allow Gui to implement interface ethlog.LogSystem
552560
func (gui *Gui) SetLogLevel(level ethlog.LogLevel) {
553561
gui.logLevel = level

0 commit comments

Comments
 (0)