33#include < utility>
44
55#include < qcontainerfwd.h>
6+ #include < qlist.h>
67#include < qmap.h>
78#include < qobject.h>
89#include < qqmlintegration.h>
@@ -80,18 +81,18 @@ class Notification
8081 // / if @@NotificationServer.keepOnReload is true.
8182 Q_PROPERTY (bool lastGeneration READ isLastGeneration CONSTANT);
8283 // / Time in seconds the notification should be valid for
83- Q_PROPERTY (qreal expireTimeout READ expireTimeout NOTIFY expireTimeoutChanged);
84+ Q_PROPERTY (qreal expireTimeout READ expireTimeout NOTIFY expireTimeoutChanged BINDABLE bindableExpireTimeout );
8485 // / The sending application's name.
85- Q_PROPERTY (QString appName READ appName NOTIFY appNameChanged);
86+ Q_PROPERTY (QString appName READ appName NOTIFY appNameChanged BINDABLE bindableAppName );
8687 // / The sending application's icon. If none was provided, then the icon from an associated
8788 // / desktop entry will be retrieved. If none was found then "".
88- Q_PROPERTY (QString appIcon READ appIcon NOTIFY appIconChanged);
89+ Q_PROPERTY (QString appIcon READ appIcon NOTIFY appIconChanged BINDABLE bindableAppIcon );
8990 // / The image associated with this notification, or "" if none.
90- Q_PROPERTY (QString summary READ summary NOTIFY summaryChanged);
91- Q_PROPERTY (QString body READ body NOTIFY bodyChanged);
92- Q_PROPERTY (qs::service::notifications::NotificationUrgency::Enum urgency READ urgency NOTIFY urgencyChanged);
91+ Q_PROPERTY (QString summary READ summary NOTIFY summaryChanged BINDABLE bindableSummary );
92+ Q_PROPERTY (QString body READ body NOTIFY bodyChanged BINDABLE bindableBody );
93+ Q_PROPERTY (qs::service::notifications::NotificationUrgency::Enum urgency READ urgency NOTIFY urgencyChanged BINDABLE bindableUrgency );
9394 // / Actions that can be taken for this notification.
94- Q_PROPERTY (QVector <qs::service::notifications::NotificationAction*> actions READ actions NOTIFY actionsChanged);
95+ Q_PROPERTY (QList <qs::service::notifications::NotificationAction*> actions READ actions NOTIFY actionsChanged);
9596 // / If actions associated with this notification have icons available.
9697 // /
9798 // / See @@NotificationAction.identifier for details.
@@ -136,15 +137,29 @@ class Notification
136137 void close (NotificationCloseReason::Enum reason);
137138
138139 [[nodiscard]] quint32 id () const ;
139-
140140 [[nodiscard]] bool isTracked () const ;
141- [[nodiscard]] NotificationCloseReason::Enum closeReason () const ;
142- void setTracked (bool tracked);
143141
144142 [[nodiscard]] bool isLastGeneration () const ;
145143 void setLastGeneration ();
146144
147- [[nodiscard]] QString image () const ;
145+ QS_BINDABLE_GETTER (qreal, bExpireTimeout, expireTimeout, bindableExpireTimeout);
146+ QS_BINDABLE_GETTER (QString, bAppName, appName, bindableAppName);
147+ QS_BINDABLE_GETTER (QString, bAppIcon, appIcon, bindableAppIcon);
148+ QS_BINDABLE_GETTER (QString, bSummary, summary, bindableSummary);
149+ QS_BINDABLE_GETTER (QString, bBody, body, bindableBody);
150+ QS_BINDABLE_GETTER (NotificationUrgency::Enum, bUrgency, urgency, bindableUrgency);
151+
152+ [[nodiscard]] QList<NotificationAction*> actions () const ;
153+
154+ QS_BINDABLE_GETTER (bool , bHasActionIcons, hasActionIcons, bindableHasActionIcons);
155+ QS_BINDABLE_GETTER (bool , bResident, resident, bindableResident);
156+ QS_BINDABLE_GETTER (bool , bTransient, transient, bindableTransient);
157+ QS_BINDABLE_GETTER (QString, bDesktopEntry, desktopEntry, bindableDesktopEntry);
158+ QS_BINDABLE_GETTER (QString, bImage, image, bindableImage);
159+ QS_BINDABLE_GETTER (QVariantMap, bHints, hints, bindableHints);
160+
161+ [[nodiscard]] NotificationCloseReason::Enum closeReason () const ;
162+ void setTracked (bool tracked);
148163
149164signals:
150165 // / Sent when a notification has been closed.
@@ -171,35 +186,30 @@ class Notification
171186 quint32 mId ;
172187 NotificationCloseReason::Enum mCloseReason = NotificationCloseReason::Dismissed;
173188 bool mLastGeneration = false ;
174- qreal mExpireTimeout = 0 ;
175- QString mAppName ;
176- QString mAppIcon ;
177- QString mSummary ;
178- QString mBody ;
179- NotificationUrgency::Enum mUrgency = NotificationUrgency::Normal;
180- QVector<NotificationAction*> mActions ;
181- bool mHasActionIcons = false ;
182- bool mResident = false ;
183- bool mTransient = false ;
184- QString mImagePath ;
185189 NotificationImage* mImagePixmap = nullptr ;
186- QString mDesktopEntry ;
187- QVariantMap mHints ;
190+ QList<NotificationAction*> mActions ;
188191
189192 // clang-format off
190- DECLARE_PRIVATE_MEMBER (Notification, expireTimeout, setExpireTimeout, mExpireTimeout , expireTimeoutChanged);
191- DECLARE_PRIVATE_MEMBER (Notification, appName, setAppName, mAppName , appNameChanged);
192- DECLARE_PRIVATE_MEMBER (Notification, appIcon, setAppIcon, mAppIcon , appIconChanged);
193- DECLARE_PRIVATE_MEMBER (Notification, summary, setSummary, mSummary , summaryChanged);
194- DECLARE_PRIVATE_MEMBER (Notification, body, setBody, mBody , bodyChanged);
195- DECLARE_PRIVATE_MEMBER (Notification, urgency, setUrgency, mUrgency , urgencyChanged);
196- DECLARE_MEMBER_WITH_GET (Notification, actions, mActions , actionsChanged);
197- DECLARE_PRIVATE_MEMBER (Notification, hasActionIcons, setHasActionIcons, mHasActionIcons , hasActionIconsChanged);
198- DECLARE_PRIVATE_MEMBER (Notification, resident, setResident, mResident , residentChanged);
199- DECLARE_PRIVATE_MEMBER (Notification, transient, setTransient, mTransient , transientChanged);
200- DECLARE_PRIVATE_MEMBER (Notification, desktopEntry, setDesktopEntry, mDesktopEntry , desktopEntryChanged);
201- DECLARE_PRIVATE_MEMBER (Notification, hints, setHints, mHints , hintsChanged);
193+ Q_OBJECT_BINDABLE_PROPERTY (Notification, qreal, bExpireTimeout, &Notification::expireTimeoutChanged);
194+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QString, bAppName, &Notification::appNameChanged);
195+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QString, bAppIcon, &Notification::appIconChanged);
196+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QString, bSummary, &Notification::summaryChanged);
197+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QString, bBody, &Notification::bodyChanged);
198+ Q_OBJECT_BINDABLE_PROPERTY (Notification, bool , bHasActionIcons, &Notification::hasActionIconsChanged);
199+ Q_OBJECT_BINDABLE_PROPERTY (Notification, bool , bResident, &Notification::residentChanged);
200+ Q_OBJECT_BINDABLE_PROPERTY (Notification, bool , bTransient, &Notification::transientChanged);
201+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QString, bDesktopEntry, &Notification::desktopEntryChanged);
202+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QString, bImage, &Notification::imageChanged);
203+ Q_OBJECT_BINDABLE_PROPERTY (Notification, QVariantMap, bHints, &Notification::hintsChanged);
202204 // clang-format on
205+
206+ Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS (
207+ Notification,
208+ NotificationUrgency::Enum,
209+ bUrgency,
210+ NotificationUrgency::Normal,
211+ &Notification::urgencyChanged
212+ );
203213};
204214
205215// /! An action associated with a Notification.
0 commit comments