diff --git a/ScreenPlayWindow/index.html b/ScreenPlayWindow/index.html index 078c58ff..046e1c04 100644 --- a/ScreenPlayWindow/index.html +++ b/ScreenPlayWindow/index.html @@ -13,10 +13,11 @@ margin: 0px; padding: 0px; overflow: hidden; + background:black; } #errorMsg{ position: fixed; - top: 0; + top: 50%; text-align: center; left: 0; width: 100%; @@ -29,10 +30,9 @@ -

If you can read this something went wrong. Oh well....

diff --git a/ScreenPlayWindow/mainWindow.qml b/ScreenPlayWindow/mainWindow.qml index f39643b6..3e4b652b 100644 --- a/ScreenPlayWindow/mainWindow.qml +++ b/ScreenPlayWindow/mainWindow.qml @@ -1,11 +1,11 @@ import QtQuick 2.12 -import QtWebEngine 1.7 +import QtWebEngine 1.8 import net.aimber.wallpaper 1.0 Rectangle { anchors.fill: parent color: { - if(desktopProperties.color === null){ + if (desktopProperties.color === null) { return "black" } else { return desktopProperties.color @@ -15,6 +15,7 @@ Rectangle { property bool canFadeIn: true Component.onCompleted: { + WebEngine.settings.allowRunningInsecureContent = true WebEngine.settings.accelerated2dCanvasEnabled = true WebEngine.settings.javascriptCanOpenWindows = false @@ -24,9 +25,9 @@ Rectangle { switch (window.type) { case Wallpaper.WallpaperType.Video: - webView.enabled = true webView.url = Qt.resolvedUrl(window.getApplicationPath( ) + "/index.html") + webView.enabled = true break case Wallpaper.WallpaperType.Html: @@ -44,7 +45,6 @@ Rectangle { } function fadeIn() { - window.setVisible(true) if (canFadeIn) { animFadeIn.start() @@ -53,31 +53,34 @@ Rectangle { } } + Loader { + id: loader + anchors.fill: parent + } + WebEngineView { id: webView - enabled: true + enabled: false anchors.fill: parent onLoadProgressChanged: { + if (loadProgress === 100) { var src = "" src += "var videoPlayer = document.getElementById('videoPlayer');" src += "var videoSource = document.getElementById('videoSource');" - src += "videoSource.src = 'file:///" + window.fullContentPath + "';" + src += "videoSource.src = '" + window.fullContentPath + "';" src += "videoPlayer.load();" src += "videoPlayer.volume = " + window.volume + ";" src += "videoPlayer.play();" - webView.runJavaScript(src, function () { + webView.runJavaScript(src, function (result) { fadeIn() }) } } - } - Loader { - id: loader - anchors.fill: parent - source: "qrc:/test.qml" + + onJavaScriptConsoleMessage: print(lineNumber, message) } OpacityAnimator { @@ -171,5 +174,4 @@ Rectangle { } } } - } diff --git a/ScreenPlayWindow/src/basewindow.h b/ScreenPlayWindow/src/basewindow.h index 0251c000..ac9dde16 100644 --- a/ScreenPlayWindow/src/basewindow.h +++ b/ScreenPlayWindow/src/basewindow.h @@ -103,7 +103,7 @@ public slots: } void setVolume(float volume) { - qWarning("Floating point comparison needs context sanity check"); + if (qFuzzyCompare(m_volume, volume)) return; diff --git a/ScreenPlayWindow/src/winwindow.cpp b/ScreenPlayWindow/src/winwindow.cpp index f8a48733..f7963e97 100644 --- a/ScreenPlayWindow/src/winwindow.cpp +++ b/ScreenPlayWindow/src/winwindow.cpp @@ -60,7 +60,7 @@ WinWindow::WinWindow(QVector& activeScreensList, QString projectPath, QStri m_window.setSource(QUrl("qrc:/mainWindow.qml")); // Let QML decide when were are read to show the window - //ShowWindow(m_windowHandle, SW_HIDE); + ShowWindow(m_windowHandle, SW_HIDE); }