Merge pull request #2014

d6f8834 mining: fix layout issues (mmbyday)
pull/2/head
luigi1111 5 years ago
commit 38788aab43
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018, The Monero Project // Copyright (c) 2014-2019, The Monero Project
// //
// All rights reserved. // All rights reserved.
// //
@ -59,10 +59,8 @@ Rectangle {
visible: !walletManager.isDaemonLocal(appWindow.currentDaemonAddress) visible: !walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
} }
MoneroComponents.Label { MoneroComponents.WarningBox {
id: soloSyncedLabel Layout.bottomMargin: 8 * scaleRatio
fontSize: 18 * scaleRatio
color: "#D02020"
text: qsTr("Your daemon must be synchronized before you can start mining") + translationManager.emptyString text: qsTr("Your daemon must be synchronized before you can start mining") + translationManager.emptyString
visible: walletManager.isDaemonLocal(appWindow.currentDaemonAddress) && !appWindow.daemonSynced visible: walletManager.isDaemonLocal(appWindow.currentDaemonAddress) && !appWindow.daemonSynced
} }
@ -84,38 +82,46 @@ Rectangle {
text: qsTr("Mining may reduce the performance of other running applications and processes.") + translationManager.emptyString text: qsTr("Mining may reduce the performance of other running applications and processes.") + translationManager.emptyString
} }
RowLayout { GridLayout {
id: soloMinerThreadsRow columns: 2
Layout.fillWidth: true
columnSpacing: 20 * scaleRatio
rowSpacing: 16 * scaleRatio
ColumnLayout {
Layout.fillWidth: true
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
MoneroComponents.Label { MoneroComponents.Label {
id: soloMinerThreadsLabel id: soloMinerThreadsLabel
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
text: qsTr("CPU threads") + translationManager.emptyString text: qsTr("CPU threads") + translationManager.emptyString
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
Layout.preferredWidth: 120 * scaleRatio wrapMode: Text.WordWrap
}
} }
ColumnLayout {
Layout.fillWidth: true
spacing: 16 * scaleRatio
MoneroComponents.LineEdit { MoneroComponents.LineEdit {
id: soloMinerThreadsLine id: soloMinerThreadsLine
Layout.preferredWidth: 200 * scaleRatio Layout.minimumWidth: 200 * scaleRatio
text: "1" text: "1"
validator: IntValidator { bottom: 1; top: idealThreadCount } validator: IntValidator { bottom: 1; top: idealThreadCount }
} }
}
Text { Text {
id: numAvailableThreadsText id: numAvailableThreadsText
text: qsTr("Max # of CPU threads available for mining: ") + idealThreadCount + translationManager.emptyString text: qsTr("Max # of CPU threads available for mining: ") + idealThreadCount + translationManager.emptyString
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
Layout.leftMargin: 125 * scaleRatio
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: 14 * scaleRatio font.pixelSize: 14 * scaleRatio
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
} }
RowLayout { RowLayout {
Layout.leftMargin: 125 * scaleRatio
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: autoRecommendedThreadsButton id: autoRecommendedThreadsButton
small: true small: true
@ -140,7 +146,6 @@ Rectangle {
} }
RowLayout { RowLayout {
Layout.leftMargin: 125 * scaleRatio
MoneroComponents.CheckBox { MoneroComponents.CheckBox {
id: backgroundMining id: backgroundMining
enabled: startSoloMinerButton.enabled enabled: startSoloMinerButton.enabled
@ -153,7 +158,6 @@ Rectangle {
RowLayout { RowLayout {
// Disable this option until stable // Disable this option until stable
visible: false visible: false
Layout.leftMargin: 125 * scaleRatio
MoneroComponents.CheckBox { MoneroComponents.CheckBox {
id: ignoreBattery id: ignoreBattery
enabled: startSoloMinerButton.enabled enabled: startSoloMinerButton.enabled
@ -162,20 +166,29 @@ Rectangle {
text: qsTr("Enable mining when running on battery") + translationManager.emptyString text: qsTr("Enable mining when running on battery") + translationManager.emptyString
} }
} }
}
ColumnLayout {
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
RowLayout {
MoneroComponents.Label { MoneroComponents.Label {
id: manageSoloMinerLabel id: manageSoloMinerLabel
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
text: qsTr("Manage miner") + translationManager.emptyString text: qsTr("Manage miner") + translationManager.emptyString
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
Layout.preferredWidth: 120 * scaleRatio wrapMode: Text.Wrap
Layout.preferredWidth: manageSoloMinerLabel.textWidth
}
} }
ColumnLayout {
Layout.fillWidth: true
spacing: 16 * scaleRatio
RowLayout {
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
visible: true visible: true
id: startSoloMinerButton id: startSoloMinerButton
width: 110 * scaleRatio
small: true small: true
text: qsTr("Start mining") + translationManager.emptyString text: qsTr("Start mining") + translationManager.emptyString
onClicked: { onClicked: {
@ -196,7 +209,6 @@ Rectangle {
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
visible: true visible: true
id: stopSoloMinerButton id: stopSoloMinerButton
width: 110 * scaleRatio
small: true small: true
text: qsTr("Stop mining") + translationManager.emptyString text: qsTr("Stop mining") + translationManager.emptyString
onClicked: { onClicked: {
@ -205,24 +217,33 @@ Rectangle {
} }
} }
} }
}
RowLayout { ColumnLayout {
id: statusRow Layout.fillWidth: true
Layout.alignment : Qt.AlignTop | Qt.AlignLeft
MoneroComponents.Label { MoneroComponents.Label {
id: statusLabel id: statusLabel
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
text: qsTr("Status") + translationManager.emptyString text: qsTr("Status") + translationManager.emptyString
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
Layout.preferredWidth: 120 * scaleRatio }
} }
MoneroComponents.LineEdit { ColumnLayout {
Layout.fillWidth: true
spacing: 16 * scaleRatio
MoneroComponents.LineEditMulti {
id: statusText id: statusText
Layout.preferredWidth: 200 * scaleRatio Layout.minimumWidth: 300 * scaleRatio
text: qsTr("Not mining") + translationManager.emptyString text: qsTr("Not mining") + translationManager.emptyString
borderDisabled: true borderDisabled: true
readOnly: true readOnly: true
wrapMode: Text.Wrap
inputPaddingLeft: 0
}
} }
} }
} }
@ -237,10 +258,11 @@ Rectangle {
} }
function update() { function update() {
var daemonReady = walletManager.isDaemonLocal(appWindow.currentDaemonAddress) && appWindow.daemonSynced
appWindow.isMining = walletManager.isMining() appWindow.isMining = walletManager.isMining()
updateStatusText() updateStatusText()
startSoloMinerButton.enabled = !appWindow.isMining startSoloMinerButton.enabled = !appWindow.isMining && daemonReady
stopSoloMinerButton.enabled = !startSoloMinerButton.enabled stopSoloMinerButton.enabled = !startSoloMinerButton.enabled && daemonReady
} }
MoneroComponents.StandardDialog { MoneroComponents.StandardDialog {