1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 08:22:33 +02:00

Fix FillMode web and Qt based fillModes

This commit is contained in:
Elias Steurer 2022-05-06 14:52:23 +02:00
parent a366fcc56a
commit 6a40f7e69d

View File

@ -7,6 +7,21 @@ Item {
anchors.fill: parent
property bool loops: Wallpaper.loops
property bool isPlaying: Wallpaper.isPlaying
property string fillMode: Wallpaper.fillMode
onFillModeChanged: {
// Convert Web based video modes to the limited Qt fillModes
if (fillMode === "cover" || fillMode === "stretch"
|| fillMode === "contain") {
return vo.fillMode = VideoOutput.Stretch
}
if (fillMode === "fill") {
return vo.fillMode = VideoOutput.PreserveAspectFit
}
if (fillMode === "scale_down") {
return vo.fillMode = VideoOutput.PreserveAspectCrop
}
}
onIsPlayingChanged: isPlaying ? mediaPlayer.play() : mediaPlayer.pause()
property bool isWindows: Qt.platform.os === "windows"
signal requestFadeIn
@ -32,7 +47,6 @@ Item {
VideoOutput {
id: vo
anchors.fill: parent
}
AudioOutput {
@ -43,15 +57,16 @@ Item {
Connections {
function onFillModeChanged(fillMode) {
if(fillMode === "stretch"){
if (fillMode === "stretch") {
vo.fillMode = VideoOutput.Stretch
return
}
if(fillMode === "fill"){
if (fillMode === "fill") {
vo.fillMode = VideoOutput.PreserveAspectFit
return
}
if(fillMode === "contain" || fillMode === "cover" || fillMode === "scale-down"){
if (fillMode === "contain" || fillMode === "cover"
|| fillMode === "scale-down") {
vo.fillMode = VideoOutput.PreserveAspectCrop
}
}
@ -60,7 +75,6 @@ Item {
mediaPlayer.position = currentTime * mediaPlayer.duration
}
target: Wallpaper
}
}