From 60f64a30ad0ae5e47db81986da65c9b2fae5ec5c Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Fri, 23 Mar 2018 23:50:45 +0100 Subject: [PATCH] Implement node bootstrap on the Settings page --- pages/Settings.qml | 52 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/pages/Settings.qml b/pages/Settings.qml index c56e6e0c..a5896689 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -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); } }