1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 18:52:30 +01:00

Fix wallpaper path

This commit is contained in:
Elias 2019-03-30 12:56:34 +01:00
parent 22ef3494e0
commit 54154ad09b
4 changed files with 20 additions and 18 deletions

View File

@ -13,10 +13,11 @@
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
overflow: hidden; overflow: hidden;
background:black;
} }
#errorMsg{ #errorMsg{
position: fixed; position: fixed;
top: 0; top: 50%;
text-align: center; text-align: center;
left: 0; left: 0;
width: 100%; width: 100%;
@ -29,10 +30,9 @@
</style> </style>
</head> </head>
<body> <body>
<h2 id="errorMsg">If you can read this something went wrong. Oh well....</h2> <h2 id="errorMsg">If you can read this something went wrong. Oh well....</h2>
<video id="videoPlayer" oncontextmenu="return false;" width="100%" height="100%" loop autoplay> <video id="videoPlayer" oncontextmenu="return false;" width="100%" height="100%" loop autoplay>
<source id="videoSource" src="" type="video/webm" oncontextmenu="return false;" width="100%" height="100%"> Your browser does not support the video tag. <source id="videoSource" type="video/webm" oncontextmenu="return false;" width="100%" height="100%"> Your browser does not support the video tag. WTF?
</video> </video>
</body> </body>
</html> </html>

View File

@ -1,11 +1,11 @@
import QtQuick 2.12 import QtQuick 2.12
import QtWebEngine 1.7 import QtWebEngine 1.8
import net.aimber.wallpaper 1.0 import net.aimber.wallpaper 1.0
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: { color: {
if(desktopProperties.color === null){ if (desktopProperties.color === null) {
return "black" return "black"
} else { } else {
return desktopProperties.color return desktopProperties.color
@ -15,6 +15,7 @@ Rectangle {
property bool canFadeIn: true property bool canFadeIn: true
Component.onCompleted: { Component.onCompleted: {
WebEngine.settings.allowRunningInsecureContent = true WebEngine.settings.allowRunningInsecureContent = true
WebEngine.settings.accelerated2dCanvasEnabled = true WebEngine.settings.accelerated2dCanvasEnabled = true
WebEngine.settings.javascriptCanOpenWindows = false WebEngine.settings.javascriptCanOpenWindows = false
@ -24,9 +25,9 @@ Rectangle {
switch (window.type) { switch (window.type) {
case Wallpaper.WallpaperType.Video: case Wallpaper.WallpaperType.Video:
webView.enabled = true
webView.url = Qt.resolvedUrl(window.getApplicationPath( webView.url = Qt.resolvedUrl(window.getApplicationPath(
) + "/index.html") ) + "/index.html")
webView.enabled = true
break break
case Wallpaper.WallpaperType.Html: case Wallpaper.WallpaperType.Html:
@ -44,7 +45,6 @@ Rectangle {
} }
function fadeIn() { function fadeIn() {
window.setVisible(true) window.setVisible(true)
if (canFadeIn) { if (canFadeIn) {
animFadeIn.start() animFadeIn.start()
@ -53,31 +53,34 @@ Rectangle {
} }
} }
Loader {
id: loader
anchors.fill: parent
}
WebEngineView { WebEngineView {
id: webView id: webView
enabled: true enabled: false
anchors.fill: parent anchors.fill: parent
onLoadProgressChanged: { onLoadProgressChanged: {
if (loadProgress === 100) { if (loadProgress === 100) {
var src = "" var src = ""
src += "var videoPlayer = document.getElementById('videoPlayer');" src += "var videoPlayer = document.getElementById('videoPlayer');"
src += "var videoSource = document.getElementById('videoSource');" src += "var videoSource = document.getElementById('videoSource');"
src += "videoSource.src = 'file:///" + window.fullContentPath + "';" src += "videoSource.src = '" + window.fullContentPath + "';"
src += "videoPlayer.load();" src += "videoPlayer.load();"
src += "videoPlayer.volume = " + window.volume + ";" src += "videoPlayer.volume = " + window.volume + ";"
src += "videoPlayer.play();" src += "videoPlayer.play();"
webView.runJavaScript(src, function () { webView.runJavaScript(src, function (result) {
fadeIn() fadeIn()
}) })
} }
} }
}
Loader { onJavaScriptConsoleMessage: print(lineNumber, message)
id: loader
anchors.fill: parent
source: "qrc:/test.qml"
} }
OpacityAnimator { OpacityAnimator {
@ -171,5 +174,4 @@ Rectangle {
} }
} }
} }
} }

View File

@ -103,7 +103,7 @@ public slots:
} }
void setVolume(float volume) void setVolume(float volume)
{ {
qWarning("Floating point comparison needs context sanity check");
if (qFuzzyCompare(m_volume, volume)) if (qFuzzyCompare(m_volume, volume))
return; return;

View File

@ -60,7 +60,7 @@ WinWindow::WinWindow(QVector<int>& activeScreensList, QString projectPath, QStri
m_window.setSource(QUrl("qrc:/mainWindow.qml")); m_window.setSource(QUrl("qrc:/mainWindow.qml"));
// Let QML decide when were are read to show the window // Let QML decide when were are read to show the window
//ShowWindow(m_windowHandle, SW_HIDE); ShowWindow(m_windowHandle, SW_HIDE);
} }