Added ImageSettings::currentResolution and methods to find ImageResolution and set it
[harmattan/cameraplus] / declarative / sounds.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 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 <canberra.h>
28
29 class QDBusServiceWatcher;
30
31 class Sounds : public QObject {
32   Q_OBJECT
33
34   Q_PROPERTY(bool mute READ isMuted WRITE setMuted NOTIFY muteChanged);
35   Q_PROPERTY(QString imageCaptureStart READ imageCaptureStart WRITE setImageCaptureStart NOTIFY imageCaptureStartChanged);
36   Q_PROPERTY(QString imageCaptureEnd READ imageCaptureEnd WRITE setImageCaptureEnd NOTIFY imageCaptureEndChanged);
37   Q_PROPERTY(QString videoRecordingStart READ videoRecordingStart WRITE setVideoRecordingStart NOTIFY videoRecordingStartChanged);
38   Q_PROPERTY(QString videoRecordingEnd READ videoRecordingEnd WRITE setVideoRecordingEnd NOTIFY videoRecordingEndChanged);
39   Q_PROPERTY(QString autoFocusAcquired READ autoFocusAcquired WRITE setAutoFocusAcquired NOTIFY autoFocusAcquiredChanged);
40   Q_PROPERTY(Volume volume READ volume WRITE setVolume NOTIFY volumeChanged);
41   Q_ENUMS(Volume);
42
43 public:
44   Sounds(QObject *parent = 0);
45   ~Sounds();
46
47   typedef enum {
48     VolumeLow,
49     VolumeHigh,
50   } Volume;
51
52   void playImageCaptureStartedSound();
53   void playImageCaptureEndedSound();
54   void playVideoRecordingStartedSound();
55   void playVideoRecordingEndedSound();
56   void playAutoFocusAcquiredSound();
57
58   bool isMuted() const;
59   void setMuted(bool mute);
60
61   Volume volume() const;
62   void setVolume(const Volume& volume);
63
64   void reload();
65
66   QString imageCaptureStart() const;
67   void setImageCaptureStart(const QString& path);
68
69   QString imageCaptureEnd() const;
70   void setImageCaptureEnd(const QString& path);
71
72   QString videoRecordingStart() const;
73   void setVideoRecordingStart(const QString& path);
74
75   QString videoRecordingEnd() const;
76   void setVideoRecordingEnd(const QString& path);
77
78   QString autoFocusAcquired() const;
79   void setAutoFocusAcquired(const QString& path);
80
81 signals:
82   void muteChanged();
83   void volumeChanged();
84   void imageCaptureStartChanged();
85   void imageCaptureEndChanged();
86   void videoRecordingStartChanged();
87   void videoRecordingEndChanged();
88   void autoFocusAcquiredChanged();
89
90 private slots:
91   void serviceOwnerChanged(const QString& serviceName, const QString& oldOwner,
92                            const QString& newOwner);
93
94 private:
95   void cache(const QString& path, const char *id);
96   void play(const char *id);
97   void playAndBlock(const char *id);
98
99   bool m_muted;
100   ca_context *m_ctx;
101   Volume m_volume;
102   QDBusServiceWatcher *m_watcher;
103   QString m_volumeString;
104   QString m_imageCaptureStart;
105   QString m_imageCaptureEnd;
106   QString m_videoRecordingStart;
107   QString m_videoRecordingEnd;
108   QString m_autoFocusAcquired;
109 };
110
111 #endif /* SOUNDS_H */