MediaCard: Spicying it up with a little blue + fallback to wallpaper display when not art available.

This commit is contained in:
ItsLemmy
2025-10-15 23:23:27 -04:00
parent d43e4ea400
commit 24a5d2ff56
+34 -30
View File
@@ -11,17 +11,39 @@ import qs.Widgets
NBox { NBox {
id: root id: root
// Background artwork that covers everything // Wrapper - rounded rect clipper
Item { Item {
anchors.fill: parent anchors.fill: parent
clip: true layer.enabled: true
layer.effect: MultiEffect {
maskEnabled: true
maskThresholdMin: 0.5
maskSpreadAtMin: 0.0
maskSource: ShaderEffectSource {
sourceItem: Rectangle {
width: root.width
height: root.height
radius: Style.radiusM
color: "white"
}
}
}
NImageRounded { // Background image that covers everything
id: bgArtImage Image {
readonly property int dim: Math.round(256 * Style.uiScaleRatio)
id: bgImage
anchors.fill: parent anchors.fill: parent
imagePath: MediaService.trackArtUrl source: MediaService.trackArtUrl || WallpaperService.getWallpaper(Screen.name)
imageRadius: Style.radiusM sourceSize: Qt.size(dim, dim)
visible: MediaService.trackArtUrl !== "" fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: MultiEffect {
blurEnabled: true
blur: 0.25
blurMax: 16
}
} }
// Dark overlay for readability // Dark overlay for readability
@@ -40,27 +62,9 @@ NBox {
border.width: 1 border.width: 1
radius: Style.radiusM radius: Style.radiusM
} }
} //}
// Background visualizer on top of the artwork
Item {
id: visualizerContainer
anchors.fill: parent
layer.enabled: true
layer.effect: MultiEffect {
maskEnabled: true
maskThresholdMin: 0.5
maskSpreadAtMin: 0.0
maskSource: ShaderEffectSource {
sourceItem: Rectangle {
width: root.width
height: root.height
radius: Style.radiusM
color: "white"
}
}
}
// Background visualizer on top of the artwork
Loader { Loader {
anchors.fill: parent anchors.fill: parent
active: Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none" active: Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none"
@@ -84,7 +88,7 @@ NBox {
anchors.fill: parent anchors.fill: parent
values: CavaService.values values: CavaService.values
fillColor: Color.mPrimary fillColor: Color.mPrimary
opacity: MediaService.trackArtUrl !== "" ? 0.5 : 0.8 opacity: 0.5
} }
} }
@@ -94,7 +98,7 @@ NBox {
anchors.fill: parent anchors.fill: parent
values: CavaService.values values: CavaService.values
fillColor: Color.mPrimary fillColor: Color.mPrimary
opacity: MediaService.trackArtUrl !== "" ? 0.5 : 0.8 opacity: 0.5
} }
} }
@@ -104,7 +108,7 @@ NBox {
anchors.fill: parent anchors.fill: parent
values: CavaService.values values: CavaService.values
fillColor: Color.mPrimary fillColor: Color.mPrimary
opacity: MediaService.trackArtUrl !== "" ? 0.5 : 0.8 opacity: 0.5
} }
} }
} }