123 lines
2.9 KiB
C++
123 lines
2.9 KiB
C++
//
|
||
// Created by zpf on 23-2-2.
|
||
//
|
||
|
||
#ifndef UKUI_NOTIFICATION_POPUP_NOTIFICATION_H
|
||
#define UKUI_NOTIFICATION_POPUP_NOTIFICATION_H
|
||
#include "ukui-notification_global.h"
|
||
#include <QObject>
|
||
#include <QDateTime>
|
||
#include <QList>
|
||
#include <QString>
|
||
#include <QUrl>
|
||
#include <QVariantMap>
|
||
#include <QImage>
|
||
#include <QList>
|
||
#include <QPair>
|
||
namespace UkuiNotification {
|
||
class PopupNotificationPrivate;
|
||
//TODO 可以增加通知基类,实现多种类型通知
|
||
class UKUINOTIFICATION_EXPORT PopupNotification : public QObject
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
/**
|
||
* The notification urgency.
|
||
*/
|
||
enum Urgency {
|
||
LowUrgency = 0,
|
||
NormalUrgency = 1,
|
||
CriticalUrgency = 2,
|
||
};
|
||
Q_ENUM(Urgency)
|
||
|
||
explicit PopupNotification(uint id = 0, QObject *parent = nullptr);
|
||
PopupNotification(const PopupNotification &other);
|
||
PopupNotification &operator=(const PopupNotification &other);
|
||
PopupNotification &operator=(PopupNotification &&other) Q_DECL_NOEXCEPT;
|
||
~PopupNotification();
|
||
|
||
QString applicationName() const;
|
||
void setApplicationName(const QString &applicationName);
|
||
|
||
QString applicationIconName() const;
|
||
void setAplicationIconName(const QString &applicationIconName);
|
||
|
||
QString summary() const;
|
||
void setSummary(const QString &summary);
|
||
|
||
QString body() const;
|
||
void setBody(const QString &body);
|
||
|
||
bool hasDefaultAction() const;
|
||
QString defauleActionLable();
|
||
void setActions(const QStringList &actions);
|
||
QList<QPair<QString, QString>> actions() const;
|
||
|
||
QVariantMap hints() const;
|
||
void setHints(const QVariantMap &hints);
|
||
|
||
int timeout() const;
|
||
void setTimeout(int timeout);
|
||
|
||
QDateTime createdTime() const;
|
||
//m_hints
|
||
/**
|
||
* 使用图标显示action
|
||
* @return
|
||
*/
|
||
bool enableActionIcons() const;
|
||
/**
|
||
* 分类
|
||
* @return
|
||
*/
|
||
QString category() const;
|
||
/**
|
||
* desktop名称(不带.desktop后缀)
|
||
* @return
|
||
*/
|
||
QString desktopEntry() const;
|
||
/**
|
||
* 对应image-data字段
|
||
* @return
|
||
*/
|
||
QImage image() const;
|
||
/**
|
||
* 当加载image-data失败,或通过image-path加载image失败时(image-path不是URL),icon会被设置为image-path数据
|
||
* @return
|
||
*/
|
||
QString icon() const;
|
||
/**
|
||
* 是否持续显示,不会自动移除,直到被用户手动或发送者删除
|
||
* @return
|
||
*/
|
||
bool resident() const;
|
||
/**
|
||
* 声音
|
||
* @return
|
||
*/
|
||
QString soundFile() const;
|
||
/**
|
||
* 是否静音
|
||
* @return
|
||
*/
|
||
bool suppressSound() const;
|
||
/**
|
||
* 暂时通知(会自动移除)
|
||
* @return
|
||
*/
|
||
bool transient() const;
|
||
void setUrgency(Urgency urgency);
|
||
/**
|
||
* 通知发送者所在的display
|
||
* @return
|
||
*/
|
||
QString display() const;
|
||
|
||
private:
|
||
PopupNotificationPrivate *d = nullptr;
|
||
};
|
||
}
|
||
|
||
#endif //UKUI_NOTIFICATION_POPUP_NOTIFICATION_H
|