ukui-notification/libukui-notification/notification-client.h

45 lines
1.3 KiB
C
Raw Normal View History

2023-02-03 18:01:06 +08:00
//
// Created by zpf on 23-2-2.
//
#ifndef UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H
#define UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H
#include "ukui-notification_global.h"
#include <QObject>
2023-02-06 17:03:12 +08:00
#include "popup-notification.h"
2023-02-03 18:01:06 +08:00
namespace UkuiNotification {
class NotificationClientPrivate;
class UKUINOTIFICATION_EXPORT NotificationClient : public QObject
{
Q_OBJECT
public:
2023-02-06 17:03:12 +08:00
/**
* The reason a notification was closed
*/
2023-02-06 17:03:12 +08:00
enum CloseReason {
Expired = 1, // The notification expired(timed out).
DismissedByUser = 2, // The notification was dismissed by the user.
Revoked = 3, //< The notification was closed by sender by a call to CloseNotification.
Undefined = 4, //Undefined/reserved reasons.
};
Q_ENUM(CloseReason)
explicit NotificationClient(QObject *parent);
~NotificationClient();
/**
*
* @return ture- false
*/
2023-02-03 18:01:06 +08:00
bool registerClient();
2023-02-06 17:03:12 +08:00
void closeNotification(uint id, CloseReason reason);
2023-02-14 17:21:09 +08:00
void invokeAction(uint id, const QString &action_key);
2023-02-06 17:03:12 +08:00
Q_SIGNALS:
void newNotification(const PopupNotification &notification);
void notificationClosed(uint id, CloseReason closeReason);
2023-02-03 18:01:06 +08:00
private:
NotificationClientPrivate *d = nullptr;
};
} // UkuiNotification
#endif //UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H