Merge pull request #1091

89ec822 removed persistentSettings.startLocalNode as it's synonym for !persistentSettings.useRemoteNode
af882e8 rectified visual switch between local node & remote node
fd1f4bf Bootstrap daemon (requires #3165)
This commit is contained in:
luigi1111 2018-03-06 12:24:20 -05:00
commit 2deff0611d
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
5 changed files with 61 additions and 12 deletions

View File

@ -436,7 +436,7 @@ ApplicationWindow {
if(localNodeConnected) { if(localNodeConnected) {
leftPanel.progressBar.updateProgress(walletManager.blockchainHeight(),walletManager.blockchainTargetHeight(), 0, qsTr("Remaining blocks (local node):")); leftPanel.progressBar.updateProgress(walletManager.blockchainHeight(),walletManager.blockchainTargetHeight(), 0, qsTr("Remaining blocks (local node):"));
leftPanel.progressBar.visible = true leftPanel.progressBar.visible = true
} else if (persistentSettings.startLocalNode && !startLocalNodeCancelled) { } else if (!persistentSettings.useRemoteNode && !startLocalNodeCancelled) {
daemonManagerDialog.open() daemonManagerDialog.open()
} }
@ -478,7 +478,7 @@ ApplicationWindow {
currentWallet.pauseRefresh(); currentWallet.pauseRefresh();
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start...")) 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 persistentSettings.daemonFlags = flags
} }
@ -1004,9 +1004,9 @@ ApplicationWindow {
property string daemonPassword: "" property string daemonPassword: ""
property bool transferShowAdvanced: false property bool transferShowAdvanced: false
property string blockchainDataDir: "" property string blockchainDataDir: ""
property bool startLocalNode: true
property bool useRemoteNode: false property bool useRemoteNode: false
property string remoteNodeAddress: "" property string remoteNodeAddress: ""
property string bootstrapNodeAddress: ""
} }
// Information dialog // Information dialog

View File

@ -248,7 +248,7 @@ Rectangle {
} }
GridLayout { GridLayout {
visible: !isMobile visible: !isMobile && !persistentSettings.useRemoteNode
id: daemonStatusRow id: daemonStatusRow
columns: (isMobile) ? 2 : 4 columns: (isMobile) ? 2 : 4
StandardButton { StandardButton {
@ -260,6 +260,9 @@ Rectangle {
releasedColor: "#FF6C3C" releasedColor: "#FF6C3C"
pressedColor: "#FF4304" pressedColor: "#FF4304"
onClicked: { onClicked: {
// Update bootstrap daemon address
persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
// Set current daemon address to local // Set current daemon address to local
appWindow.currentDaemonAddress = appWindow.localDaemonAddress appWindow.currentDaemonAddress = appWindow.localDaemonAddress
appWindow.startDaemon(daemonFlags.text) appWindow.startDaemon(daemonFlags.text)
@ -296,7 +299,7 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: blockchainFolderRow id: blockchainFolderRow
visible: !isMobile visible: !isMobile && !persistentSettings.useRemoteNode
Label { Label {
id: blockchainFolderLabel id: blockchainFolderLabel
color: "#4A4949" color: "#4A4949"
@ -325,7 +328,7 @@ Rectangle {
RowLayout { RowLayout {
visible: daemonAdvanced.checked && !isMobile visible: daemonAdvanced.checked && !isMobile && !persistentSettings.useRemoteNode
id: daemonFlagsRow id: daemonFlagsRow
Label { Label {
id: daemonFlagsLabel id: daemonFlagsLabel
@ -343,7 +346,7 @@ Rectangle {
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
visible: daemonAdvanced.checked || isMobile visible: (daemonAdvanced.checked || isMobile) && persistentSettings.useRemoteNode
Label { Label {
id: daemonLoginLabel id: daemonLoginLabel
Layout.fillWidth: true Layout.fillWidth: true
@ -354,7 +357,7 @@ Rectangle {
} }
ColumnLayout { ColumnLayout {
visible: daemonAdvanced.checked || isMobile visible: (daemonAdvanced.checked || isMobile) && persistentSettings.useRemoteNode
LineEdit { LineEdit {
id: daemonUsername id: daemonUsername
Layout.preferredWidth: 100 * scaleRatio Layout.preferredWidth: 100 * scaleRatio
@ -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 { RowLayout {
visible: persistentSettings.useRemoteNode visible: persistentSettings.useRemoteNode
ColumnLayout { ColumnLayout {

View File

@ -32,7 +32,7 @@ DaemonManager *DaemonManager::instance(const QStringList *args)
return m_instance; 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 // prepare command line arguments and pass to monerod
QStringList arguments; QStringList arguments;
@ -67,6 +67,11 @@ bool DaemonManager::start(const QString &flags, bool testnet, const QString &dat
arguments << dataDir; arguments << dataDir;
} }
// Bootstrap node address
if(!bootstrapNodeAddress.isEmpty()) {
arguments << "--bootstrap-daemon-address" << bootstrapNodeAddress;
}
arguments << "--check-updates" << "disabled"; arguments << "--check-updates" << "disabled";

View File

@ -14,7 +14,7 @@ public:
static DaemonManager * instance(const QStringList *args); 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); Q_INVOKABLE bool stop(bool testnet);
// return true if daemon process is started // return true if daemon process is started

View File

@ -54,8 +54,8 @@ ColumnLayout {
function onPageClosed(settingsObject) { function onPageClosed(settingsObject) {
appWindow.persistentSettings.useRemoteNode = remoteNode.checked appWindow.persistentSettings.useRemoteNode = remoteNode.checked
appWindow.persistentSettings.startLocalNode = localNode.checked
appWindow.persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress(); appWindow.persistentSettings.remoteNodeAddress = remoteNodeEdit.getAddress();
appWindow.persistentSettings.bootstrapNodeAddress = bootstrapNodeEdit.daemonAddrText ? bootstrapNodeEdit.getAddress() : "";
return true return true
} }
@ -129,8 +129,12 @@ ColumnLayout {
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
checkedIcon: "../images/checkedVioletIcon.png" checkedIcon: "../images/checkedVioletIcon.png"
uncheckedIcon: "../images/uncheckedIcon.png" uncheckedIcon: "../images/uncheckedIcon.png"
checked: appWindow.persistentSettings.startLocalNode && !isAndroid && !isIOS checked: !appWindow.persistentSettings.useRemoteNode && !isAndroid && !isIOS
visible: !isAndroid && !isIOS visible: !isAndroid && !isIOS
onClicked: {
checked = true;
remoteNode.checked = false;
}
} }
} }
@ -162,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 { RowLayout {
@ -176,6 +193,10 @@ ColumnLayout {
checkedIcon: "../images/checkedVioletIcon.png" checkedIcon: "../images/checkedVioletIcon.png"
uncheckedIcon: "../images/uncheckedIcon.png" uncheckedIcon: "../images/uncheckedIcon.png"
checked: appWindow.persistentSettings.useRemoteNode checked: appWindow.persistentSettings.useRemoteNode
onClicked: {
checked = true
localNode.checked = false
}
} }
} }