SettingsNode: keep local node running redesign

This commit is contained in:
rating89us 2020-05-11 13:48:05 +02:00
parent ecf5c501d6
commit fdee509695
2 changed files with 78 additions and 13 deletions

View file

@ -1420,6 +1420,7 @@ ApplicationWindow {
property bool autosave: true
property int autosaveMinutes: 10
property bool pruneBlockchain: false
property int keepLocalNodeRunning: 2 //0 = stop local node, 1 = keep it running, 2 = always ask
property bool fiatPriceEnabled: false
property bool fiatPriceToggle: false
@ -1604,6 +1605,24 @@ ApplicationWindow {
}
}
StandardDialog {
z: parent.z + 1
id: localNodeRunningConfirmationDialog
closeVisible: false
property var onAcceptedCallback
property var onRejectedCallback
onRejected: {
//Stop local node
if (onRejectedCallback)
onRejectedCallback();
}
onAccepted: {
//Keep local node running
if (onAcceptedCallback)
onAcceptedCallback()
}
}
MoneroComponents.UpdateDialog {
id: updateDialog
@ -1845,7 +1864,7 @@ ApplicationWindow {
radius: 64
visible: passwordDialog.visible || inputDialog.visible || splash.visible || updateDialog.visible ||
devicePassphraseDialog.visible || txConfirmationPopup.visible || successfulTxPopup.visible ||
remoteNodeDialog.visible
remoteNodeDialog.visible || localNodeRunningConfirmationDialog.visible
}
@ -2080,19 +2099,29 @@ ApplicationWindow {
}
function showDaemonIsRunningDialog(onClose) {
if (persistentSettings.keepLocalNodeRunning == 2) {
// 2 = always ask
// Show confirmation dialog
confirmationDialog.title = qsTr("Local node is running") + translationManager.emptyString;
confirmationDialog.text = qsTr("Do you want to stop local node or keep it running in the background?") + translationManager.emptyString;
confirmationDialog.icon = StandardIcon.Question;
confirmationDialog.cancelText = qsTr("Force stop") + translationManager.emptyString;
confirmationDialog.okText = qsTr("Keep it running") + translationManager.emptyString;
confirmationDialog.onAcceptedCallback = function() {
localNodeRunningConfirmationDialog.title = qsTr("Local node is running") + translationManager.emptyString;
localNodeRunningConfirmationDialog.closeVisible = false;
localNodeRunningConfirmationDialog.text = qsTr("Your local node is now running in the background. It is recommended to keep it running in order to help the network and to maintain your blockchain synchronized.") + translationManager.emptyString;
localNodeRunningConfirmationDialog.icon = StandardIcon.Question;
localNodeRunningConfirmationDialog.cancelText = qsTr("Stop local node") + translationManager.emptyString;
localNodeRunningConfirmationDialog.okText = qsTr("Keep it running") + translationManager.emptyString;
localNodeRunningConfirmationDialog.onAcceptedCallback = function() {
onClose();
}
confirmationDialog.onRejectedCallback = function() {
localNodeRunningConfirmationDialog.onRejectedCallback = function() {
stopDaemon(onClose);
};
confirmationDialog.open();
localNodeRunningConfirmationDialog.open();
} else if (persistentSettings.keepLocalNodeRunning == 1) {
//1 = keep local node running
onClose();
} else if (persistentSettings.keepLocalNodeRunning == 0) {
//0 = stop local node
stopDaemon(onClose);
}
}
onClosing: {

View file

@ -307,6 +307,42 @@ Rectangle{
}
}
ColumnLayout {
spacing: 10
Layout.fillWidth: true
id: keepLocalNodeRunningColumn
z: parent.z + 1
MoneroComponents.Label {
id: keepLocalNodeRunningLabel
Layout.topMargin: 0
text: qsTr("When closing GUI wallet or connecting to a remote node") + translationManager.emptyString
fontBold: false
fontSize: 14
}
ListModel {
id: keepLocalNodeRunningListModel
ListElement { column1: "Stop local node"; }
ListElement { column1: "Keep local node running (recommended)"; }
ListElement { column1: "Always ask whether the node should be stopped"; }
}
MoneroComponents.StandardDropdown {
id: keepLocalNodeRunningDropDown
dataModel: keepLocalNodeRunningListModel
itemTopMargin: 2
currentIndex: appWindow.persistentSettings.keepLocalNodeRunning;
onChanged: {
console.log("keepLocalNodeRunning changed: ",currentIndex);
appWindow.persistentSettings.keepLocalNodeRunning = currentIndex;
}
Layout.fillWidth: true
Layout.preferredWidth: keepLocalNodeRunningColumn.width
z: parent.z + 1
}
}
MoneroComponents.LineEditMulti {
id: daemonFlags
Layout.fillWidth: true