little work on notifications
This commit is contained in:
parent
f68681d1b4
commit
54383e9e53
@ -7,7 +7,7 @@ CONFIG *= c++1z warn_on
|
|||||||
CONFIG -= debug_and_release
|
CONFIG -= debug_and_release
|
||||||
DEFINES *= QT_USE_QSTRINGBUILDER QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS UNICODE _UNICODE
|
DEFINES *= QT_USE_QSTRINGBUILDER QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS UNICODE _UNICODE
|
||||||
VERSION = $$APP_VERSION
|
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) {
|
greaterThan(QT_MAJOR_VERSION, 5) {
|
||||||
QT*= core5compat
|
QT*= core5compat
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#define TIMEZONE_OFFSET_LIMIT 6
|
#define TIMEZONE_OFFSET_LIMIT 6
|
||||||
#define CHANGE_EVENT_DELAY 250
|
#define CHANGE_EVENT_DELAY 250
|
||||||
#define FLAG_ICON_SUBFOLDER "flags"
|
#define FLAG_ICON_SUBFOLDER "flags"
|
||||||
#define SEARCH_BOX_ACTION_NAME "search"
|
#define SEARCH_BOX_ACTION_NAME "search"
|
||||||
#define HIGHLIGHTER_ACTION_NAME "highlighter"
|
#define HIGHLIGHTER_ACTION_NAME "highlighter"
|
||||||
#define SPACER_ACTION_NAME "spacer"
|
#define SPACER_ACTION_NAME "spacer"
|
||||||
#define SEPARATOR_ACTION_NAME "separator"
|
#define SEPARATOR_ACTION_NAME "separator"
|
||||||
|
@ -2,8 +2,15 @@
|
|||||||
|
|
||||||
#include "miscellaneous/notification.h"
|
#include "miscellaneous/notification.h"
|
||||||
|
|
||||||
|
#include "miscellaneous/application.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QSound>
|
||||||
|
|
||||||
Notification::Notification() {}
|
Notification::Notification() {}
|
||||||
|
|
||||||
|
Notification::Notification(Notification::Event event, const QString& sound_path) : m_event(event), m_soundPath(sound_path) {}
|
||||||
|
|
||||||
Notification::Event Notification::event() const {
|
Notification::Event Notification::event() const {
|
||||||
return m_event;
|
return m_event;
|
||||||
}
|
}
|
||||||
@ -19,3 +26,7 @@ QString Notification::soundPath() const {
|
|||||||
void Notification::setSoundPath(const QString& sound_path) {
|
void Notification::setSoundPath(const QString& sound_path) {
|
||||||
m_soundPath = sound_path;
|
m_soundPath = sound_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Notification::playSound(Application* app) const {
|
||||||
|
QSound::play(QDir::toNativeSeparators(app->replaceDataUserDataFolderPlaceholder(m_soundPath)));
|
||||||
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
class Application;
|
||||||
|
|
||||||
class Notification {
|
class Notification {
|
||||||
public:
|
public:
|
||||||
enum class Event {
|
enum class Event {
|
||||||
@ -21,6 +23,7 @@ class Notification {
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit Notification();
|
explicit Notification();
|
||||||
|
explicit Notification(Event event, const QString& sound_path);
|
||||||
|
|
||||||
Event event() const;
|
Event event() const;
|
||||||
void setEvent(const Event& event);
|
void setEvent(const Event& event);
|
||||||
@ -31,6 +34,8 @@ class Notification {
|
|||||||
QString soundPath() const;
|
QString soundPath() const;
|
||||||
void setSoundPath(const QString& sound_path);
|
void setSoundPath(const QString& sound_path);
|
||||||
|
|
||||||
|
void playSound(Application* app) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event m_event;
|
Event m_event;
|
||||||
QString m_soundPath;
|
QString m_soundPath;
|
||||||
|
@ -24,6 +24,14 @@ Notification NotificationFactory::notificationForEvent(Notification::Event event
|
|||||||
|
|
||||||
void NotificationFactory::load(Settings* settings) {
|
void NotificationFactory::load(Settings* settings) {
|
||||||
//settings->allKeys(Notifications::ID)
|
//settings->allKeys(Notifications::ID)
|
||||||
|
|
||||||
|
m_notifications = {
|
||||||
|
Notification()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationFactory::save(const QList<Notification> new_notifications, Settings* settings) {}
|
void NotificationFactory::save(const QList<Notification>& new_notifications, Settings* settings) {
|
||||||
|
m_notifications = new_notifications;
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
@ -21,7 +21,7 @@ class NotificationFactory : public QObject {
|
|||||||
|
|
||||||
// Load saved notifications from settings
|
// Load saved notifications from settings
|
||||||
void load(Settings* settings);
|
void load(Settings* settings);
|
||||||
void save(const QList<Notification> new_notifications, Settings* settings);
|
void save(const QList<Notification>& new_notifications, Settings* settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Notification> m_notifications = {};
|
QList<Notification> m_notifications = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user