From a2f6c82ee04f2684ba03932a528e49ec7445e725 Mon Sep 17 00:00:00 2001 From: kelteseth Date: Thu, 20 Sep 2018 15:44:29 +0200 Subject: [PATCH] Add qml mute before destroy --- ScreenPlayWindow/main.qml | 7 +++++++ ScreenPlayWindow/src/SPWmainwindow.cpp | 4 ++-- ScreenPlayWindow/src/SPWmainwindow.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ScreenPlayWindow/main.qml b/ScreenPlayWindow/main.qml index 74803506..1e39d262 100644 --- a/ScreenPlayWindow/main.qml +++ b/ScreenPlayWindow/main.qml @@ -7,6 +7,13 @@ Rectangle { Connections { target: mainwindow + + onQmlExit:{ + webView.runJavaScript( + "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;") + mainwindow.destroyThis() + } + onFillModeChanged: { //TODO } diff --git a/ScreenPlayWindow/src/SPWmainwindow.cpp b/ScreenPlayWindow/src/SPWmainwindow.cpp index 5a98828b..92e4133a 100644 --- a/ScreenPlayWindow/src/SPWmainwindow.cpp +++ b/ScreenPlayWindow/src/SPWmainwindow.cpp @@ -104,7 +104,7 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, } //Hide first to avoid flickering - ShowWindow(m_worker_hwnd, SW_HIDE); + //ShowWindow(m_worker_hwnd, SW_HIDE); ShowWindow(m_hwnd, SW_HIDE); MoveWindow(m_hwnd, screen->geometry().x() + offsetX, screen->geometry().y() + offsetY, screen->size().width(), screen->size().height(), true); SetParent(m_hwnd, m_worker_hwnd); @@ -139,7 +139,7 @@ void MainWindow::init() #ifdef Q_OS_WIN // This needs to be set in this order or // the window will be opened as fullscreen! - ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT); + //ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT); ShowWindow(m_hwnd, SW_SHOWDEFAULT); #endif } diff --git a/ScreenPlayWindow/src/SPWmainwindow.h b/ScreenPlayWindow/src/SPWmainwindow.h index 19283ce8..d49692e4 100644 --- a/ScreenPlayWindow/src/SPWmainwindow.h +++ b/ScreenPlayWindow/src/SPWmainwindow.h @@ -225,6 +225,7 @@ signals: void playbackRateChanged(float playbackRate); void qmlSceneValueReceived(QString key, QString value); void decoderChanged(QString decoder); + void qmlExit(); private: #ifdef Q_OS_WIN