Added notification when focus gets acquired
[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   void autoFocusAcquired();
47
48   bool isMuted() const;
49   void setMuted(bool mute);
50
51   void setConfig(QtCamConfig *conf);
52   void reload();
53
54 signals:
55   void muteChanged();
56
57 private:
58   void cache(const QString& path, const char *id);
59   void play(const char *id);
60   void playAndBlock(const char *id);
61
62   bool m_muted;
63   ca_context *m_ctx;
64   QtCamConfig *m_conf;
65 };
66
67 #endif /* SOUNDS_H */