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

46 lines
1.4 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)
2023-02-16 09:28:41 +08:00
explicit NotificationClient(QObject *parent = nullptr);
2023-02-06 17:03:12 +08:00
~NotificationClient();
/**
*
* @return ture- false
*/
2023-02-03 18:01:06 +08:00
bool registerClient();
void unregisterClient();
bool closeNotification(uint id, CloseReason reason);
bool 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