aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-11-26 22:56:26 -0600
committerluigi1111 <luigi1111w@gmail.com>2021-11-26 22:56:26 -0600
commit917d6d4243ce4b62d03bc3d61f0e61b268602af3 (patch)
tree81d4f9b582be1a19bcf13d8bd451ddbef7756f5f /pages
parent05e629c0ebbeafdc813b7a7e131615ac19135dc3 (diff)
parente390b43bdc1c802e781cf8913c52d50905598dbd (diff)
downloadmonzero-gui-917d6d4243ce4b62d03bc3d61f0e61b268602af3.tar.gz
monzero-gui-917d6d4243ce4b62d03bc3d61f0e61b268602af3.tar.xz
monzero-gui-917d6d4243ce4b62d03bc3d61f0e61b268602af3.zip
Merge pull request #3742
e390b43 Mining: add buttons/scroll to CPU threads input; improve button labels; set start mining button as primary (rating89us)
Diffstat (limited to 'pages')
-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()