1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-28 23:56:22 +01:00

settings: fix Remote Node 'Connect' button

This commit is contained in:
xiphon 2018-11-10 23:43:50 +00:00
parent b34d5409e6
commit 1c61de082a
3 changed files with 14 additions and 1 deletions

View File

@ -42,6 +42,7 @@ Item {
property string placeholderColor: MoneroComponents.Style.defaultFontColor property string placeholderColor: MoneroComponents.Style.defaultFontColor
property real placeholderOpacity: 0.35 property real placeholderOpacity: 0.35
property alias acceptableInput: input.acceptableInput
property alias validator: input.validator property alias validator: input.validator
property alias readOnly : input.readOnly property alias readOnly : input.readOnly
property alias cursorPosition: input.cursorPosition property alias cursorPosition: input.cursorPosition

View File

@ -58,6 +58,11 @@ GridLayout {
property bool lineEditFontBold: true property bool lineEditFontBold: true
signal editingFinished() signal editingFinished()
signal textChanged()
function isValid() {
return daemonAddr.text.trim().length > 0 && daemonPort.acceptableInput
}
function getAddress() { function getAddress() {
return daemonAddr.text.trim() + ":" + daemonPort.text.trim() return daemonAddr.text.trim() + ":" + daemonPort.text.trim()
@ -79,6 +84,7 @@ GridLayout {
fontBold: lineEditFontBold fontBold: lineEditFontBold
fontSize: lineEditFontSize fontSize: lineEditFontSize
onEditingFinished: root.editingFinished() onEditingFinished: root.editingFinished()
onTextChanged: root.textChanged()
} }
LineEdit { LineEdit {
@ -99,5 +105,6 @@ GridLayout {
validator: IntValidator{bottom: 1; top: 65535;} validator: IntValidator{bottom: 1; top: 65535;}
onEditingFinished: root.editingFinished() onEditingFinished: root.editingFinished()
onTextChanged: root.textChanged()
} }
} }

View File

@ -298,6 +298,9 @@ Rectangle{
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress(); persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
console.log("setting remote node to " + persistentSettings.remoteNodeAddress) console.log("setting remote node to " + persistentSettings.remoteNodeAddress)
} }
onTextChanged: {
rectConnectRemote.enabled = remoteNodeEdit.isValid();
}
} }
GridLayout { GridLayout {
@ -331,7 +334,8 @@ Rectangle{
Rectangle { Rectangle {
id: rectConnectRemote id: rectConnectRemote
Layout.topMargin: 12 * scaleRatio Layout.topMargin: 12 * scaleRatio
color: MoneroComponents.Style.buttonBackgroundColorDisabled enabled: remoteNodeEdit.isValid()
color: enabled ? MoneroComponents.Style.buttonBackgroundColor : MoneroComponents.Style.buttonBackgroundColorDisabled
width: btnConnectRemote.width + 40 width: btnConnectRemote.width + 40
height: 26 height: 26
radius: 2 radius: 2
@ -349,6 +353,7 @@ Rectangle{
MouseArea { MouseArea {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
visible: rectConnectRemote.enabled
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
// Update daemon login // Update daemon login