1
mirror of https://github.com/monero-project/monero-gui synced 2025-01-05 19:56:26 +01:00

Merge pull request #1733

b34d540 components: RemoteNodeEdit validate port number range (xiphon)
1c61de0 settings: fix Remote Node 'Connect' button (xiphon)
This commit is contained in:
luigi1111 2018-11-16 12:01:52 -06:00
commit 4a744cf949
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
3 changed files with 15 additions and 1 deletions

View File

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

View File

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

View File

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