diff --git a/pri/build_opts.pri b/pri/build_opts.pri index a84ba8e31..5f90e676e 100644 --- a/pri/build_opts.pri +++ b/pri/build_opts.pri @@ -7,7 +7,7 @@ CONFIG *= c++1z warn_on CONFIG -= debug_and_release DEFINES *= QT_USE_QSTRINGBUILDER QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS UNICODE _UNICODE VERSION = $$APP_VERSION -QT *= core gui widgets sql network xml qml +QT *= core gui widgets sql network xml qml multimedia greaterThan(QT_MAJOR_VERSION, 5) { QT*= core5compat diff --git a/src/librssguard/definitions/definitions.h b/src/librssguard/definitions/definitions.h index cffc0f0e2..65a0e1bde 100755 --- a/src/librssguard/definitions/definitions.h +++ b/src/librssguard/definitions/definitions.h @@ -71,7 +71,7 @@ #define TIMEZONE_OFFSET_LIMIT 6 #define CHANGE_EVENT_DELAY 250 #define FLAG_ICON_SUBFOLDER "flags" -#define SEARCH_BOX_ACTION_NAME "search" +#define SEARCH_BOX_ACTION_NAME "search" #define HIGHLIGHTER_ACTION_NAME "highlighter" #define SPACER_ACTION_NAME "spacer" #define SEPARATOR_ACTION_NAME "separator" diff --git a/src/librssguard/miscellaneous/notification.cpp b/src/librssguard/miscellaneous/notification.cpp index 9ca7fa25b..89bf43b71 100755 --- a/src/librssguard/miscellaneous/notification.cpp +++ b/src/librssguard/miscellaneous/notification.cpp @@ -2,8 +2,15 @@ #include "miscellaneous/notification.h" +#include "miscellaneous/application.h" + +#include +#include + Notification::Notification() {} +Notification::Notification(Notification::Event event, const QString& sound_path) : m_event(event), m_soundPath(sound_path) {} + Notification::Event Notification::event() const { return m_event; } @@ -19,3 +26,7 @@ QString Notification::soundPath() const { void Notification::setSoundPath(const QString& sound_path) { m_soundPath = sound_path; } + +void Notification::playSound(Application* app) const { + QSound::play(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath))); +} diff --git a/src/librssguard/miscellaneous/notification.h b/src/librssguard/miscellaneous/notification.h index 44754f305..6d2436c39 100755 --- a/src/librssguard/miscellaneous/notification.h +++ b/src/librssguard/miscellaneous/notification.h @@ -5,6 +5,8 @@ #include +class Application; + class Notification { public: enum class Event { @@ -21,6 +23,7 @@ class Notification { }; explicit Notification(); + explicit Notification(Event event, const QString& sound_path); Event event() const; void setEvent(const Event& event); @@ -31,6 +34,8 @@ class Notification { QString soundPath() const; void setSoundPath(const QString& sound_path); + void playSound(Application* app) const; + private: Event m_event; QString m_soundPath; diff --git a/src/librssguard/miscellaneous/notificationfactory.cpp b/src/librssguard/miscellaneous/notificationfactory.cpp index 0860c9c74..2de3356f6 100755 --- a/src/librssguard/miscellaneous/notificationfactory.cpp +++ b/src/librssguard/miscellaneous/notificationfactory.cpp @@ -24,6 +24,14 @@ Notification NotificationFactory::notificationForEvent(Notification::Event event void NotificationFactory::load(Settings* settings) { //settings->allKeys(Notifications::ID) + + m_notifications = { + Notification() + }; } -void NotificationFactory::save(const QList new_notifications, Settings* settings) {} +void NotificationFactory::save(const QList& new_notifications, Settings* settings) { + m_notifications = new_notifications; + + // +} diff --git a/src/librssguard/miscellaneous/notificationfactory.h b/src/librssguard/miscellaneous/notificationfactory.h index 63a164c2c..96fc76547 100755 --- a/src/librssguard/miscellaneous/notificationfactory.h +++ b/src/librssguard/miscellaneous/notificationfactory.h @@ -21,7 +21,7 @@ class NotificationFactory : public QObject { // Load saved notifications from settings void load(Settings* settings); - void save(const QList new_notifications, Settings* settings); + void save(const QList& new_notifications, Settings* settings); private: QList m_notifications = {};