mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
fix: Notification grouped image clipping
This commit is contained in:
@@ -377,67 +377,46 @@ 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
|
return modelData.cleanImage
|
||||||
source: {
|
|
||||||
if (parent.hasNotificationImage)
|
|
||||||
return modelData.cleanImage
|
|
||||||
|
|
||||||
if (modelData?.appIcon) {
|
if (modelData?.appIcon) {
|
||||||
const appIcon = modelData.appIcon
|
const appIcon = modelData.appIcon
|
||||||
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") || appIcon.startsWith("https://"))
|
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") || appIcon.startsWith("https://"))
|
||||||
return appIcon
|
return appIcon
|
||||||
|
|
||||||
return Quickshell.iconPath(appIcon, true)
|
return Quickshell.iconPath(appIcon, true)
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
asynchronous: true
|
|
||||||
visible: status === Image.Ready
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
backer.sourceSize.width = 64
|
|
||||||
backer.sourceSize.height = 64
|
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
fallbackIcon: {
|
||||||
anchors.fill: parent
|
if (modelData?.appIcon && !hasNotificationImage) {
|
||||||
anchors.margins: -1
|
const appIcon = modelData.appIcon
|
||||||
radius: width / 2
|
if (!appIcon.startsWith("file://") && !appIcon.startsWith("http://") && !appIcon.startsWith("https://"))
|
||||||
color: "transparent"
|
return appIcon
|
||||||
border.color: root.color
|
}
|
||||||
border.width: 3
|
return "notifications"
|
||||||
visible: parent.hasNotificationImage
|
|
||||||
antialiasing: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
fallbackText: {
|
||||||
anchors.centerIn: parent
|
if (!hasNotificationImage && (!modelData?.appIcon || modelData.appIcon === "")) {
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user