2021-05-20 10:02:10 +02:00
|
|
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
|
|
|
|
|
|
|
#ifndef NOTIFICATION_H
|
|
|
|
#define NOTIFICATION_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
2021-05-26 09:26:53 +02:00
|
|
|
class Application;
|
|
|
|
|
2021-05-20 10:02:10 +02:00
|
|
|
class Notification {
|
|
|
|
public:
|
|
|
|
enum class Event {
|
2021-06-17 07:07:51 +02:00
|
|
|
// Is here to provide "empty" events - events which should
|
|
|
|
// not trigger any notifications.
|
|
|
|
NoEvent = 0,
|
2021-06-15 15:02:14 +02:00
|
|
|
|
2021-06-18 13:42:31 +02:00
|
|
|
// Used for many events which happen throught application lifecycle.
|
|
|
|
GeneralEvent = 1,
|
|
|
|
|
2021-05-20 10:02:10 +02:00
|
|
|
// New (unread) messages were downloaded for some feed.
|
2021-06-28 10:08:39 +02:00
|
|
|
NewUnreadArticlesFetched = 2,
|
2021-05-20 10:02:10 +02:00
|
|
|
|
|
|
|
// RSS Guard started downloading messages for some feed.
|
2021-06-18 13:42:31 +02:00
|
|
|
ArticlesFetchingStarted = 3,
|
2021-05-20 10:02:10 +02:00
|
|
|
|
|
|
|
// Login tokens were successfuly refreshed.
|
|
|
|
// NOTE: This is primarily used in accounts which use
|
|
|
|
// OAuth or similar mechanism.
|
2021-06-15 15:02:14 +02:00
|
|
|
LoginDataRefreshed = 4,
|
|
|
|
|
2021-06-21 10:07:22 +02:00
|
|
|
NewAppVersionAvailable = 5
|
2021-05-20 10:02:10 +02:00
|
|
|
};
|
|
|
|
|
2021-06-17 07:07:51 +02:00
|
|
|
explicit Notification(Event event = Event::NoEvent, bool balloon = {}, const QString& sound_path = {});
|
|
|
|
|
|
|
|
bool balloonEnabled() const;
|
2021-05-20 10:02:10 +02:00
|
|
|
|
|
|
|
Event event() const;
|
|
|
|
void setEvent(const Event& event);
|
|
|
|
|
|
|
|
// Returns full path to audio file which should be played when notification
|
|
|
|
// is launched.
|
|
|
|
// NOTE: This property supports "%data%" placeholder.
|
|
|
|
QString soundPath() const;
|
|
|
|
void setSoundPath(const QString& sound_path);
|
|
|
|
|
2021-05-26 09:26:53 +02:00
|
|
|
void playSound(Application* app) const;
|
|
|
|
|
2021-06-15 15:02:14 +02:00
|
|
|
static QList<Event> allEvents();
|
|
|
|
static QString nameForEvent(Event event);
|
|
|
|
|
2021-05-20 10:02:10 +02:00
|
|
|
private:
|
|
|
|
Event m_event;
|
2021-06-17 07:07:51 +02:00
|
|
|
bool m_balloonEnabled;
|
2021-05-20 10:02:10 +02:00
|
|
|
QString m_soundPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NOTIFICATION_H
|