making the window close and stop audio properly

This commit is contained in:
Chris Cochrun 2022-09-16 06:03:41 -05:00
parent 9a180f7df0
commit 9f9026105f
3 changed files with 20 additions and 14 deletions

View file

@ -97,10 +97,8 @@ Controls.Page {
} }
} }
Loader { Presenter.PresentationWindow {
id: presentLoader id: pWindow
active: presenting
source: "PresentationWindow.qml"
} }
SongSqlModel { SongSqlModel {
@ -186,8 +184,11 @@ Controls.Page {
function present(present) { function present(present) {
if (present) if (present)
presentationWindow.showFullScreen(); {
presentation.loadVideo();
pWindow.showFullScreen();
}
else else
presentationWindow.close(); pWindow.close();
} }
} }

View file

@ -13,12 +13,19 @@ Window {
height: maximumHeight height: maximumHeight
width: maximumWidth width: maximumWidth
screen: presentationScreen screen: presentationScreen
opacity: 1.0
transientParent: null
/* flags: Qt.X11BypassWindowManagerHint */ /* flags: Qt.X11BypassWindowManagerHint */
onClosing: close() onClosing: {
presentationSlide.stopVideo();
SlideObject.pause();
presenting = false;
}
Component.onCompleted: { Component.onCompleted: {
presentationWindow.showFullScreen(); /* presentationWindow.showFullScreen(); */
print(screen.name); print(screen.name);
showMinimized();
} }
Presenter.Slide { Presenter.Slide {
@ -52,10 +59,4 @@ Window {
function pauseVideo() { function pauseVideo() {
presentationSlide.pauseVideo(); presentationSlide.pauseVideo();
} }
function close() {
presentationSlide.stopVideo();
SlideObject.pause();
presenting = false;
}
} }

View file

@ -171,6 +171,10 @@ Item {
showPassiveNotification("Black is: " + black.visible); showPassiveNotification("Black is: " + black.visible);
} }
function quitMpv() {
mpv.quit();
}
function pauseVideo() { function pauseVideo() {
mpv.pause(); mpv.pause();
} }