SimpleQmlNotify/notificationdata.h

79 lines
2.2 KiB
C
Raw Normal View History

2019-11-19 15:20:38 +03:00
#ifndef NOTIFICATIONDATA_H
#define NOTIFICATIONDATA_H
#include <QObject>
#include "notifyservice_global.h"
namespace QmlNotificationService {
/**
* @brief The NotificationData class view data for NotificationServiceView. This class contains a structure with notification data.
2019-11-19 15:20:38 +03:00
*/
class NOTIFYSERVICESHARED_EXPORT NotificationData
{
Q_GADGET
Q_PROPERTY(QString text READ text)
Q_PROPERTY(QString img READ img)
Q_PROPERTY(QString title READ title)
Q_PROPERTY(int type READ type)
QString _text;
QString _img;
QString _title;
int _type;
public:
2021-04-15 15:56:38 +03:00
/**
* @brief The Type enum This enum contatins all available types of the notification messages.
*/
2019-11-19 15:20:38 +03:00
enum Type {
2021-04-15 15:56:38 +03:00
/// This is message for general notification.
2019-11-19 15:20:38 +03:00
Normal,
2021-04-15 15:56:38 +03:00
/// This is warning notification.
2019-11-19 15:20:38 +03:00
Warning = 1,
2021-04-15 15:56:38 +03:00
/// This is critical error notifications.
2019-11-19 15:20:38 +03:00
Error = 2,
};
explicit NotificationData(const QString& title = "",
const QString& text = "",
const QString& img = "",
2021-01-18 23:20:03 +03:00
int type = Type::Normal);
2019-11-19 15:20:38 +03:00
2021-04-15 15:56:38 +03:00
/**
* @brief text This method return main text message of a question/notification object.
* @return plain text of message.
*/
2019-11-19 15:20:38 +03:00
Q_INVOKABLE QString text() const;
2021-04-15 15:56:38 +03:00
/**
* @brief img This method return url to image of a question/notification object.
* @return url of image.
*/
2019-11-19 15:20:38 +03:00
Q_INVOKABLE QString img() const;
2021-04-15 15:56:38 +03:00
/**
* @brief title This method return title of a question/notification object.
* @return title of a question/notification object.
*/
2019-11-19 15:20:38 +03:00
Q_INVOKABLE QString title() const;
2021-04-15 15:56:38 +03:00
/**
* @brief type This method return type of the notification message or code of the question.
* @return type of the notification message or code of the question.
*/
2019-11-19 15:20:38 +03:00
Q_INVOKABLE int type() const;
2021-04-15 15:56:38 +03:00
/**
* @brief isValid This method return true if this object is valid.
* @return return true if this object is valid.
*/
2019-11-20 17:54:52 +03:00
Q_INVOKABLE bool isValid() const;
2019-11-19 15:20:38 +03:00
bool operator ==(const NotificationData &righ);
bool operator !=(const NotificationData &righ);
};
}
#endif // NOTIFICATIONDATA_H