| 1 |
/* |
| 2 |
* Copyright 2015 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Authors: |
| 17 |
* Mirco Mueller <[email protected]> |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef MOCK_NOTIFICATION_H |
| 21 |
#define MOCK_NOTIFICATION_H |
| 22 |
|
| 23 |
#include "MockActionModel.h" |
| 24 |
#include <QObject> |
| 25 |
#include <QString> |
| 26 |
#include <QStringList> |
| 27 |
#include <QScopedPointer> |
| 28 |
|
| 29 |
struct MockNotificationPrivate; |
| 30 |
|
| 31 |
class MockNotification : public QObject { |
| 32 |
Q_OBJECT |
| 33 |
Q_PROPERTY(QString summary READ getSummary WRITE setSummary NOTIFY summaryChanged) |
| 34 |
Q_PROPERTY(QString body READ getBody WRITE setBody NOTIFY bodyChanged) |
| 35 |
Q_PROPERTY(int nid READ getID WRITE setID NOTIFY idChanged) |
| 36 |
Q_PROPERTY(int value READ getValue WRITE setValue NOTIFY valueChanged) |
| 37 |
Q_PROPERTY(QString icon READ getIcon WRITE setIcon NOTIFY iconChanged) |
| 38 |
Q_PROPERTY(QString secondaryIcon READ getSecondaryIcon WRITE setSecondaryIcon NOTIFY secondaryIconChanged) |
| 39 |
Q_PROPERTY(Type type READ getType WRITE setType NOTIFY typeChanged) |
| 40 |
Q_PROPERTY(Urgency urgency READ getUrgency WRITE setUrgency NOTIFY urgencyChanged) |
| 41 |
Q_PROPERTY(QStringList rawActions READ rawActions WRITE setActions) |
| 42 |
Q_PROPERTY(ActionModel* actions READ getActions NOTIFY actionsChanged) |
| 43 |
Q_PROPERTY(QVariantMap hints READ getHints WRITE setHints NOTIFY hintsChanged) |
| 44 |
Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged) // only in mock |
| 45 |
|
| 46 |
private: |
| 47 |
QScopedPointer<MockNotificationPrivate> p; |
| 48 |
|
| 49 |
public: |
| 50 |
enum Urgency { Low, Normal, Critical }; |
| 51 |
Q_ENUM(Urgency) |
| 52 |
enum Type { PlaceHolder, Confirmation, Ephemeral, Interactive, SnapDecision }; |
| 53 |
Q_ENUM(Type) |
| 54 |
|
| 55 |
Q_SIGNALS: |
| 56 |
void summaryChanged(const QString &summary); |
| 57 |
void bodyChanged(const QString &body); |
| 58 |
void idChanged(const int id); |
| 59 |
void valueChanged(int value); |
| 60 |
void iconChanged(const QString &icon); |
| 61 |
void secondaryIconChanged(const QString &secondaryIcon); |
| 62 |
void typeChanged(Type type); |
| 63 |
void urgencyChanged(Urgency urgency); |
| 64 |
void actionsChanged(const QStringList &actions); |
| 65 |
void hintsChanged(const QVariantMap& hints); |
| 66 |
|
| 67 |
void dataChanged(int nid); |
| 68 |
void completed(int nid); |
| 69 |
void actionInvoked(const QString &action); |
| 70 |
|
| 71 |
void fullscreenChanged(bool fullscreen); |
| 72 |
|
| 73 |
public: |
| 74 |
MockNotification(QObject *parent=nullptr); |
| 75 |
virtual ~MockNotification(); |
| 76 |
|
| 77 |
QString getSummary() const; |
| 78 |
void setSummary(const QString &summary); |
| 79 |
QString getBody() const; |
| 80 |
void setBody(const QString &body); |
| 81 |
int getID() const; |
| 82 |
void setID(const int id); |
| 83 |
int getValue() const; |
| 84 |
void setValue(int value); |
| 85 |
QString getIcon() const; |
| 86 |
void setIcon(const QString &icon); |
| 87 |
QString getSecondaryIcon() const; |
| 88 |
void setSecondaryIcon(const QString &secondaryIcon); |
| 89 |
Type getType() const; |
| 90 |
void setType(Type type); |
| 91 |
Urgency getUrgency() const; |
| 92 |
void setUrgency(Urgency newUrgency); |
| 93 |
ActionModel* getActions() const; |
| 94 |
QStringList rawActions() const; |
| 95 |
void setActions(const QStringList &actions); |
| 96 |
QVariantMap getHints() const; |
| 97 |
void setHints(const QVariantMap& hints); |
| 98 |
bool fullscreen() const; |
| 99 |
void setFullscreen(bool fullscreen); |
| 100 |
|
| 101 |
Q_INVOKABLE void invokeAction(const QString &action); |
| 102 |
Q_INVOKABLE void close(); |
| 103 |
}; |
| 104 |
|
| 105 |
#endif // MOCK_NOTIFICATION_H |