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

45 lines
1.4 KiB
C++

//
// 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>
#include "popup-notification.h"
namespace UkuiNotification {
class NotificationClientPrivate;
class UKUINOTIFICATION_EXPORT NotificationClient : public QObject
{
Q_OBJECT
public:
/**
* The reason a notification was closed
*/
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 失败
*/
bool registerClient();
void closeNotification(uint id, CloseReason reason);
void invokeAction(uint id, const QString &action_key, const QString &action, const QString &display);
Q_SIGNALS:
void newNotification(const PopupNotification &notification);
void notificationClosed(uint id, CloseReason closeReason);
private:
NotificationClientPrivate *d = nullptr;
};
} // UkuiNotification
#endif //UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H