From e6d047f4c1a4b0fd39c7ddf4fcddd3d70d2a5665 Mon Sep 17 00:00:00 2001 From: kelteseth Date: Sat, 25 Aug 2018 00:43:23 +0200 Subject: [PATCH] Add small curtain transition --- ScreenPlayWindow/index.html | 5 +-- ScreenPlayWindow/main.qml | 46 +++++++++++++++----------- ScreenPlayWindow/src/SPWmainwindow.cpp | 10 +----- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/ScreenPlayWindow/index.html b/ScreenPlayWindow/index.html index c91f842e..1113fd22 100644 --- a/ScreenPlayWindow/index.html +++ b/ScreenPlayWindow/index.html @@ -6,18 +6,19 @@ object-fit: fill; overflow: hidden; height: 100%; + background:black; } body, html{ margin: 0px; padding: 0px; overflow: hidden; - background:orange; + background:black; } diff --git a/ScreenPlayWindow/main.qml b/ScreenPlayWindow/main.qml index 39222abd..e2e419e2 100644 --- a/ScreenPlayWindow/main.qml +++ b/ScreenPlayWindow/main.qml @@ -65,33 +65,39 @@ Rectangle { onLoadProgressChanged: { print(loadProgress) if (loadProgress === 100) { - timerShowDelay.start() - } - } - userScripts: [scriptPlayer] - onJavaScriptConsoleMessage: print(message) - settings.allowRunningInsecureContent: true - - WebEngineScript { - id: scriptPlayer - injectionPoint: WebEngineScript.DocumentReady - worldId: WebEngineScript.MainWorld - sourceCode: { - return "var videoPlayer = document.getElementById('videoPlayer'); + runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); var videoSource = document.getElementById('videoSource'); videoSource.src = \"file:///" + mainwindow.fullContentPath + "\"; - videoPlayer.load();" + videoPlayer.load();", function(result) { mainwindow.init(); timer.start()}); + } } - - + onJavaScriptConsoleMessage: print(message) + settings.allowRunningInsecureContent: true } - Timer { - id: timerShowDelay - interval: 2000 + id:timer + interval: 200 onTriggered: { - mainwindow.init() + curtain.opacity = 0 + anim.start() + print("start") } } + + Rectangle { + id:curtain + anchors.fill: parent + color: "black" + + PropertyAnimation { + id:anim + property: "opacity" + target: curtain + from: "1" + to: "0" + duration: 300 + } + } + } diff --git a/ScreenPlayWindow/src/SPWmainwindow.cpp b/ScreenPlayWindow/src/SPWmainwindow.cpp index cf399803..e5dbc953 100644 --- a/ScreenPlayWindow/src/SPWmainwindow.cpp +++ b/ScreenPlayWindow/src/SPWmainwindow.cpp @@ -137,18 +137,10 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder, } void MainWindow::init() { - setOpacity(0); #ifdef Q_OS_WIN - ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT); ShowWindow(m_hwnd, SW_SHOWDEFAULT); + ShowWindow(m_worker_hwnd, SW_SHOWDEFAULT); #endif - setOpacity(0); - QPropertyAnimation* animation = new QPropertyAnimation(this, "opacity"); - animation->setDuration(200); - //animation->setEasingCurve(QEasingCurve::OutCubic); - animation->setStartValue(0.0); - animation->setEndValue(1.0); - animation->start(); } QString MainWindow::getApplicationPath()