mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
RemoteNodeEdit: initialAddress, add square brackets on ipv6 input
This commit is contained in:
parent
e1e862bce4
commit
fead82b198
3 changed files with 16 additions and 25 deletions
|
@ -43,6 +43,9 @@ GridLayout {
|
||||||
property alias daemonAddrLabelText: daemonAddr.labelText
|
property alias daemonAddrLabelText: daemonAddr.labelText
|
||||||
property alias daemonPortLabelText: daemonPort.labelText
|
property alias daemonPortLabelText: daemonPort.labelText
|
||||||
|
|
||||||
|
property string initialAddress: ""
|
||||||
|
property var initialHostPort: initialAddress.match(/^(.*?)(?:\:?(\d*))$/)
|
||||||
|
|
||||||
// TODO: LEGACY; remove these placeHolder variables when
|
// TODO: LEGACY; remove these placeHolder variables when
|
||||||
// the wizards get redesigned to the black-theme
|
// the wizards get redesigned to the black-theme
|
||||||
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
|
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
|
||||||
|
@ -58,6 +61,9 @@ GridLayout {
|
||||||
property bool lineEditFontBold: false
|
property bool lineEditFontBold: false
|
||||||
property int lineEditFontSize: 15
|
property int lineEditFontSize: 15
|
||||||
|
|
||||||
|
// Author: David M. Syzdek https://github.com/syzdek https://gist.github.com/syzdek/6086792
|
||||||
|
readonly property var ipv6Regex: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/
|
||||||
|
|
||||||
signal editingFinished()
|
signal editingFinished()
|
||||||
signal textChanged()
|
signal textChanged()
|
||||||
|
|
||||||
|
@ -91,8 +97,12 @@ GridLayout {
|
||||||
fontColor: lineEditFontColor
|
fontColor: lineEditFontColor
|
||||||
fontBold: lineEditFontBold
|
fontBold: lineEditFontBold
|
||||||
fontSize: lineEditFontSize
|
fontSize: lineEditFontSize
|
||||||
onEditingFinished: root.editingFinished()
|
onEditingFinished: {
|
||||||
|
text = text.replace(ipv6Regex, "[$1]");
|
||||||
|
root.editingFinished();
|
||||||
|
}
|
||||||
onTextChanged: root.textChanged()
|
onTextChanged: root.textChanged()
|
||||||
|
text: initialHostPort[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
LineEdit {
|
LineEdit {
|
||||||
|
@ -114,5 +124,6 @@ GridLayout {
|
||||||
|
|
||||||
onEditingFinished: root.editingFinished()
|
onEditingFinished: root.editingFinished()
|
||||||
onTextChanged: root.textChanged()
|
onTextChanged: root.textChanged()
|
||||||
|
text: initialHostPort[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,9 +268,7 @@ Rectangle{
|
||||||
daemonAddrLabelText: qsTr("Address") + translationManager.emptyString
|
daemonAddrLabelText: qsTr("Address") + translationManager.emptyString
|
||||||
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
|
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
|
||||||
|
|
||||||
property var rna: persistentSettings.remoteNodeAddress
|
initialAddress: persistentSettings.remoteNodeAddress
|
||||||
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
|
||||||
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : rna.split(":")[1] : ""
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
|
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
|
||||||
console.log("setting remote node to " + persistentSettings.remoteNodeAddress);
|
console.log("setting remote node to " + persistentSettings.remoteNodeAddress);
|
||||||
|
@ -419,15 +417,7 @@ Rectangle{
|
||||||
|
|
||||||
daemonAddrLabelText: qsTr("Bootstrap Address") + translationManager.emptyString
|
daemonAddrLabelText: qsTr("Bootstrap Address") + translationManager.emptyString
|
||||||
daemonPortLabelText: qsTr("Bootstrap Port") + translationManager.emptyString
|
daemonPortLabelText: qsTr("Bootstrap Port") + translationManager.emptyString
|
||||||
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
|
initialAddress: persistentSettings.bootstrapNodeAddress
|
||||||
daemonPortText: {
|
|
||||||
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
|
||||||
if(node_split.length == 2){
|
|
||||||
(node_split[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : node_split[1];
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
if (daemonAddrText == "auto") {
|
if (daemonAddrText == "auto") {
|
||||||
persistentSettings.bootstrapNodeAddress = daemonAddrText;
|
persistentSettings.bootstrapNodeAddress = daemonAddrText;
|
||||||
|
|
|
@ -147,15 +147,7 @@ ColumnLayout {
|
||||||
Layout.minimumWidth: 300
|
Layout.minimumWidth: 300
|
||||||
//labelText: qsTr("Bootstrap node (leave blank if not wanted)") + translationManager.emptyString
|
//labelText: qsTr("Bootstrap node (leave blank if not wanted)") + translationManager.emptyString
|
||||||
|
|
||||||
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
|
initialAddress: persistentSettings.bootstrapNodeAddress
|
||||||
daemonPortText: {
|
|
||||||
var node_split = persistentSettings.bootstrapNodeAddress.split(":");
|
|
||||||
if(node_split.length == 2){
|
|
||||||
(node_split[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : node_split[1];
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,9 +176,7 @@ ColumnLayout {
|
||||||
id: remoteNodeEdit
|
id: remoteNodeEdit
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
property var rna: persistentSettings.remoteNodeAddress
|
initialAddress: persistentSettings.remoteNodeAddress
|
||||||
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
|
|
||||||
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? appWindow.getDefaultDaemonRpcPort(persistentSettings.nettype) : persistentSettings.remoteNodeAddress.split(":")[1] : ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue