summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/Config.qml57
1 files changed, 0 insertions, 57 deletions
diff --git a/config/Config.qml b/config/Config.qml
index 7a5c04f..d9fb892 100644
--- a/config/Config.qml
+++ b/config/Config.qml
@@ -27,55 +27,6 @@ Singleton {
property alias services: adapter.services
property alias paths: adapter.paths
- // Public save function - call this to persist config changes
- function save(): void {
- saveTimer.restart();
- recentlySaved = true;
- recentSaveCooldown.restart();
- }
-
- property bool recentlySaved: false
-
- ElapsedTimer {
- id: timer
- }
-
- Timer {
- id: saveTimer
-
- interval: 500
- onTriggered: {
- timer.restart();
- try {
- // Parse current config to preserve structure and comments if possible
- let config = {};
- try {
- config = JSON.parse(fileView.text());
- } catch (e) {
- // If parsing fails, start with empty object
- config = {};
- }
-
- // Update config with current values
- config = serializeConfig();
-
- // Save to file with pretty printing
- fileView.setText(JSON.stringify(config, null, 2));
- } catch (e) {
- Toaster.toast(qsTr("Failed to serialize config"), e.message, "settings_alert", Toast.Error);
- }
- }
- }
-
- Timer {
- id: recentSaveCooldown
-
- interval: 2000
- onTriggered: {
- recentlySaved = false;
- }
- }
-
// Helper function to serialize the config object
function serializeConfig(): var {
return {
@@ -407,13 +358,6 @@ Singleton {
onLoaded: {
try {
JSON.parse(text());
- const elapsed = timer.elapsedMs();
- // Only show toast for external changes (not our own saves) and when elapsed time is meaningful
- if (adapter.utilities.toasts.configLoaded && !recentlySaved && elapsed > 0) {
- Toaster.toast(qsTr("Config loaded"), qsTr("Config loaded in %1ms").arg(elapsed), "rule_settings");
- } else if (adapter.utilities.toasts.configLoaded && recentlySaved && elapsed > 0) {
- Toaster.toast(qsTr("Config saved"), qsTr("Config reloaded in %1ms").arg(elapsed), "rule_settings");
- }
} catch (e) {
Toaster.toast(qsTr("Failed to load config"), e.message, "settings_alert", Toast.Error);
}
@@ -422,7 +366,6 @@ Singleton {
if (err !== FileViewError.FileNotFound)
Toaster.toast(qsTr("Failed to read config file"), FileViewError.toString(err), "settings_alert", Toast.Warning);
}
- onSaveFailed: err => Toaster.toast(qsTr("Failed to save config"), FileViewError.toString(err), "settings_alert", Toast.Error)
JsonAdapter {
id: adapter