52 lines
1.3 KiB
C
Raw Normal View History

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-15 15:02:14 +02:00
UnknownEvent = 0,
2021-05-20 10:02:10 +02:00
// New (unread) messages were downloaded for some feed.
2021-06-15 15:02:14 +02:00
NewArticlesFetched = 1,
2021-05-20 10:02:10 +02:00
// RSS Guard started downloading messages for some feed.
2021-06-15 15:02:14 +02:00
ArticlesFetchingStarted = 2,
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,
// TODO: app update is available
2021-05-20 10:02:10 +02:00
};
explicit Notification();
2021-05-26 09:26:53 +02:00
explicit Notification(Event event, const QString& sound_path);
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;
QString m_soundPath;
};
#endif // NOTIFICATION_H