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
|
|
|
/**
|
2023-02-09 13:54:53 +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-13 17:10:55 +08:00
|
|
|
void invokeAction(uint id, const QString &action_key, const QString &action, const QString &display);
|
2023-02-06 17:03:12 +08:00
|
|
|
Q_SIGNALS:
|
|
|
|
void newNotification(const PopupNotification ¬ification);
|
|
|
|
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
|