1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-23 03:02:30 +01:00

Restore qml wallpaper functionality

This commit is contained in:
kelteseth 2018-09-06 15:54:55 +02:00
parent 300f98aff0
commit c7e5f1f722
2 changed files with 39 additions and 24 deletions

View File

@ -10,20 +10,16 @@ Rectangle {
Connections {
target: mainwindow
onPlayVideo: {
}
onPlayQmlScene: {
}
onFillModeChanged: {
}
onLoopsChanged: {
}
onTypeChanged: {
print(mainwindow.type)
}
onVolumeChanged: {
if (webView.loadProgress === 100) {
webView.runJavaScript(
@ -43,36 +39,55 @@ Rectangle {
}
}
Component.onCompleted: {
if (mainwindow.type === "qmlScene") {
loader.setSource(Qt.resolvedUrl(
"file:///" + mainwindow.fullContentPath))
print("LOADING QMLSCENE" + loader.source)
mainwindow.init()
timer.start()
} else if (mainwindow.type === "video") {
webView.visible = true
webView.url = Qt.resolvedUrl("file:///" + mainwindow.getApplicationPath(
) + "/index.html")
}
}
WebEngineView {
id: webView
anchors.fill: parent
url: Qt.resolvedUrl("file:///" + mainwindow.getApplicationPath(
) + "/index.html")
visible: false
onLoadProgressChanged: {
if (loadProgress === 100) {
runJavaScript(("
var videoPlayer = document.getElementById('videoPlayer');
var videoSource = document.getElementById('videoSource');
videoSource.src = \"file:///" + mainwindow.fullContentPath + "\";
videoPlayer.load();
videoPlayer.volume = " + mainwindow.volume + ";"),
function (result) {
mainwindow.init()
timer.start()
})
var videoPlayer = document.getElementById('videoPlayer');
var videoSource = document.getElementById('videoSource');
videoSource.src = \"file:///" + mainwindow.fullContentPath + "\";
videoPlayer.load();
videoPlayer.volume = " + mainwindow.volume + ";"), function (result) {
mainwindow.init()
timer.start()
})
}
}
onJavaScriptConsoleMessage: print(message)
settings.allowRunningInsecureContent: true
}
Loader {
id: loader
anchors.fill: parent
onStatusChanged: {
print(webViewWrapper.errorString())
}
}
Timer {
id: timer
interval: 200
onTriggered: {
curtain.opacity = 0
anim.start()
print("start")
}
}

View File

@ -59,13 +59,13 @@ MainWindow::MainWindow(int i, QString projectPath, QString id, QString decoder,
if (m_project.value("type") == "video") {
QString tmpPath = m_projectPath.toString() + "/" + m_projectFile;
setFullContentPath(tmpPath);
emit playVideo(tmpPath);
setType("video");
} else if (m_project.value("type") == "scene") {
return;
} else if (m_project.value("type") == "qmlScene") {
QString tmpPath = m_projectPath.toString() + "/" + m_projectFile;
emit playQmlScene(tmpPath);
setFullContentPath(tmpPath);
setType("qmlScene");
}
}