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

52 lines
1.8 KiB
C++

/*
* Copyright (C) 2023, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: iaom <zhangpengfei@kylinos.cn>
*/
#ifndef UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H
#define UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H
#include "ukui-notification_global.h"
#include <QObject>
#include "popup-notification.h"
#include "notification-close-reason.h"
namespace UkuiNotification {
class NotificationClientPrivate;
class UKUINOTIFICATION_EXPORT NotificationClient : public QObject
{
Q_OBJECT
public:
explicit NotificationClient(QObject *parent = nullptr);
~NotificationClient();
/**
* 注册成为弹窗通知客户端
* @return ture-成功 false 失败
*/
bool registerClient();
void unregisterClient();
bool closeNotification(uint id, NotificationCloseReason::CloseReason reason);
bool invokeAction(uint id, const QString &action_key);
Q_SIGNALS:
void newNotification(const UkuiNotification::PopupNotification &notification);
void notificationClosed(uint id, UkuiNotification::NotificationCloseReason::CloseReason closeReason);
private:
NotificationClientPrivate *d = nullptr;
};
} // UkuiNotification
#endif //UKUI_NOTIFICATION_NOTIFICATION_CLIENT_H