#pragma once #include #include #include #include #include #include #include #include "../../core/model.hpp" #include "notification.hpp" namespace qs::service::notifications { struct NotificationServerSupport { bool persistence = false; bool body = true; bool bodyMarkup = false; bool bodyHyperlinks = false; bool bodyImages = false; bool actions = false; bool actionIcons = false; bool image = false; QVector extraHints; }; class NotificationServer: public QObject { Q_OBJECT; public: static NotificationServer* instance(); void switchGeneration(bool reEmit, const std::function& clearHook); ObjectModel* trackedNotifications(); void deleteNotification(Notification* notification, NotificationCloseReason::Enum reason); // NOLINTBEGIN void CloseNotification(uint id); QStringList GetCapabilities() const; static QString GetServerInformation(QString& vendor, QString& version, QString& specVersion); uint Notify( const QString& appName, uint replacesId, const QString& appIcon, const QString& summary, const QString& body, const QStringList& actions, const QVariantMap& hints, int expireTimeout ); // NOLINTEND NotificationServerSupport support; signals: void notification(Notification* notification); // NOLINTBEGIN void NotificationClosed(quint32 id, quint32 reason); void ActionInvoked(quint32 id, QString action); // NOLINTEND private slots: void onServiceUnregistered(const QString& service); private: explicit NotificationServer(); static void tryRegister(); QDBusServiceWatcher serviceWatcher; quint32 nextId = 1; QHash idMap; ObjectModel mNotifications {this}; }; } // namespace qs::service::notifications