From 89ec822ba5d9f9b476237e2b48f4304101263850 Mon Sep 17 00:00:00 2001 From: stoffu Date: Wed, 24 Jan 2018 14:43:24 +0900 Subject: [PATCH 1/3] removed persistentSettings.startLocalNode as it's synonym for !persistentSettings.useRemoteNode --- main.qml | 3 +-- pages/Settings.qml | 2 +- wizard/WizardDaemonSettings.qml | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/main.qml b/main.qml index b5280738..9ce7d58e 100644 --- a/main.qml +++ b/main.qml @@ -436,7 +436,7 @@ ApplicationWindow { if(localNodeConnected) { leftPanel.progressBar.updateProgress(walletManager.blockchainHeight(),walletManager.blockchainTargetHeight(), 0, qsTr("Remaining blocks (local node):")); leftPanel.progressBar.visible = true - } else if (persistentSettings.startLocalNode && !startLocalNodeCancelled) { + } else if (!persistentSettings.useRemoteNode && !startLocalNodeCancelled) { daemonManagerDialog.open() } @@ -1004,7 +1004,6 @@ ApplicationWindow { property string daemonPassword: "" property bool transferShowAdvanced: false property string blockchainDataDir: "" - property bool startLocalNode: true property bool useRemoteNode: false property string remoteNodeAddress: "" } diff --git a/pages/Settings.qml b/pages/Settings.qml index 8641f4eb..1e753651 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -296,7 +296,7 @@ Rectangle { ColumnLayout { id: blockchainFolderRow - visible: !isMobile + visible: !isMobile && !persistentSettings.useRemoteNode Label { id: blockchainFolderLabel color: "#4A4949" diff --git a/wizard/WizardDaemonSettings.qml b/wizard/WizardDaemonSettings.qml index f57fb4cb..dd41172c 100644 --- a/wizard/WizardDaemonSettings.qml +++ b/wizard/WizardDaemonSettings.qml @@ -54,7 +54,6 @@ ColumnLayout { function onPageClosed(settingsObject) { appWindow.persistentSettings.useRemoteNode = remoteNode.checked - appWindow.persistentSettings.startLocalNode = localNode.checked appWindow.persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress(); return true } @@ -129,7 +128,7 @@ ColumnLayout { fontSize: 16 * scaleRatio checkedIcon: "../images/checkedVioletIcon.png" uncheckedIcon: "../images/uncheckedIcon.png" - checked: appWindow.persistentSettings.startLocalNode && !isAndroid && !isIOS + checked: !appWindow.persistentSettings.useRemoteNode && !isAndroid && !isIOS visible: !isAndroid && !isIOS } } From af882e87f5cfbd0454b31cf2846615dfb6267cbf Mon Sep 17 00:00:00 2001 From: stoffu Date: Wed, 24 Jan 2018 15:16:34 +0900 Subject: [PATCH 2/3] rectified visual switch between local node & remote node --- pages/Settings.qml | 8 ++++---- wizard/WizardDaemonSettings.qml | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pages/Settings.qml b/pages/Settings.qml index 1e753651..c4df7288 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -248,7 +248,7 @@ Rectangle { } GridLayout { - visible: !isMobile + visible: !isMobile && !persistentSettings.useRemoteNode id: daemonStatusRow columns: (isMobile) ? 2 : 4 StandardButton { @@ -325,7 +325,7 @@ Rectangle { RowLayout { - visible: daemonAdvanced.checked && !isMobile + visible: daemonAdvanced.checked && !isMobile && !persistentSettings.useRemoteNode id: daemonFlagsRow Label { id: daemonFlagsLabel @@ -343,7 +343,7 @@ Rectangle { RowLayout { Layout.fillWidth: true - visible: daemonAdvanced.checked || isMobile + visible: (daemonAdvanced.checked || isMobile) && persistentSettings.useRemoteNode Label { id: daemonLoginLabel Layout.fillWidth: true @@ -354,7 +354,7 @@ Rectangle { } ColumnLayout { - visible: daemonAdvanced.checked || isMobile + visible: (daemonAdvanced.checked || isMobile) && persistentSettings.useRemoteNode LineEdit { id: daemonUsername Layout.preferredWidth: 100 * scaleRatio diff --git a/wizard/WizardDaemonSettings.qml b/wizard/WizardDaemonSettings.qml index dd41172c..8634f652 100644 --- a/wizard/WizardDaemonSettings.qml +++ b/wizard/WizardDaemonSettings.qml @@ -130,6 +130,10 @@ ColumnLayout { uncheckedIcon: "../images/uncheckedIcon.png" checked: !appWindow.persistentSettings.useRemoteNode && !isAndroid && !isIOS visible: !isAndroid && !isIOS + onClicked: { + checked = true; + remoteNode.checked = false; + } } } @@ -175,6 +179,10 @@ ColumnLayout { checkedIcon: "../images/checkedVioletIcon.png" uncheckedIcon: "../images/uncheckedIcon.png" checked: appWindow.persistentSettings.useRemoteNode + onClicked: { + checked = true + localNode.checked = false + } } } From fd1f4bf628129e2dfce3de6dbdfc135ad4cadffa Mon Sep 17 00:00:00 2001 From: stoffu Date: Mon, 22 Jan 2018 18:43:39 +0900 Subject: [PATCH 3/3] Bootstrap daemon (requires #3165) --- main.qml | 3 ++- pages/Settings.qml | 23 +++++++++++++++++++++++ src/daemon/DaemonManager.cpp | 7 ++++++- src/daemon/DaemonManager.h | 2 +- wizard/WizardDaemonSettings.qml | 14 ++++++++++++++ 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/main.qml b/main.qml index 9ce7d58e..150a3a16 100644 --- a/main.qml +++ b/main.qml @@ -478,7 +478,7 @@ ApplicationWindow { currentWallet.pauseRefresh(); appWindow.showProcessingSplash(qsTr("Waiting for daemon to start...")) - daemonManager.start(flags, persistentSettings.testnet, persistentSettings.blockchainDataDir); + daemonManager.start(flags, persistentSettings.testnet, persistentSettings.blockchainDataDir, persistentSettings.bootstrapNodeAddress); persistentSettings.daemonFlags = flags } @@ -1006,6 +1006,7 @@ ApplicationWindow { property string blockchainDataDir: "" property bool useRemoteNode: false property string remoteNodeAddress: "" + property string bootstrapNodeAddress: "" } // Information dialog diff --git a/pages/Settings.qml b/pages/Settings.qml index c4df7288..3f933760 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -260,6 +260,9 @@ Rectangle { releasedColor: "#FF6C3C" pressedColor: "#FF4304" onClicked: { + // Update bootstrap daemon address + persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : ""; + // Set current daemon address to local appWindow.currentDaemonAddress = appWindow.localDaemonAddress appWindow.startDaemon(daemonFlags.text) @@ -374,6 +377,26 @@ Rectangle { } } + RowLayout { + visible: persistentSettings.startLocalNode + ColumnLayout { + Label { + color: "#4A4949" + text: qsTr("Bootstrap node (leave blank if not wanted)") + translationManager.emptyString + } + RemoteNodeEdit { + id: bootstrapNodeEdit + Layout.minimumWidth: 100 * scaleRatio + 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 { diff --git a/src/daemon/DaemonManager.cpp b/src/daemon/DaemonManager.cpp index 58002014..93e7a9a8 100644 --- a/src/daemon/DaemonManager.cpp +++ b/src/daemon/DaemonManager.cpp @@ -32,7 +32,7 @@ DaemonManager *DaemonManager::instance(const QStringList *args) return m_instance; } -bool DaemonManager::start(const QString &flags, bool testnet, const QString &dataDir) +bool DaemonManager::start(const QString &flags, bool testnet, const QString &dataDir, const QString &bootstrapNodeAddress) { // prepare command line arguments and pass to monerod QStringList arguments; @@ -67,6 +67,11 @@ bool DaemonManager::start(const QString &flags, bool testnet, const QString &dat arguments << dataDir; } + // Bootstrap node address + if(!bootstrapNodeAddress.isEmpty()) { + arguments << "--bootstrap-daemon-address" << bootstrapNodeAddress; + } + arguments << "--check-updates" << "disabled"; diff --git a/src/daemon/DaemonManager.h b/src/daemon/DaemonManager.h index 2b9c8b84..d081ad7d 100644 --- a/src/daemon/DaemonManager.h +++ b/src/daemon/DaemonManager.h @@ -14,7 +14,7 @@ public: static DaemonManager * instance(const QStringList *args); - Q_INVOKABLE bool start(const QString &flags, bool testnet, const QString &dataDir = ""); + Q_INVOKABLE bool start(const QString &flags, bool testnet, const QString &dataDir = "", const QString &bootstrapNodeAddress = ""); Q_INVOKABLE bool stop(bool testnet); // return true if daemon process is started diff --git a/wizard/WizardDaemonSettings.qml b/wizard/WizardDaemonSettings.qml index 8634f652..953bb21d 100644 --- a/wizard/WizardDaemonSettings.qml +++ b/wizard/WizardDaemonSettings.qml @@ -55,6 +55,7 @@ ColumnLayout { function onPageClosed(settingsObject) { appWindow.persistentSettings.useRemoteNode = remoteNode.checked appWindow.persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress(); + appWindow.persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : ""; return true } @@ -165,6 +166,19 @@ ColumnLayout { } } + Label { + Layout.fillWidth: true + Layout.topMargin: 20 * scaleRatio + fontSize: 14 * scaleRatio + text: qsTr("Bootstrap node (leave blank if not wanted)") + translationManager.emptyString + } + RemoteNodeEdit { + Layout.minimumWidth: 300 * scaleRatio + opacity: localNode.checked + id: bootstrapNodeEdit + daemonAddrText: persistentSettings.bootstrapNodeAddress.split(":")[0].trim() + daemonPortText: (persistentSettings.bootstrapNodeAddress.split(":")[1].trim() == "") ? "18081" : persistentSettings.bootstrapNodeAddress.split(":")[1] + } } RowLayout {