ui is done for asynchronous saving

This commit is contained in:
Chris Cochrun 2024-04-21 13:42:50 -05:00
parent 1105a061bf
commit 99178dbfe4
3 changed files with 22 additions and 17 deletions

View file

@ -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 {]]

View file

@ -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); */
/* } */

View file

@ -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