From 3eab1e330f791eb90941421aec0dc53195e6ae52 Mon Sep 17 00:00:00 2001 From: reionwong Date: Wed, 3 Nov 2021 17:38:58 +0800 Subject: [PATCH] Notification: add default icon --- notificationd/qml/NotificationPopup.qml | 16 +++++++++++++++- notificationd/qml/NotificationWindow.qml | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/notificationd/qml/NotificationPopup.qml b/notificationd/qml/NotificationPopup.qml index b25e31d..62bde48 100644 --- a/notificationd/qml/NotificationPopup.qml +++ b/notificationd/qml/NotificationPopup.qml @@ -85,11 +85,25 @@ Window { id: _icon width: 48 height: width - source: "image://icontheme/%1".arg(model.iconName) + source: model.iconName ? "image://icontheme/%1".arg(model.iconName) + : "" sourceSize: Qt.size(width, height) Layout.alignment: Qt.AlignVCenter antialiasing: true smooth: true + visible: status === Image.Ready + } + + Image { + id: _defaultIcon + width: 48 + height: width + source: "image://icontheme/preferences-desktop-notification" + sourceSize: Qt.size(width, height) + Layout.alignment: Qt.AlignVCenter + antialiasing: true + smooth: true + visible: !_icon.visible } ColumnLayout { diff --git a/notificationd/qml/NotificationWindow.qml b/notificationd/qml/NotificationWindow.qml index f98c703..335ca4e 100644 --- a/notificationd/qml/NotificationWindow.qml +++ b/notificationd/qml/NotificationWindow.qml @@ -181,11 +181,25 @@ Item { id: _icon width: 48 height: width - source: "image://icontheme/%1".arg(model.iconName) + source: model.iconName ? "image://icontheme/%1".arg(model.iconName) + : "" sourceSize: Qt.size(width, height) Layout.alignment: Qt.AlignVCenter antialiasing: true smooth: true + visible: status === Image.Ready + } + + Image { + id: _defaultIcon + width: 48 + height: width + source: "image://icontheme/preferences-desktop-notification" + sourceSize: Qt.size(width, height) + Layout.alignment: Qt.AlignVCenter + antialiasing: true + smooth: true + visible: !_icon.visible } ColumnLayout {