Added a sounds component that implements the Notifications interface and is used to
[harmattan/cameraplus] / imports / sounds.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #ifndef SOUNDS_H
24 #define SOUNDS_H
25
26 #include <QObject>
27 #include "notifications.h"
28 #include <canberra.h>
29
30 class QtCamConfig;
31
32 class Sounds : public QObject, public Notifications {
33   Q_OBJECT
34   Q_INTERFACES(Notifications);
35
36   Q_PROPERTY(bool mute READ isMuted WRITE setMuted NOTIFY muteChanged);
37
38 public:
39   Sounds(QObject *parent = 0);
40   ~Sounds();
41
42   void imageCaptureStarted();
43   void imageCaptureEnded();
44   void videoRecordingStarted();
45   void videoRecordingEnded();
46
47   bool isMuted() const;
48   void setMuted(bool mute);
49
50   void setConfig(QtCamConfig *conf);
51   void reload();
52
53 signals:
54   void muteChanged();
55
56 private:
57   void cache(const QString& path, const char *id);
58   void play(const char *id);
59
60   bool m_muted;
61   ca_context *m_ctx;
62   QtCamConfig *m_conf;
63 };
64
65 #endif /* SOUNDS_H */