mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Fix Html wallpaper
This commit is contained in:
parent
9930fb63b6
commit
a9c29494ac
@ -1,9 +1,11 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import ScreenPlay.Wallpaper 1.0
|
|
||||||
import QtWebEngine 1.8
|
import QtWebEngine 1.8
|
||||||
|
|
||||||
|
import ScreenPlay.Wallpaper 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property string url: webView.url
|
id:root
|
||||||
|
property alias url: webView.url
|
||||||
|
|
||||||
signal requestFadeIn()
|
signal requestFadeIn()
|
||||||
|
|
||||||
@ -21,28 +23,32 @@ Item {
|
|||||||
id: webView
|
id: webView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
url: Qt.resolvedUrl(window.getApplicationPath() + "/index.html")
|
url: Qt.resolvedUrl(window.getApplicationPath() + "/index.html")
|
||||||
|
onUrlChanged: print(url)
|
||||||
|
onJavaScriptConsoleMessage: print(lineNumber, message)
|
||||||
onLoadProgressChanged: {
|
onLoadProgressChanged: {
|
||||||
if (loadProgress === 100) {
|
if ((loadProgress === 100)) {
|
||||||
|
|
||||||
// TODO 30:
|
if(window.type === Wallpaper.WallpaperType.Video){
|
||||||
// Currently wont work. Commit anyways til QtCreator and Qt work with js template literals
|
// TODO 30:
|
||||||
var src = ""
|
// Currently wont work. Commit anyways til QtCreator and Qt work with js template literals
|
||||||
src += "var videoPlayer = document.getElementById('videoPlayer');"
|
var src = ""
|
||||||
src += "var videoSource = document.getElementById('videoSource');"
|
src += "var videoPlayer = document.getElementById('videoPlayer');"
|
||||||
src += "videoSource.src = '" + window.fullContentPath + "';"
|
src += "var videoSource = document.getElementById('videoSource');"
|
||||||
src += "videoPlayer.load();"
|
src += "videoSource.src = '" + window.fullContentPath + "';"
|
||||||
src += "videoPlayer.volume = " + window.volume + ";"
|
src += "videoPlayer.load();"
|
||||||
src += "videoPlayer.setAttribute('style', 'object-fit :" + window.fillMode + ";');"
|
src += "videoPlayer.volume = " + window.volume + ";"
|
||||||
src += "videoPlayer.play();"
|
src += "videoPlayer.setAttribute('style', 'object-fit :" + window.fillMode + ";');"
|
||||||
|
src += "videoPlayer.play();"
|
||||||
|
|
||||||
webView.runJavaScript(src, function (result) {
|
webView.runJavaScript(src, function (result) {
|
||||||
|
fadeInTimer.start()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
fadeInTimer.start()
|
fadeInTimer.start()
|
||||||
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onJavaScriptConsoleMessage: print(lineNumber, message)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
@ -38,15 +38,14 @@ Rectangle {
|
|||||||
switch (window.type) {
|
switch (window.type) {
|
||||||
case Wallpaper.WallpaperType.Video:
|
case Wallpaper.WallpaperType.Video:
|
||||||
loader.source = "qrc:/WebView.qml"
|
loader.source = "qrc:/WebView.qml"
|
||||||
|
|
||||||
break
|
break
|
||||||
case Wallpaper.WallpaperType.Html:
|
case Wallpaper.WallpaperType.Html:
|
||||||
loader.source = "qrc:/WebView.qml"
|
|
||||||
loader.webViewUrl = Qt.resolvedUrl(window.fullContentPath)
|
loader.webViewUrl = Qt.resolvedUrl(window.fullContentPath)
|
||||||
|
loader.source = "qrc:/WebView.qml"
|
||||||
break
|
break
|
||||||
case Wallpaper.WallpaperType.ThreeJSScene:
|
case Wallpaper.WallpaperType.ThreeJSScene:
|
||||||
loader.source = "qrc:/WebView.qml"
|
|
||||||
loader.webViewUrl = Qt.resolvedUrl(window.fullContentPath)
|
loader.webViewUrl = Qt.resolvedUrl(window.fullContentPath)
|
||||||
|
loader.source = "qrc:/WebView.qml"
|
||||||
break
|
break
|
||||||
case Wallpaper.WallpaperType.Qml:
|
case Wallpaper.WallpaperType.Qml:
|
||||||
loader.source = Qt.resolvedUrl(window.fullContentPath)
|
loader.source = Qt.resolvedUrl(window.fullContentPath)
|
||||||
@ -56,9 +55,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fadeIn() {
|
function fadeIn() {
|
||||||
print("fadeIn()")
|
|
||||||
window.setVisible(true)
|
window.setVisible(true)
|
||||||
print("setVisible()")
|
|
||||||
if (canFadeByWallpaperFillMode && window.canFade) {
|
if (canFadeByWallpaperFillMode && window.canFade) {
|
||||||
print("fadein")
|
print("fadein")
|
||||||
imgCover.state = "out"
|
imgCover.state = "out"
|
||||||
@ -75,8 +72,10 @@ Rectangle {
|
|||||||
property string webViewUrl
|
property string webViewUrl
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (loader.status === Loader.Ready) {
|
if (loader.status === Loader.Ready) {
|
||||||
if (window.type === Wallpaper.WallpaperType.Video) {
|
if (window.type === Wallpaper.WallpaperType.Html
|
||||||
|
|| window.type === Wallpaper.WallpaperType.ThreeJSScene) {
|
||||||
loader.item.url = loader.webViewUrl
|
loader.item.url = loader.webViewUrl
|
||||||
|
print(loader.item.url," --- ",loader.webViewUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +83,7 @@ Rectangle {
|
|||||||
Connections {
|
Connections {
|
||||||
ignoreUnknownSignals: true
|
ignoreUnknownSignals: true
|
||||||
target: loader.item
|
target: loader.item
|
||||||
onRequestFadeIn:fadeIn()
|
onRequestFadeIn: fadeIn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user