Skip to content

Commit 00c78f3

Browse files
committed
fix: blur stacking order and disable when there are no videos
refs: #153
1 parent 20a8469 commit 00c78f3

2 files changed

Lines changed: 70 additions & 65 deletions

File tree

package/contents/ui/FadePlayer.qml

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import QtQuick
22
import QtQuick.Layouts
33
import QtMultimedia
4-
import org.kde.plasma.components as PlasmaComponents
54
import org.kde.kirigami as Kirigami
65
import "code/utils.js" as Utils
76
import "code/enum.js" as Enum
@@ -45,6 +44,8 @@ Item {
4544
property bool primaryPlayer: true
4645
property VideoPlayer player: primaryPlayer ? videoPlayer1 : videoPlayer2
4746
property VideoPlayer otherPlayer: primaryPlayer ? videoPlayer2 : videoPlayer1
47+
property VideoPlayer player1: videoPlayer1
48+
property VideoPlayer player2: videoPlayer2
4849

4950
function play() {
5051
player.play();
@@ -248,58 +249,4 @@ Item {
248249
}
249250
}
250251
}
251-
252-
ColumnLayout {
253-
visible: root.debugEnabled
254-
z: 2
255-
Item {
256-
Layout.preferredWidth: 1
257-
Layout.preferredHeight: 100
258-
}
259-
Kirigami.AbstractCard {
260-
Layout.margins: Kirigami.Units.largeSpacing
261-
contentItem: ColumnLayout {
262-
id: content
263-
PlasmaComponents.Label {
264-
text: root.player.source
265-
}
266-
PlasmaComponents.Label {
267-
text: "currentVideoIndex " + main.currentVideoIndex
268-
}
269-
PlasmaComponents.Label {
270-
text: "changeWallpaperMode " + root.changeWallpaperMode
271-
}
272-
PlasmaComponents.Label {
273-
text: "crossfade " + root.crossfadeEnabled
274-
}
275-
PlasmaComponents.Label {
276-
text: "crossfadeDuration " + root.crossfadeDuration + " (" + root.crossfadeMinDurationLast + ", " + root.crossfadeMinDurationCurrent + ")"
277-
}
278-
PlasmaComponents.Label {
279-
text: "multipleVideos " + root.multipleVideos
280-
}
281-
PlasmaComponents.Label {
282-
text: "player " + root.player.objectName
283-
}
284-
PlasmaComponents.Label {
285-
text: "media status " + root.player.mediaStatus
286-
}
287-
PlasmaComponents.Label {
288-
text: "player1 playing " + videoPlayer1.playing
289-
}
290-
PlasmaComponents.Label {
291-
text: "player2 playing " + videoPlayer2.playing
292-
}
293-
PlasmaComponents.Label {
294-
text: "position " + root.player.position
295-
}
296-
PlasmaComponents.Label {
297-
text: "duration " + root.player.duration
298-
}
299-
PlasmaComponents.Label {
300-
text: "resumeLastVideo" + root.resumeLastVideo
301-
}
302-
}
303-
}
304-
}
305252
}

package/contents/ui/main.qml

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
*/
2020

2121
import QtQuick
22+
import QtQuick.Layouts
2223
import org.kde.plasma.core as PlasmaCore
2324
import org.kde.plasma.plasma5support as P5Support
2425
import org.kde.plasma.plasmoid
2526
import Qt5Compat.GraphicalEffects
2627
import org.kde.plasma.extras as PlasmaExtras
2728
import org.kde.kirigami as Kirigami
29+
import org.kde.plasma.components as PlasmaComponents
2830
import "code/utils.js" as Utils
2931
import "code/enum.js" as Enum
3032

@@ -77,6 +79,9 @@ WallpaperItem {
7779
return (shouldPlay && !batteryPausesVideo && !screenLocked && !screenIsOff && !effectPauseVideo) || effectPlayVideo;
7880
}
7981
property bool shouldBlur: {
82+
if (videosConfig.length == 0) {
83+
return false;
84+
}
8085
let blur = false;
8186
switch (main.configuration.BlurMode) {
8287
case Enum.BlurMode.MaximizedOrFullScreen:
@@ -259,23 +264,76 @@ WallpaperItem {
259264
resumeLastVideo: main.configuration.ResumeLastVideo
260265
}
261266

267+
FastBlur {
268+
source: player
269+
radius: main.showBlur ? main.configuration.BlurRadius : 0
270+
visible: radius !== 0
271+
anchors.fill: parent
272+
Behavior on radius {
273+
NumberAnimation {
274+
duration: main.blurAnimationDuration
275+
}
276+
}
277+
}
278+
262279
PlasmaExtras.PlaceholderMessage {
263-
visible: videosConfig.length == 0
280+
visible: main.videosConfig.length == 0
264281
anchors.centerIn: parent
265282
width: parent.width - Kirigami.Units.gridUnit * 2
266283
iconName: "video-symbolic"
267284
text: i18n("No video source \n" + main.videoUrls)
268285
}
269-
}
270286

271-
FastBlur {
272-
source: player
273-
radius: showBlur ? main.configuration.BlurRadius : 0
274-
visible: radius !== 0
275-
anchors.fill: parent
276-
Behavior on radius {
277-
NumberAnimation {
278-
duration: blurAnimationDuration
287+
ColumnLayout {
288+
id: root
289+
Item {
290+
Layout.preferredWidth: 1
291+
Layout.preferredHeight: 100
292+
}
293+
Kirigami.AbstractCard {
294+
Layout.margins: Kirigami.Units.largeSpacing
295+
contentItem: ColumnLayout {
296+
id: content
297+
PlasmaComponents.Label {
298+
text: main.currentSource.filename
299+
}
300+
PlasmaComponents.Label {
301+
text: "currentVideoIndex " + main.currentVideoIndex
302+
}
303+
PlasmaComponents.Label {
304+
text: "changeWallpaperMode " + main.changeWallpaperMode
305+
}
306+
PlasmaComponents.Label {
307+
text: "crossfade " + main.crossfadeEnabled
308+
}
309+
PlasmaComponents.Label {
310+
text: "crossfadeDuration " + player.crossfadeDuration + " (" + player.crossfadeMinDurationLast + ", " + player.crossfadeMinDurationCurrent + ")"
311+
}
312+
PlasmaComponents.Label {
313+
text: "multipleVideos " + player.multipleVideos
314+
}
315+
PlasmaComponents.Label {
316+
text: "player " + player.player.objectName
317+
}
318+
PlasmaComponents.Label {
319+
text: "media status " + player.player.mediaStatus
320+
}
321+
PlasmaComponents.Label {
322+
text: "player1 playing " + player.player1.playing
323+
}
324+
PlasmaComponents.Label {
325+
text: "player2 playing " + player.player2.playing
326+
}
327+
PlasmaComponents.Label {
328+
text: "position " + player.player.position
329+
}
330+
PlasmaComponents.Label {
331+
text: "duration " + player.player.duration
332+
}
333+
PlasmaComponents.Label {
334+
text: "resumeLastVideo" + player.resumeLastVideo
335+
}
336+
}
279337
}
280338
}
281339
}

0 commit comments

Comments
 (0)