pomodoro: add cycle indicator, make long break work, fix reset button

This commit is contained in:
end-4
2025-08-09 22:06:05 +07:00
parent 4ca15a1fc3
commit 9e1b55a749
3 changed files with 65 additions and 32 deletions
@@ -11,18 +11,35 @@ Singleton {
property string fileName: "states.json"
property string filePath: `${root.fileDir}/${root.fileName}`
Timer {
id: fileReloadTimer
interval: 100
repeat: false
onTriggered: {
persistentStatesFileView.reload()
}
}
Timer {
id: fileWriteTimer
interval: 100
repeat: false
onTriggered: {
persistentStatesFileView.writeAdapter()
}
}
FileView {
id: persistentStatesFileView
path: root.filePath
watchChanges: true
onFileChanged: reload()
onAdapterUpdated: {
writeAdapter()
}
onFileChanged: fileReloadTimer.restart()
onAdapterUpdated: fileWriteTimer.restart()
onLoadFailed: error => {
console.log("Failed to load persistent states file:", error);
if (error == FileViewError.FileNotFound) {
writeAdapter();
fileWriteTimer.restart();
}
}
@@ -50,6 +67,7 @@ Singleton {
property bool running: false
property int start: 0
property bool isBreak: false
property bool isLongBreak: false
property int cycle: 0
}
property JsonObject stopwatch: JsonObject {