Added settings to change camera device.
[harmattan/cameraplus] / src / settings.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 SETTINGS_H
24 #define SETTINGS_H
25
26 #include <QObject>
27
28 class QSettings;
29
30 class Settings : public QObject {
31   Q_OBJECT
32
33   Q_PROPERTY(int mode READ mode WRITE setMode NOTIFY modeChanged);
34   Q_PROPERTY(QString creatorName READ creatorName WRITE setCreatorName NOTIFY creatorNameChanged);
35   Q_PROPERTY(bool useGps READ useGps WRITE setUseGps NOTIFY useGpsChanged);
36   Q_PROPERTY(bool useGeotags READ useGeotags WRITE setUseGeotags NOTIFY useGeotagsChanged);
37   Q_PROPERTY(int imageSceneMode READ imageSceneMode WRITE setImageSceneMode NOTIFY imageSceneModeChanged);
38   Q_PROPERTY(int imageColorFilter READ imageColorFilter WRITE setImageColorFilter NOTIFY imageColorFilterChanged);
39   Q_PROPERTY(int imageWhiteBalance READ imageWhiteBalance WRITE setImageWhiteBalance NOTIFY imageWhiteBalanceChanged);
40   Q_PROPERTY(qreal imageEvComp READ imageEvComp WRITE setImageEvComp NOTIFY imageEvCompChanged);
41
42   Q_PROPERTY(int videoSceneMode READ videoSceneMode WRITE setVideoSceneMode NOTIFY videoSceneModeChanged);
43   Q_PROPERTY(int videoColorFilter READ videoColorFilter WRITE setVideoColorFilter NOTIFY videoColorFilterChanged);
44   Q_PROPERTY(int videoWhiteBalance READ videoWhiteBalance WRITE setVideoWhiteBalance NOTIFY videoWhiteBalanceChanged);
45   Q_PROPERTY(qreal videoEvComp READ videoEvComp WRITE setVideoEvComp NOTIFY videoEvCompChanged);
46
47   Q_PROPERTY(int imageFlashMode READ imageFlashMode WRITE setImageFlashMode NOTIFY imageFlashModeChanged);
48   Q_PROPERTY(int imageIso READ imageIso WRITE setImageIso NOTIFY imageIsoChanged);
49
50   Q_PROPERTY(QString imageAspectRatio READ imageAspectRatio WRITE setImageAspectRatio NOTIFY imageAspectRatioChanged);
51   Q_PROPERTY(QString imageResolution READ imageResolution WRITE setImageResolution NOTIFY imageResolutionChanged);
52
53   Q_PROPERTY(QString videoAspectRatio READ videoAspectRatio WRITE setVideoAspectRatio NOTIFY videoAspectRatioChanged);
54   Q_PROPERTY(QString videoResolution READ videoResolution WRITE setVideoResolution NOTIFY videoResolutionChanged);
55
56   Q_PROPERTY(bool soundEnabled READ isSoundEnabled WRITE setSoundEnabled NOTIFY soundEnabledChanged);
57   Q_PROPERTY(bool videoTorchOn READ isVideoTorchOn WRITE setVideoTorchOn NOTIFY videoTorchOnChanged);
58
59   Q_PROPERTY(bool showToolBar READ isToolBarShown WRITE setToolBarShown NOTIFY toolBarShownChanged);
60   Q_PROPERTY(bool videoMuted READ isVideoMuted WRITE setVideoMuted NOTIFY videoMutedChanged);
61
62   Q_PROPERTY(bool gridEnabled READ isGridEnabled WRITE setGridEnabled NOTIFY gridEnabledChanged);
63
64   Q_PROPERTY(bool faceDetectionEnabled READ isFaceDetectionEnabled WRITE setFaceDetectionEnabled NOTIFY faceDetectionEnabledChanged);
65   Q_PROPERTY(bool zoomAsShutter READ isZoomAsShutterEnabled WRITE setZoomAsShutterEnabled NOTIFY zoomAsShutterChanged);
66   Q_PROPERTY(int device READ device WRITE setDevice NOTIFY deviceChanged);
67
68 public:
69   Settings(QObject *parent = 0);
70   ~Settings();
71
72   int mode() const;
73   void setMode(int mode);
74
75   QString creatorName() const;
76   void setCreatorName(const QString& name);
77
78   bool useGps() const;
79   void setUseGps(bool enable);
80
81   bool useGeotags() const;
82   void setUseGeotags(bool enable);
83
84   int imageSceneMode() const;
85   void setImageSceneMode(int mode);
86
87   int imageColorFilter() const;
88   void setImageColorFilter(int filter);
89
90   int imageWhiteBalance() const;
91   void setImageWhiteBalance(int wb);
92
93   qreal imageEvComp() const;
94   void setImageEvComp(qreal ev);
95
96   int videoSceneMode() const;
97   void setVideoSceneMode(int mode);
98
99   int videoColorFilter() const;
100   void setVideoColorFilter(int filter);
101
102   int videoWhiteBalance() const;
103   void setVideoWhiteBalance(int wb);
104
105   qreal videoEvComp() const;
106   void setVideoEvComp(qreal ev);
107
108   int imageFlashMode() const;
109   void setImageFlashMode(int mode);
110
111   int imageIso() const;
112   void setImageIso(int iso);
113
114   QString imageAspectRatio() const;
115   void setImageAspectRatio(const QString& aspectRatio);
116
117   QString imageResolution() const;
118   void setImageResolution(const QString& resolution);
119
120   QString videoAspectRatio() const;
121   void setVideoAspectRatio(const QString& aspectRatio);
122
123   QString videoResolution() const;
124   void setVideoResolution(const QString& resolution);
125
126   bool isSoundEnabled() const;
127   void setSoundEnabled(bool enabled);
128
129   bool isVideoTorchOn() const;
130   void setVideoTorchOn(bool on);
131
132   bool isToolBarShown() const;
133   void setToolBarShown(bool shown);
134
135   bool isVideoMuted() const;
136   void setVideoMuted(bool muted);
137
138   bool isGridEnabled() const;
139   void setGridEnabled(bool enabled);
140
141   bool isFaceDetectionEnabled() const;
142   void setFaceDetectionEnabled(bool enabled);
143
144   bool isZoomAsShutterEnabled();
145   void setZoomAsShutterEnabled(bool enabled);
146
147   int device() const;
148   void setDevice(int device);
149
150 signals:
151   void modeChanged();
152   void creatorNameChanged();
153   void useGpsChanged();
154   void useGeotagsChanged();
155   void imageSceneModeChanged();
156   void imageColorFilterChanged();
157   void imageWhiteBalanceChanged();
158   void imageEvCompChanged();
159   void videoSceneModeChanged();
160   void videoColorFilterChanged();
161   void videoWhiteBalanceChanged();
162   void videoEvCompChanged();
163   void imageFlashModeChanged();
164   void imageIsoChanged();
165   void imageAspectRatioChanged();
166   void imageResolutionChanged();
167   void videoAspectRatioChanged();
168   void videoResolutionChanged();
169   void soundEnabledChanged();
170   void videoTorchOnChanged();
171   void toolBarShownChanged();
172   void videoMutedChanged();
173   void gridEnabledChanged();
174   void faceDetectionEnabledChanged();
175   void zoomAsShutterChanged();
176   void deviceChanged();
177
178 private:
179   QSettings *m_settings;
180 };
181
182 #endif /* SETTINGS_H */