Skip to content

Commit

Permalink
Mining: disable/enable pool widgets based on pool list content
Browse files Browse the repository at this point in the history
  • Loading branch information
moneromooo.monero committed Dec 30, 2016
1 parent ff76a3f commit 4bff091
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pages/Mining.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,22 @@ Rectangle {
lines = req.responseText.split("\n")

miningPoolModel.clear()
miningPoolModel.append({"column1": "Automatic (recommended)", "column2": "", "uri": ""})
miningPoolDropdown.enabled = false
startPoolMinerButton.enabled = false
for (var n = 0; n < lines.length; n++) {
var line = lines[n].trim()
if (line !== "") {
var offset = line.search(":")
var name = line.substr(0, offset).trim()
var uri = line.substr(offset+1).trim()

// only add "automatic" if not otherwise empty
if (miningPoolModel.rowCount() == 0)
miningPoolModel.append({"column1": "Automatic (recommended)", "column2": "", "uri": ""})
miningPoolModel.append({"column1": name, "column2": "", "uri": uri})
miningPoolDropdown.currentIndex = 0
miningPoolDropdown.enabled = true
startPoolMinerButton.enabled = true
}
}
}
Expand Down Expand Up @@ -221,7 +229,6 @@ Rectangle {
Layout.fillWidth: true
ListModel {
id: miningPoolModel
ListElement { column1: qsTr("Automatic (recommended)") ; column2: ""; uri: "" } // must be first
}

Label {
Expand Down Expand Up @@ -256,6 +263,7 @@ Rectangle {
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
dataModel: miningPoolModel
enabled: false
}

FileDialog {
Expand Down Expand Up @@ -297,7 +305,7 @@ Rectangle {

StandardButton {
visible: true
enabled: !appWindow.poolMinerRunning
enabled: miningPoolModel.rowCount() > 1 && !appWindow.poolMinerRunning
id: startPoolMinerButton
width: 110
text: qsTr("Start poolMiner") + translationManager.emptyString
Expand Down

0 comments on commit 4bff091

Please sign in to comment.