1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12:50 -05:00

fix: Notification grouped image clipping

This commit is contained in:
purian23
2025-09-21 21:12:25 -04:00
parent a3b3e49313
commit ceae254160

View File

@@ -377,26 +377,19 @@ Rectangle {
anchors.margins: 12 anchors.margins: 12
anchors.bottomMargin: 8 anchors.bottomMargin: 8
Rectangle { DankCircularImage {
id: messageIcon id: messageIcon
readonly property bool hasNotificationImage: modelData?.image && modelData.image !== "" readonly property bool hasNotificationImage: modelData?.image && modelData.image !== ""
width: 32 width: 48
height: 32 height: 48
radius: 16
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 32 anchors.topMargin: 32
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
border.width: 1
IconImage { imageSource: {
anchors.fill: parent if (hasNotificationImage)
anchors.margins: 1
source: {
if (parent.hasNotificationImage)
return modelData.cleanImage return modelData.cleanImage
if (modelData?.appIcon) { if (modelData?.appIcon) {
@@ -408,36 +401,22 @@ Rectangle {
} }
return "" return ""
} }
asynchronous: true
visible: status === Image.Ready
Component.onCompleted: { fallbackIcon: {
backer.sourceSize.width = 64 if (modelData?.appIcon && !hasNotificationImage) {
backer.sourceSize.height = 64 const appIcon = modelData.appIcon
if (!appIcon.startsWith("file://") && !appIcon.startsWith("http://") && !appIcon.startsWith("https://"))
return appIcon
} }
return "notifications"
} }
Rectangle { fallbackText: {
anchors.fill: parent if (!hasNotificationImage && (!modelData?.appIcon || modelData.appIcon === "")) {
anchors.margins: -1
radius: width / 2
color: "transparent"
border.color: root.color
border.width: 3
visible: parent.hasNotificationImage
antialiasing: true
}
StyledText {
anchors.centerIn: parent
visible: !parent.hasNotificationImage && (!modelData?.appIcon || modelData.appIcon === "")
text: {
const appName = modelData?.appName || "?" const appName = modelData?.appName || "?"
return appName.charAt(0).toUpperCase() return appName.charAt(0).toUpperCase()
} }
font.pixelSize: 12 return ""
font.weight: Font.Bold
color: Theme.primaryText
} }
} }