From 77e98c46825e140a35a6631ca17795b430e45b6d Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Sun, 14 Apr 2024 10:48:02 -0500 Subject: [PATCH] ui for a ProgressBar that shows the state of saving the presentation --- src/qml/main.qml | 23 +++++++++++++++++++---- src/qml/presenter/MainWindow.qml | 11 ++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/qml/main.qml b/src/qml/main.qml index 6478114..7e555b2 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -109,6 +109,17 @@ Kirigami.ApplicationWindow { cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor } } + + Controls.ProgressBar { + id: footerSaveProgress + anchors.left: footerFilePathLabel.left + anchors.right: footerFilePathLabel.right + anchors.rightMargin: footerFilePathLabel.rightMargin + from: 0 + to: 100 + value: mainPage.progress + visible: mainPage.progress > 0 + } } /* Item { */ /* Layout.fillWidth: true */ @@ -276,10 +287,14 @@ Kirigami.ApplicationWindow { function finalSave(file) { const saved = mainPage.serviceItems.save(file); - saved ? RSettings.setSaveFile(file) - : console.log("File: " + file + " wasn't saved"); - saved ? showPassiveNotification("SAVED! " + file) - : showPassiveNotification("Didn't save file"); + if (saved) { + RSettings.setSaveFile(file); + showPassiveNotification("SAVED! " + file); + mainPage.progress = 0; + } else { + console.log("File: " + file + " wasn't saved"); + showPassiveNotification("Didn't save file"); + } } function load() { diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index f90d7d9..67c010d 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -39,6 +39,7 @@ Controls.Page { property int dragItemSlideNumber property bool editing: true + property int progress: 0 property Item slideItem property var song @@ -54,6 +55,7 @@ Controls.Page { property var dragHighlightLine + Component.onCompleted: { changeServiceItem(0); presentation.forceActiveFocus(); @@ -180,6 +182,13 @@ Controls.Page { /* songModel: songProxyModel.songModel() */ } + Connections { + target: ServiceItemModel + function saveProgressUpdate(progress) { + mainPage.progress = progress; + } + } + function changeServiceItem(index) { console.log("change-service-item: " + index); const item = ServiceItemC.getRust(index, ServiceItemModel); @@ -314,7 +323,7 @@ Controls.Page { editMode = false; refocusPresentation(); footerFirstText = presenting ? "Presenting..." : "Presentation Preview"; - footerSecondText = ObsModel.currentProgramScene; + footerSecondText = ObsModel.currentProgramScene } } else { videoEditor.visible = false;