the-libs/lib/tnotification.h

90 lines
2 KiB
C
Raw Normal View History

2017-01-21 08:21:40 -05:00
#ifndef TNOTIFICATION_H
#define TNOTIFICATION_H
2018-08-03 08:31:27 -04:00
#include "the-libs_global.h"
2017-01-21 08:21:40 -05:00
#include <QObject>
2018-08-03 08:31:27 -04:00
#include <QMap>
#include <QVariant>
2017-11-10 05:04:07 -05:00
#include <QCoreApplication>
2018-07-26 03:04:51 -04:00
#ifdef T_OS_UNIX_NOT_MAC
#include <QDBusPendingReply>
#include <QDBusPendingCallWatcher>
#include <QDBusMessage>
#include <QDBusConnection>
2018-07-26 03:04:51 -04:00
#endif
2017-01-21 08:21:40 -05:00
2019-04-10 02:32:35 -04:00
struct tNotificationPrivateByOS;
class THELIBSSHARED_EXPORT tNotification : public QObject {
Q_OBJECT
public:
enum Urgency {
Low = 0,
Normal = 1,
Critical = 2
};
2017-01-21 08:21:40 -05:00
explicit tNotification(QString summary = "", QString text = "", QObject* parent = 0);
~tNotification();
2017-01-21 08:21:40 -05:00
void setTransient(bool transient);
bool transient();
2017-01-21 08:21:40 -05:00
void setTimeout(int timeout);
int timeout();
2017-01-21 08:21:40 -05:00
void setSummary(QString summary);
QString summary();
2017-01-21 08:21:40 -05:00
void setText(QString text);
QString text();
2017-01-21 08:21:40 -05:00
void setCategory(QString category);
QString category();
2017-01-21 08:21:40 -05:00
void setSound(QString sound);
QString sound();
2017-01-21 08:21:40 -05:00
void setSoundOn(bool soundOn);
bool soundOn();
2017-01-21 08:21:40 -05:00
void setUrgency(Urgency urgency);
Urgency urgency();
2017-01-21 08:21:40 -05:00
void setAppName(QString appName);
QString appName();
2018-01-14 07:20:08 -05:00
void setAppIcon(QString appIcon);
QString appIcon();
2018-01-14 07:20:08 -05:00
void insertAction(QString key, QString text);
void removeAction(QString key);
void clearActions();
2019-04-10 02:32:35 -04:00
void insertHint(QString key, QVariant hint);
signals:
void actionClicked(QString key);
void dismissed();
2017-01-21 08:21:40 -05:00
public slots:
void post(bool deleteWhenDone = true);
void dismiss();
2017-01-21 08:21:40 -05:00
private slots:
2017-01-21 08:21:40 -05:00
private:
QString sum, txt, cat, snd, app, aIcon;
bool isTransient = false, noSound = false;
int time = -1;
Urgency urg = Normal;
QVariantMap extraHints;
QMap<QString, QString> actions;
2019-04-10 02:32:35 -04:00
tNotificationPrivateByOS* dd;
2019-04-10 02:32:35 -04:00
void initialize();
void destroy();
2017-01-21 08:21:40 -05:00
};
#endif // TNOTIFICATION_H