Ref T494, CNotificationSounds refactring

* use Q_DECLARE_FLAGS NotificationFlag/Notification for sounds, not the weird version from very early swift days
* splt into h/cpp files
* added new sounds
This commit is contained in:
Klaus Basan
2018-12-31 06:42:59 +01:00
committed by Mat Sutcliffe
parent dc8ea83839
commit f8c17e10e8
14 changed files with 133 additions and 57 deletions

View File

@@ -12,6 +12,7 @@
#ifndef BLACKMISC_NOTIFICATIONSOUNDS_H
#define BLACKMISC_NOTIFICATIONSOUNDS_H
#include "blackmisc/blackmiscexport.h"
#include <QMetaType>
namespace BlackMisc
@@ -23,7 +24,7 @@ namespace BlackMisc
* \remarks Currently located in project BlackMisc (i.e. outside project BlackSound)
* as this allows to trigger sounds without using Multimedia libraries.
*/
struct CNotificationSounds
struct BLACKMISC_EXPORT CNotificationSounds
{
//! How to play?
enum PlayMode
@@ -34,21 +35,38 @@ namespace BlackMisc
};
//! Play notification
enum Notification
enum NotificationFlag
{
NotificationError = 0,
NotificationLogin,
NotificationLogoff,
NotificationTextMessagePrivate,
NotificationVoiceRoomJoined,
NotificationVoiceRoomLeft,
NotificationsLoadSounds //!< end marker and force loading of sounds, keep as last element
NoNotifications = 0,
NotificationError = 1 << 0,
NotificationLogin = 1 << 1,
NotificationLogoff = 1 << 2,
NotificationTextMessagePrivate = 1 << 3,
NotificationTextCallsignMentioned = 1 << 4,
NotificationVoiceRoomJoined = 1 << 5,
NotificationVoiceRoomLeft = 1 << 6,
PTTClick = 1 << 7,
LoadSounds = 1 << 8, //!< end marker and force loading of sounds, keep as last element
AllTextNotifications = NotificationTextMessagePrivate | NotificationTextCallsignMentioned,
AllLoginNotifications = NotificationLogin | NotificationLogoff,
AllVoiceRoomNotifications = NotificationVoiceRoomJoined | NotificationVoiceRoomLeft,
AllNotifications = NotificationError | AllTextNotifications | AllLoginNotifications | AllVoiceRoomNotifications,
DefaultNotifications = NotificationError | NotificationTextMessagePrivate | AllLoginNotifications | AllVoiceRoomNotifications,
All = AllNotifications | PTTClick
};
Q_DECLARE_FLAGS(Notification, NotificationFlag)
//! As string
static const QString &flagToString(NotificationFlag notification);
//! As string
static const QString toString(Notification notification);
};
} // ns
} // ns
Q_DECLARE_METATYPE(BlackMisc::Audio::CNotificationSounds::PlayMode)
Q_DECLARE_METATYPE(BlackMisc::Audio::CNotificationSounds::Notification)
Q_DECLARE_METATYPE(BlackMisc::Audio::CNotificationSounds::NotificationFlag)
#endif // guard