Implement node bootstrap on the Settings page

This commit is contained in:
Sander Ferdinand 2018-03-23 23:50:45 +01:00 committed by moneromooo-monero
parent 28608e4ce0
commit 60f64a30ad
1 changed files with 46 additions and 6 deletions

View File

@ -229,6 +229,42 @@ Rectangle {
}
}
RowLayout {
visible: !isMobile && !persistentSettings.useRemoteNode
Layout.fillWidth: true
LabelSubheader {
text: qsTr("Bootstrap node") + translationManager.emptyString
}
}
RowLayout {
visible: !isMobile && !persistentSettings.useRemoteNode
ColumnLayout {
Layout.fillWidth: true
RemoteNodeEdit {
id: bootstrapNodeEdit
Layout.minimumWidth: 100 * scaleRatio
Layout.bottomMargin: 20 * scaleRatio
lineEditBackgroundColor: "transparent"
lineEditFontColor: "white"
lineEditBorderColor: Qt.rgba(255, 255, 255, 0.35)
daemonAddrLabelText: qsTr("Address")
daemonPortLabelText: qsTr("Port")
daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim()
daemonPortText: (persistentSettings.bootstrapNodeAddress.split(":")[1].trim() == "") ? "18081" : persistentSettings.bootstrapNodeAddress.split(":")[1]
onEditingFinished: {
persistentSettings.bootstrapNodeAddress = daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
console.log("setting bootstrap node to " + persistentSettings.bootstrapNodeAddress)
}
}
}
}
RowLayout {
visible: persistentSettings.useRemoteNode
ColumnLayout {
@ -237,13 +273,17 @@ Rectangle {
RemoteNodeEdit {
id: remoteNodeEdit
Layout.minimumWidth: 100 * scaleRatio
daemonAddrLabelText: qsTr("Address")
daemonPortLabelText: qsTr("Port")
lineEditBackgroundColor: "transparent"
lineEditFontColor: "white"
lineEditBorderColor: Qt.rgba(255, 255, 255, 0.35)
daemonAddrText: persistentSettings.remoteNodeAddress.split(":")[0].trim()
daemonPortText: (persistentSettings.remoteNodeAddress.split(":")[1].trim() == "") ? "18081" : persistentSettings.remoteNodeAddress.split(":")[1]
daemonAddrLabelText: qsTr("Address")
daemonPortLabelText: qsTr("Port")
property var rna: persistentSettings.remoteNodeAddress
daemonAddrText: rna.search(":") != -1 ? rna.split(":")[0].trim() : ""
daemonPortText: rna.search(":") != -1 ? (rna.split(":")[1].trim() == "") ? "18081" : rna.split(":")[1] : ""
onEditingFinished: {
persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
console.log("setting remote node to " + persistentSettings.remoteNodeAddress)
@ -310,8 +350,8 @@ Rectangle {
persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
// Set current daemon address to local
appWindow.currentDaemonAddress = appWindow.localDaemonAddress
appWindow.startDaemon(daemonFlags.text)
appWindow.currentDaemonAddress = appWindow.localDaemonAddress;
appWindow.startDaemon(daemonFlags.text);
}
}