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

View File

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

View File

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

View File

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

View File

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