aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-05-02 01:48:20 +0000
committerxiphon <xiphon@protonmail.com>2020-05-02 01:54:11 +0000
commit503c1af5f8e75aae7a87afc5c0b2b33fefda5a3e (patch)
treeb3f4e590fbf7823a2e0519d5076798c07a96caad
parentca79525fdb4e462a435d9914a46fcef449577f9d (diff)
downloadmonzero-gui-503c1af5f8e75aae7a87afc5c0b2b33fefda5a3e.tar.gz
monzero-gui-503c1af5f8e75aae7a87afc5c0b2b33fefda5a3e.tar.xz
monzero-gui-503c1af5f8e75aae7a87afc5c0b2b33fefda5a3e.zip
SettingsLayout: implement autosave, enabled by default (10 minutes)
-rw-r--r--main.qml20
-rw-r--r--pages/settings/SettingsLayout.qml19
2 files changed, 39 insertions, 0 deletions
diff --git a/main.qml b/main.qml
index 5c7b62c9..b311e510 100644
--- a/main.qml
+++ b/main.qml
@@ -1370,6 +1370,8 @@ ApplicationWindow {
property int lockOnUserInActivityInterval: 10 // minutes
property bool blackTheme: true
property bool checkForUpdates: true
+ property bool autosave: true
+ property int autosaveMinutes: 10
property bool fiatPriceEnabled: false
property bool fiatPriceToggle: false
@@ -1811,6 +1813,24 @@ ApplicationWindow {
}
}
+ Timer {
+ id: autosaveTimer
+ interval: persistentSettings.autosaveMinutes * 60 * 1000
+ repeat: true
+ running: persistentSettings.autosave
+ onTriggered: {
+ if (currentWallet) {
+ currentWallet.storeAsync(function(success) {
+ if (success) {
+ appWindow.showStatusMessage(qsTr("Autosaved the wallet"), 3);
+ } else {
+ appWindow.showStatusMessage(qsTr("Failed to autosave the wallet"), 3);
+ }
+ });
+ }
+ }
+ }
+
// TODO: Make the callback dynamic
Timer {
id: statusMessageTimer
diff --git a/pages/settings/SettingsLayout.qml b/pages/settings/SettingsLayout.qml
index 0d32b88e..f6032e32 100644
--- a/pages/settings/SettingsLayout.qml
+++ b/pages/settings/SettingsLayout.qml
@@ -95,6 +95,25 @@ Rectangle {
}
MoneroComponents.CheckBox {
+ checked: persistentSettings.autosave
+ onClicked: persistentSettings.autosave = !persistentSettings.autosave
+ text: qsTr("Autosave") + translationManager.emptyString
+ }
+
+ MoneroComponents.Slider {
+ Layout.fillWidth: true
+ Layout.leftMargin: 35
+ Layout.topMargin: 6
+ visible: persistentSettings.autosave
+ from: 1
+ stepSize: 1
+ to: 60
+ value: persistentSettings.autosaveMinutes
+ text: "%1 %2 %3".arg(qsTr("Every")).arg(value).arg(qsTr("minute(s)")) + translationManager.emptyString
+ onMoved: persistentSettings.autosaveMinutes = value
+ }
+
+ MoneroComponents.CheckBox {
id: userInActivityCheckbox
checked: persistentSettings.lockOnUserInActivity
onClicked: persistentSettings.lockOnUserInActivity = !persistentSettings.lockOnUserInActivity