1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Move all qml files from all project into qml subfolder

This makes the build script easier
This commit is contained in:
Elias Steurer 2021-08-14 13:38:24 +02:00
parent 538889465d
commit bb5e753291
14 changed files with 66 additions and 61 deletions

View File

@ -1,12 +1,12 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>Wallpaper.qml</file>
<file>Test.qml</file>
<file>dot.png</file> <file>dot.png</file>
<file>qtquickcontrols2.conf</file> <file>qtquickcontrols2.conf</file>
<file>WebView.qml</file>
<file>index.html</file> <file>index.html</file>
<file>GifWallpaper.qml</file> <file>qml/GifWallpaper.qml</file>
<file>WebsiteWallpaper.qml</file> <file>qml/Test.qml</file>
<file>qml/Wallpaper.qml</file>
<file>qml/WebsiteWallpaper.qml</file>
<file>qml/WebView.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -14,10 +14,10 @@ Rectangle {
function init() { function init() {
switch (Wallpaper.type) { switch (Wallpaper.type) {
case InstalledType.VideoWallpaper: case InstalledType.VideoWallpaper:
loader.source = "qrc:/WebView.qml"; loader.source = "qrc:/qml/WebView.qml";
break; break;
case InstalledType.HTMLWallpaper: case InstalledType.HTMLWallpaper:
loader.setSource("qrc:/WebView.qml", { loader.setSource("qrc:/qml/WebView.qml", {
"url": Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) "url": Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
}); });
break; break;
@ -26,13 +26,13 @@ Rectangle {
fadeIn(); fadeIn();
break; break;
case InstalledType.WebsiteWallpaper: case InstalledType.WebsiteWallpaper:
loader.setSource("qrc:/WebsiteWallpaper.qml", { loader.setSource("qrc:/qml/WebsiteWallpaper.qml", {
"url": Wallpaper.projectSourceFileAbsolute "url": Wallpaper.projectSourceFileAbsolute
}); });
fadeIn(); fadeIn();
break; break;
case InstalledType.GifWallpaper: case InstalledType.GifWallpaper:
loader.setSource("qrc:/GifWallpaper.qml", { loader.setSource("qrc:/qml/GifWallpaper.qml", {
"source": Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) "source": Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
}); });
fadeIn(); fadeIn();
@ -96,7 +96,7 @@ Rectangle {
return ; return ;
imgCover.state = "showDefaultBackgroundImage"; imgCover.state = "showDefaultBackgroundImage";
loader.source = "qrc:/WebView.qml"; loader.source = "qrc:/qml/WebView.qml";
} }
target: Wallpaper target: Wallpaper

View File

@ -8,31 +8,31 @@ Item {
property alias url: webView.url property alias url: webView.url
signal requestFadeIn() signal requestFadeIn
function getSetVideoCommand() { function getSetVideoCommand() {
// TODO 30: // TODO 30:
// Currently wont work. Commit anyways til QtCreator and Qt work with js template literals // Currently wont work. Commit anyways til QtCreator and Qt work with js template literals
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 = '" + Wallpaper.projectSourceFileAbsolute + "';"; src += "videoSource.src = '" + Wallpaper.projectSourceFileAbsolute + "';"
src += "videoPlayer.load();"; src += "videoPlayer.load();"
src += "videoPlayer.volume = " + Wallpaper.volume + ";"; src += "videoPlayer.volume = " + Wallpaper.volume + ";"
src += "videoPlayer.setAttribute('style', 'object-fit :" + Wallpaper.fillMode + ";');"; src += "videoPlayer.setAttribute('style', 'object-fit :" + Wallpaper.fillMode + ";');"
src += "videoPlayer.play();"; src += "videoPlayer.play();"
return src; return src
} }
Component.onCompleted: { Component.onCompleted: {
WebEngine.settings.localContentCanAccessFileUrls = true; WebEngine.settings.localContentCanAccessFileUrls = true
WebEngine.settings.localContentCanAccessRemoteUrls = true; WebEngine.settings.localContentCanAccessRemoteUrls = true
WebEngine.settings.allowRunningInsecureContent = true; WebEngine.settings.allowRunningInsecureContent = true
WebEngine.settings.accelerated2dCanvasEnabled = true; WebEngine.settings.accelerated2dCanvasEnabled = true
WebEngine.settings.javascriptCanOpenWindows = false; WebEngine.settings.javascriptCanOpenWindows = false
WebEngine.settings.showScrollBars = false; WebEngine.settings.showScrollBars = false
WebEngine.settings.playbackRequiresUserGesture = false; WebEngine.settings.playbackRequiresUserGesture = false
WebEngine.settings.focusOnNavigationEnabled = true; WebEngine.settings.focusOnNavigationEnabled = true
} }
WebEngineView { WebEngineView {
@ -45,18 +45,18 @@ Item {
onLoadProgressChanged: { onLoadProgressChanged: {
if ((loadProgress === 100)) { if ((loadProgress === 100)) {
if (Wallpaper.type === InstalledType.VideoWallpaper) if (Wallpaper.type === InstalledType.VideoWallpaper)
webView.runJavaScript(root.getSetVideoCommand(), function(result) { webView.runJavaScript(root.getSetVideoCommand(),
requestFadeIn(); function (result) {
}); requestFadeIn()
})
else else
requestFadeIn(); requestFadeIn()
} }
} }
} }
Text { Text {
id: txtVisualsPaused id: txtVisualsPaused
text: qsTr("If you can read this, then the VisualsPaused optimization does not work on your system. You can fix this by disable this in: \n Settings -> Perfromance -> Pause wallpaper video rendering while another app is in the foreground ") text: qsTr("If you can read this, then the VisualsPaused optimization does not work on your system. You can fix this by disable this in: \n Settings -> Perfromance -> Pause wallpaper video rendering while another app is in the foreground ")
font.pointSize: 32 font.pointSize: 32
visible: false visible: false
@ -73,77 +73,82 @@ Item {
interval: 300 interval: 300
onTriggered: { onTriggered: {
webView.visible = !Wallpaper.visualsPaused; webView.visible = !Wallpaper.visualsPaused
txtVisualsPaused.visible = Wallpaper.visualsPaused; txtVisualsPaused.visible = Wallpaper.visualsPaused
} }
} }
Connections { Connections {
function onReloadVideo(oldType) { function onReloadVideo(oldType) {
webView.runJavaScript(root.getSetVideoCommand()); webView.runJavaScript(root.getSetVideoCommand())
} }
function onQmlExit() { function onQmlExit() {
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;")
} }
function onMutedChanged(muted) { function onMutedChanged(muted) {
if (muted) if (muted)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;")
else else
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + Wallpaper.volume + ";"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + Wallpaper.volume + ";")
} }
function onFillModeChanged(fillMode) { function onFillModeChanged(fillMode) {
if (webView.loadProgress === 100) if (webView.loadProgress === 100)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.setAttribute('style', 'object-fit :" + fillMode + ";');"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.setAttribute('style', 'object-fit :" + fillMode + ";');")
} }
function onLoopsChanged(loops) { function onLoopsChanged(loops) {
if (webView.loadProgress === 100) if (webView.loadProgress === 100)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.loop = " + loops + ";"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.loop = " + loops + ";")
} }
function onVolumeChanged(volume) { function onVolumeChanged(volume) {
if (webView.loadProgress === 100) if (webView.loadProgress === 100)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";")
} }
function onCurrentTimeChanged(currentTime) { function onCurrentTimeChanged(currentTime) {
if (webView.loadProgress === 100) if (webView.loadProgress === 100)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.currentTime = " + currentTime + " * videoPlayer.duration;"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.currentTime = "
+ currentTime + " * videoPlayer.duration;")
} }
function onPlaybackRateChanged(playbackRate) { function onPlaybackRateChanged(playbackRate) {
if (webView.loadProgress === 100) if (webView.loadProgress === 100)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";")
} }
function onVisualsPausedChanged(visualsPaused) { function onVisualsPausedChanged(visualsPaused) {
if (visualsPaused) { if (visualsPaused) {
// Wait until Wallpaper animation is finsihed // Wait until Wallpaper animation is finsihed
timerCover.restart(); timerCover.restart()
} else { } else {
webView.visible = true; webView.visible = true
txtVisualsPaused.visible = false; txtVisualsPaused.visible = false
} }
} }
function onIsPlayingChanged(isPlaying) { function onIsPlayingChanged(isPlaying) {
if (webView.loadProgress === 100) { if (webView.loadProgress === 100) {
if (isPlaying) if (isPlaying)
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.play();"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.play();")
else else
webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.pause();"); webView.runJavaScript(
"var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.pause();")
} }
} }
target: Wallpaper target: Wallpaper
} }
} }

View File

@ -55,7 +55,7 @@ BaseWindow::BaseWindow(
if (projectFilePath == "test") { if (projectFilePath == "test") {
setType(ScreenPlay::InstalledType::InstalledType::QMLWallpaper); setType(ScreenPlay::InstalledType::InstalledType::QMLWallpaper);
setProjectSourceFileAbsolute({ "qrc:/Test.qml" }); setProjectSourceFileAbsolute({ "qrc:/qml/Test.qml" });
setupLiveReloading(); setupLiveReloading();
return; return;
} }

View File

@ -483,7 +483,7 @@ void WinWindow::configureWindowGeometry()
// we can set it here once :) // we can set it here once :)
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView); m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
m_window.setSource(QUrl("qrc:/Wallpaper.qml")); m_window.setSource(QUrl("qrc:/qml/Wallpaper.qml"));
m_window.hide(); m_window.hide();
} }

View File

@ -1,10 +1,10 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>assets/image/noisy-texture-3.png</file> <file>assets/image/noisy-texture-3.png</file>
<file>test.qml</file>
<file>Widget.qml</file>
<file>assets/icons/baseline-close-24px.svg</file> <file>assets/icons/baseline-close-24px.svg</file>
<file>assets/icons/baseline-opacity-24px.svg</file> <file>assets/icons/baseline-opacity-24px.svg</file>
<file>assets/icons/baseline-settings-20px.svg</file> <file>assets/icons/baseline-settings-20px.svg</file>
<file>qml/Test.qml</file>
<file>qml/Widget.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -49,7 +49,7 @@ WidgetWindow::WidgetWindow(
#endif #endif
if (projectPath == "test") { if (projectPath == "test") {
setProjectSourceFileAbsolute({ "qrc:/test.qml" }); setProjectSourceFileAbsolute({ "qrc:/qml/Test.qml" });
setType(ScreenPlay::InstalledType::InstalledType::QMLWidget); setType(ScreenPlay::InstalledType::InstalledType::QMLWidget);
} else { } else {
setProjectPath(projectPath); setProjectPath(projectPath);
@ -71,7 +71,7 @@ WidgetWindow::WidgetWindow(
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
m_window.setResizeMode(QQuickView::ResizeMode::SizeViewToRootObject); m_window.setResizeMode(QQuickView::ResizeMode::SizeViewToRootObject);
m_window.setSource(QUrl("qrc:/Widget.qml")); m_window.setSource(QUrl("qrc:/qml/Widget.qml"));
m_window.setPosition(m_position); m_window.setPosition(m_position);
m_window.show(); m_window.show();