notifs: put different icon representations in loaders

This commit is contained in:
end-4
2025-05-14 21:36:28 +02:00
parent c3c581fcaa
commit 2339eda157
@@ -208,8 +208,10 @@ Item {
} }
} }
DropShadow { Loader {
visible: popup active: popup
anchors.fill: notificationBackground
sourceComponent: DropShadow {
id: notificationShadow id: notificationShadow
anchors.fill: notificationBackground anchors.fill: notificationBackground
source: notificationBackground source: notificationBackground
@@ -220,6 +222,7 @@ Item {
horizontalOffset: 0 horizontalOffset: 0
} }
} }
}
Item { Item {
@@ -274,8 +277,11 @@ Item {
Layout.fillWidth: false Layout.fillWidth: false
radius: Appearance.rounding.full radius: Appearance.rounding.full
color: Appearance.m3colors.m3secondaryContainer color: Appearance.m3colors.m3secondaryContainer
MaterialSymbol { Loader {
visible: notificationObject.appIcon == "" id: materialSymbolLoader
active: notificationObject.appIcon == ""
anchors.fill: parent
sourceComponent: MaterialSymbol {
text: { text: {
const defaultIcon = NotificationUtils.findSuitableMaterialSymbol("") const defaultIcon = NotificationUtils.findSuitableMaterialSymbol("")
const guessedIcon = NotificationUtils.findSuitableMaterialSymbol(notificationObject.summary) const guessedIcon = NotificationUtils.findSuitableMaterialSymbol(notificationObject.summary)
@@ -290,19 +296,25 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
IconImage { }
visible: notificationObject.image == "" && notificationObject.appIcon != "" Loader {
id: appIconLoader
active: notificationObject.image == "" && notificationObject.appIcon != ""
anchors.centerIn: parent anchors.centerIn: parent
sourceComponent: IconImage {
implicitSize: 33 implicitSize: 33
asynchronous: true asynchronous: true
source: Quickshell.iconPath(notificationObject.appIcon) source: Quickshell.iconPath(notificationObject.appIcon)
} }
Item { }
Loader {
id: notifImageLoader
active: notificationObject.image != ""
anchors.fill: parent
sourceComponent: Item {
anchors.fill: parent anchors.fill: parent
visible: notificationObject.image != ""
Image { Image {
id: notifImage id: notifImage
anchors.fill: parent anchors.fill: parent
readonly property int size: parent.width readonly property int size: parent.width
@@ -326,16 +338,20 @@ Item {
} }
} }
} }
IconImage { Loader {
visible: notificationObject.appIcon != "" id: notifImageAppIconLoader
active: notificationObject.appIcon != ""
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
sourceComponent: IconImage {
implicitSize: 23 implicitSize: 23
asynchronous: true asynchronous: true
source: Quickshell.iconPath(notificationObject.appIcon) source: Quickshell.iconPath(notificationObject.appIcon)
} }
} }
} }
}
}
ColumnLayout { // Notification content ColumnLayout { // Notification content
spacing: 0 spacing: 0