aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrating89us <45968869+rating89us@users.noreply.github.com>2021-11-21 13:08:17 +0100
committerrating89us <45968869+rating89us@users.noreply.github.com>2021-11-22 19:46:16 +0100
commite390b43bdc1c802e781cf8913c52d50905598dbd (patch)
treeba1f288f4c5faec2074645375814eb0579162f7e
parentecf5c501d61bf5f85fb69fd9136cd0235f97f7b8 (diff)
downloadmonzero-gui-e390b43bdc1c802e781cf8913c52d50905598dbd.tar.gz
monzero-gui-e390b43bdc1c802e781cf8913c52d50905598dbd.tar.xz
monzero-gui-e390b43bdc1c802e781cf8913c52d50905598dbd.zip
Mining: add buttons/scroll to CPU threads input; improve button labels; set start mining button as primary
-rw-r--r--pages/Mining.qml105
1 files changed, 77 insertions, 28 deletions
diff --git a/pages/Mining.qml b/pages/Mining.qml
index 86150088..ad699c21 100644
--- a/pages/Mining.qml
+++ b/pages/Mining.qml
@@ -37,6 +37,7 @@ Rectangle {
color: "transparent"
property alias miningHeight: mainLayout.height
property double currentHashRate: 0
+ property int threads: idealThreadCount / 2
ColumnLayout {
id: mainLayout
@@ -106,30 +107,56 @@ Rectangle {
Layout.fillWidth: true
spacing: 16
- MoneroComponents.LineEdit {
- id: soloMinerThreadsLine
- Layout.minimumWidth: 200
- text: "1"
- validator: IntValidator { bottom: 1; top: idealThreadCount }
- }
+ RowLayout {
+ MoneroComponents.StandardButton {
+ id: removeThreadButton
+ small: true
+ primary: false
+ text: "−"
+ enabled: threads > 1
+ onClicked: threads--
+ }
- MoneroComponents.TextPlain {
- id: numAvailableThreadsText
- text: qsTr("Max # of CPU threads available for mining: ") + idealThreadCount + translationManager.emptyString
- wrapMode: Text.WordWrap
- font.family: MoneroComponents.Style.fontRegular.name
- font.pixelSize: 14
- color: MoneroComponents.Style.defaultFontColor
+ MoneroComponents.TextPlain {
+ Layout.bottomMargin: 1
+ Layout.minimumWidth: 45
+ color: MoneroComponents.Style.defaultFontColor
+ text: threads
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: 16
+
+ MouseArea {
+ anchors.fill: parent
+ scrollGestureEnabled: false
+ onWheel: {
+ if (wheel.angleDelta.y > 0 && threads < idealThreadCount) {
+ return threads++
+ } else if (wheel.angleDelta.y < 0 && threads > 1) {
+ return threads--
+ }
+ }
+ }
+ }
+
+ MoneroComponents.StandardButton {
+ id: addThreadButton
+ small: true
+ primary: false
+ text: "+"
+ enabled: threads < idealThreadCount
+ onClicked: threads++
+ }
}
RowLayout {
MoneroComponents.StandardButton {
id: autoRecommendedThreadsButton
small: true
- text: qsTr("Use recommended # of threads") + translationManager.emptyString
+ primary: false
+ text: qsTr("Use half (recommended)") + translationManager.emptyString
enabled: startSoloMinerButton.enabled
onClicked: {
- soloMinerThreadsLine.text = Math.floor(idealThreadCount / 2);
+ threads = idealThreadCount / 2
appWindow.showStatusMessage(qsTr("Set to use recommended # of threads"),3)
}
}
@@ -137,26 +164,17 @@ Rectangle {
MoneroComponents.StandardButton {
id: autoSetMaxThreadsButton
small: true
- text: qsTr("Use all threads") + translationManager.emptyString
+ primary: false
+ text: qsTr("Use all threads") + " (" + idealThreadCount + ")" + translationManager.emptyString
enabled: startSoloMinerButton.enabled
onClicked: {
- soloMinerThreadsLine.text = idealThreadCount
+ threads = idealThreadCount
appWindow.showStatusMessage(qsTr("Set to use all threads") + translationManager.emptyString,3)
}
}
}
RowLayout {
- MoneroComponents.CheckBox {
- id: backgroundMining
- enabled: startSoloMinerButton.enabled
- checked: persistentSettings.allow_background_mining
- onClicked: {persistentSettings.allow_background_mining = checked}
- text: qsTr("Background mining (experimental)") + translationManager.emptyString
- }
- }
-
- RowLayout {
// Disable this option until stable
visible: false
MoneroComponents.CheckBox {
@@ -170,6 +188,35 @@ Rectangle {
}
ColumnLayout {
+ Layout.alignment: Qt.AlignTop | Qt.AlignLeft
+ Layout.minimumWidth: 140
+
+ MoneroComponents.Label {
+ id: optionsLabel
+ color: MoneroComponents.Style.defaultFontColor
+ text: qsTr("Options") + translationManager.emptyString
+ fontSize: 16
+ wrapMode: Text.Wrap
+ Layout.preferredWidth: manageSoloMinerLabel.textWidth
+ }
+ }
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 16
+
+ RowLayout {
+ MoneroComponents.CheckBox {
+ id: backgroundMining
+ enabled: startSoloMinerButton.enabled
+ checked: persistentSettings.allow_background_mining
+ onClicked: persistentSettings.allow_background_mining = checked
+ text: qsTr("Background mining (experimental)") + translationManager.emptyString
+ }
+ }
+ }
+
+ ColumnLayout {
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
MoneroComponents.Label {
@@ -191,9 +238,10 @@ Rectangle {
visible: true
id: startSoloMinerButton
small: true
+ primary: !stopSoloMinerButton.enabled
text: qsTr("Start mining") + translationManager.emptyString
onClicked: {
- var success = walletManager.startMining(appWindow.currentWallet.address(0, 0), soloMinerThreadsLine.text, persistentSettings.allow_background_mining, persistentSettings.miningIgnoreBattery)
+ var success = walletManager.startMining(appWindow.currentWallet.address(0, 0), threads, persistentSettings.allow_background_mining, persistentSettings.miningIgnoreBattery)
if (success) {
update()
} else {
@@ -211,6 +259,7 @@ Rectangle {
visible: true
id: stopSoloMinerButton
small: true
+ primary: stopSoloMinerButton.enabled
text: qsTr("Stop mining") + translationManager.emptyString
onClicked: {
walletManager.stopMining()