Added sync parameter to QtCamVideo::stopRecording()
[harmattan/cameraplus] / declarative / 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 class QDBusServiceWatcher;
32
33 class Sounds : public QObject, public Notifications {
34   Q_OBJECT
35   Q_INTERFACES(Notifications);
36
37   Q_PROPERTY(bool mute READ isMuted WRITE setMuted NOTIFY muteChanged);
38
39 public:
40   Sounds(QObject *parent = 0);
41   ~Sounds();
42
43   void imageCaptureStarted();
44   void imageCaptureEnded();
45   void videoRecordingStarted();
46   void videoRecordingEnded();
47   void autoFocusAcquired();
48
49   bool isMuted() const;
50   void setMuted(bool mute);
51
52   void setConfig(QtCamConfig *conf);
53   void reload();
54
55 signals:
56   void muteChanged();
57
58 private slots:
59   void serviceOwnerChanged(const QString& serviceName, const QString& oldOwner,
60                            const QString& newOwner);
61
62 private:
63   void cache(const QString& path, const char *id);
64   void play(const char *id);
65   void playAndBlock(const char *id);
66
67   bool m_muted;
68   ca_context *m_ctx;
69   QtCamConfig *m_conf;
70   QDBusServiceWatcher *m_watcher;
71 };
72
73 #endif /* SOUNDS_H */