1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Fix set replace wallpaper from type video to gif

Fix some wallpaper flickering (most of)
This commit is contained in:
Elias Steurer 2021-02-19 17:21:17 +01:00
parent 6549530258
commit 322f0d7908
5 changed files with 15 additions and 14 deletions

View File

@ -36,7 +36,6 @@ Rectangle {
function onQmlSceneValueReceived(key, value) { function onQmlSceneValueReceived(key, value) {
var obj2 = 'import QtQuick 2.0; Item {Component.onCompleted: loader.item.' var obj2 = 'import QtQuick 2.0; Item {Component.onCompleted: loader.item.'
+ key + ' = ' + value + '; }' + key + ' = ' + value + '; }'
print(key, value)
var newObject = Qt.createQmlObject(obj2.toString(), root, "err") var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
newObject.destroy(10000) newObject.destroy(10000)
} }
@ -51,6 +50,11 @@ Rectangle {
loader.source = Qt.resolvedUrl(Wallpaper.fullContentPath) loader.source = Qt.resolvedUrl(Wallpaper.fullContentPath)
} }
// Replace wallpaper with GIF
function onReloadGIF(oldType) {
init()
}
// This function only gets called here (the same function // This function only gets called here (the same function
// is inside the WebView.qml) when the previous Wallpaper type // is inside the WebView.qml) when the previous Wallpaper type
// was not a video // was not a video
@ -78,7 +82,6 @@ Rectangle {
break break
case InstalledType.QMLWallpaper: case InstalledType.QMLWallpaper:
loader.source = Qt.resolvedUrl(Wallpaper.fullContentPath) loader.source = Qt.resolvedUrl(Wallpaper.fullContentPath)
print(loader.source)
break break
case InstalledType.WebsiteWallpaper: case InstalledType.WebsiteWallpaper:
loader.setSource("qrc:/WebsiteWallpaper.qml", { loader.setSource("qrc:/WebsiteWallpaper.qml", {
@ -108,7 +111,6 @@ Rectangle {
Loader { Loader {
id: loader id: loader
anchors.fill: parent anchors.fill: parent
onStatusChanged: print(status)
Connections { Connections {
ignoreUnknownSignals: true ignoreUnknownSignals: true
target: loader.item target: loader.item
@ -127,8 +129,7 @@ Rectangle {
right: parent.right right: parent.right
} }
state: "in" state: "in"
onStateChanged: print(state) onStatusChanged: print(status,source)
sourceSize.width: Wallpaper.width sourceSize.width: Wallpaper.width
sourceSize.height: Wallpaper.height sourceSize.height: Wallpaper.height
source: { source: {

View File

@ -39,27 +39,22 @@ Item {
id: webView id: webView
anchors.fill: parent anchors.fill: parent
url: "qrc:/index.html" url: "qrc:/index.html"
backgroundColor: "transparent"
onJavaScriptConsoleMessage: print(lineNumber, message) onJavaScriptConsoleMessage: print(lineNumber, message)
onLoadProgressChanged: { onLoadProgressChanged: {
if ((loadProgress === 100)) { if ((loadProgress === 100)) {
if (Wallpaper.type === InstalledType.VideoWallpaper) { if (Wallpaper.type === InstalledType.VideoWallpaper) {
webView.runJavaScript(root.getSetVideoCommand(), webView.runJavaScript(root.getSetVideoCommand(),
function (result) { function (result) {
fadeInTimer.start() requestFadeIn()
}) })
} else { } else {
fadeInTimer.start() requestFadeIn()
} }
} }
} }
} }
Timer {
id: fadeInTimer
interval: 500
onTriggered: 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 ")

View File

@ -13,7 +13,7 @@
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
overflow: hidden; overflow: hidden;
background:black; background: transparent;
} }
#errorMsg{ #errorMsg{
position: fixed; position: fixed;

View File

@ -168,6 +168,7 @@ void BaseWindow::replaceWallpaper(
setCheckWallpaperVisible(checkWallpaperVisible); setCheckWallpaperVisible(checkWallpaperVisible);
setVolume(volume); setVolume(volume);
setFillMode(fillMode); setFillMode(fillMode);
if (auto typeOpt = ScreenPlayUtil::getInstalledTypeFromString(type)) { if (auto typeOpt = ScreenPlayUtil::getInstalledTypeFromString(type)) {
setType(typeOpt.value()); setType(typeOpt.value());
} }
@ -183,6 +184,9 @@ void BaseWindow::replaceWallpaper(
if (m_type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) if (m_type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper)
emit reloadVideo(oldType); emit reloadVideo(oldType);
if (m_type == ScreenPlay::InstalledType::InstalledType::GifWallpaper)
emit reloadGIF(oldType);
} }
// Used for loading shader // Used for loading shader

View File

@ -174,6 +174,7 @@ signals:
void qmlExit(); void qmlExit();
void reloadQML(const ScreenPlay::InstalledType::InstalledType oldType); void reloadQML(const ScreenPlay::InstalledType::InstalledType oldType);
void reloadVideo(const ScreenPlay::InstalledType::InstalledType oldType); void reloadVideo(const ScreenPlay::InstalledType::InstalledType oldType);
void reloadGIF(const ScreenPlay::InstalledType::InstalledType oldType);
void loopsChanged(bool loops); void loopsChanged(bool loops);
void volumeChanged(float volume); void volumeChanged(float volume);