swift
notificationplayer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_SOUND_NOTIFICATIONPLAYER_H
7 #define SWIFT_SOUND_NOTIFICATIONPLAYER_H
8 
9 #include <QHash>
10 #include <QObject>
11 #include <QPointer>
12 #include <QSoundEffect>
13 
15 #include "sound/swiftsoundexport.h"
16 
17 namespace swift::sound
18 {
20  class SWIFT_SOUND_EXPORT CNotificationPlayer : public QObject
21  {
22  Q_OBJECT
23 
24  public:
26  CNotificationPlayer(QObject *parent = nullptr);
27 
29  virtual ~CNotificationPlayer() override {}
30 
32  void play(swift::misc::audio::CNotificationSounds::NotificationFlag notification, int volume = 100);
33 
35  void updateDirectory(const QString &directory);
36 
37  private:
39  QString m_directory;
40  QPointer<QSoundEffect> m_playingEffect;
41  int m_playingEffectCounter = 0;
42 
44  void onPlayingChanged();
45 
47  void updateEffect(swift::misc::audio::CNotificationSounds::NotificationFlag f, const QString &directory,
48  const QString &name);
49  };
50 } // namespace swift::sound
51 
52 #endif // SWIFT_SOUND_NOTIFICATIONPLAYER_H
Player for notification sounds.
virtual ~CNotificationPlayer()
Destructor.
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.