This commit is contained in:
rating89us 2024-11-25 23:22:39 +00:00 committed by GitHub
commit 17a36da9fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 78 additions and 13 deletions

View File

@ -1442,6 +1442,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
@ -1632,7 +1633,25 @@ ApplicationWindow {
onRejectedCallback();
}
}
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
@ -1877,7 +1896,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
}
@ -2113,19 +2132,29 @@ ApplicationWindow {
}
function showDaemonIsRunningDialog(onClose) {
// 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() {
if (persistentSettings.keepLocalNodeRunning == 2) {
// 2 = always ask
// Show confirmation dialog
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();
}
localNodeRunningConfirmationDialog.onRejectedCallback = function() {
stopDaemon(onClose);
};
localNodeRunningConfirmationDialog.open();
} else if (persistentSettings.keepLocalNodeRunning == 1) {
//1 = keep local node running
onClose();
}
confirmationDialog.onRejectedCallback = function() {
} else if (persistentSettings.keepLocalNodeRunning == 0) {
//0 = stop local node
stopDaemon(onClose);
};
confirmationDialog.open();
}
}
onClosing: {

View File

@ -308,6 +308,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