Update: Added the ability to set videos as wallpapers.

This commit is contained in:
Keyitdev
2024-12-31 23:17:00 +01:00
parent ba024e7fcd
commit 8a6ed165c2
+31 -1
View File
@@ -7,6 +7,7 @@ import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Effects
import QtMultimedia
import "Components"
@@ -179,9 +180,25 @@ Pane {
]
}
AnimatedImage {
id: backgroundImage
MediaPlayer {
id: player
videoOutput: videoOutput
autoPlay: true
loops: -1
}
VideoOutput {
id: videoOutput
fillMode: config.CropBackground == "true" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
anchors.fill: parent
}
height: parent.height
width: config.HaveFormBackground == "true" && config.FormPosition != "center" && config.PartialBlur != "true" ? parent.width - formBackground.width : parent.width
anchors.left: leftleft || leftcenter ? formBackground.right : undefined
@@ -198,12 +215,25 @@ Pane {
Image.AlignBottom : Image.AlignVCenter
speed: config.BackgroundSpeed == "" ? 1.0 : config.BackgroundSpeed
source: config.background || config.Background
source: config.BackgroundPlaceholder
paused: config.PauseBackground == "true" ? 1 : 0
fillMode: config.CropBackground == "true" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
asynchronous: true
cache: true
clip: true
mipmap: true
Component.onCompleted:{
var fileType = config.Background.substring(config.Background.lastIndexOf(".") + 1)
if (fileType === "mp4" || fileType === "mov" || fileType === "avi" || fileType === "webm") {
player.source = Qt.resolvedUrl(config.Background)
player.play();
}
else{
backgroundImage.source = config.background || config.Background
}
}
}
MouseArea {