From 99178dbfe45376242bda1eaa8eb7e241b706e713 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sun, 21 Apr 2024 13:42:50 -0500 Subject: [PATCH] ui is done for asynchronous saving --- TODO.org | 20 ++++++++++---------- src/qml/main.qml | 17 +++++++++++------ src/qml/presenter/MainWindow.qml | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/TODO.org b/TODO.org index dc298f8..7fc973d 100644 --- a/TODO.org +++ b/TODO.org @@ -4,7 +4,7 @@ :CATEGORY: dev :END: -* Tasks [63%] [53/84] +* Tasks [64%] [54/84] ** TODO [#B] start and end times for videos :feature: This is something I couldn't get right in my head and plans and I hope rust will help me to solve it. @@ -30,15 +30,6 @@ To display all the slides... Actually as I type this out, I'm starting to think that the slide_model still needs all the metadata that the slide_object will have. The reason being that I'd like to have details in the slide preview system that can only come from having all the info available to QML. This makes the QML preview system a lot easier to reason with because you can use property binding rather than needing to create a custom building system for each arbitrary detail we want to add the to the previews. All that said, what properties does the slide_object and slide_model really need then? Is there a way for the model to have fewer props? -** TODO Saving needs to be asynchronous -I need to figure out how to make saving asynchronous in order to not lock the ui thread while saving. - -Tokio seems to not be working the way I expected.... - -Works much better with spawning an os thread. - -Still needs some form of ui to indicate that saving is in progress. - ** TODO [#B] Fix updating things in the song editor [[file:~/dev/lumina/src/qml/presenter/SongEditor.qml::function updateLyrics(lyrics) {]] The core problem with this is that when we set the song, the index to get the item is the index of the item in the vector, not the ID in the DB. So, when we get a song, we can't use that index to update things, we need to make sure we are using the id so that all the new work in updating the right item is done correctly. @@ -265,6 +256,15 @@ Let's rename everything to that. Both PDFs and reveal.js presentations think every slide is the first one. I need a way of finding the individual components and then properly switching to the next one. Switching to the next slide in reveal.js may be tricky since I'll need to push into the WebEngineView the next reveal function and then get back how many more slides and fragments there are. +** DONE Saving needs to be asynchronous +I need to figure out how to make saving asynchronous in order to not lock the ui thread while saving. + +Tokio seems to not be working the way I expected.... + +Works much better with spawning an os thread. + +Still needs some form of ui to indicate that saving is in progress. + ** DONE [#B] Fix switching songs in editor not showing the right lyrics ** DONE Mouse needs to have resize shape when hovering controls :bug: [[file:~/dev/lumina/src/qml/presenter/SongEditor.qml::Controls.SplitView {]] diff --git a/src/qml/main.qml b/src/qml/main.qml index e4d7efd..915001a 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -112,13 +112,11 @@ Kirigami.ApplicationWindow { Controls.ProgressBar { id: footerSaveProgress - anchors.left: footerFilePathLabel.left - anchors.right: footerFilePathLabel.right - anchors.rightMargin: footerFilePathLabel.rightMargin + anchors.fill: parent from: 0.0 to: 100.0 - value: Math.min(ServiceItemModel.saveProgess, 100.0) - /* visible: mainPage.progress > 0 */ + value: mainPage.progress + visible: mainPage.progress > 0 } } /* Item { */ @@ -292,11 +290,18 @@ Kirigami.ApplicationWindow { let path = file.toString(); path = path.replace(/^(file:\/{2})/,""); let cleanPath = decodeURIComponent(path); - showPassiveNotification("Saved to ", + cleanPath); + showPassiveNotification("Saved to " + cleanPath, 2000); + resetSavedTimer.restart(); } } } + Timer { + id: resetSavedTimer + interval: 2000 + onTriggered: ServiceItemModel.saveProgress = 0; + } + /* function finalSave(file) { */ /* const saved = mainPage.serviceItems.save(file); */ /* } */ diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 06d379b..3b0be93 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -39,7 +39,7 @@ Controls.Page { property int dragItemSlideNumber property bool editing: true - property int progress: 0 + property int progress: ServiceItemModel.saveProgress property Item slideItem property var song