Kill CameraButtonRow and use the QtQuick Row component
[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 class DeviceSettings;
30
31 class Settings : public QObject {
32   Q_OBJECT
33
34   Q_PROPERTY(int mode READ mode WRITE setMode NOTIFY modeChanged);
35   Q_PROPERTY(QString creatorName READ creatorName WRITE setCreatorName NOTIFY creatorNameChanged);
36   Q_PROPERTY(bool useGps READ useGps WRITE setUseGps NOTIFY useGpsChanged);
37   Q_PROPERTY(bool useGeotags READ useGeotags WRITE setUseGeotags NOTIFY useGeotagsChanged);
38   Q_PROPERTY(int imageSceneMode READ imageSceneMode WRITE setImageSceneMode NOTIFY imageSceneModeChanged);
39   Q_PROPERTY(int imageColorFilter READ imageColorFilter WRITE setImageColorFilter NOTIFY imageColorFilterChanged);
40   Q_PROPERTY(int imageWhiteBalance READ imageWhiteBalance WRITE setImageWhiteBalance NOTIFY imageWhiteBalanceChanged);
41   Q_PROPERTY(qreal imageEvComp READ imageEvComp WRITE setImageEvComp NOTIFY imageEvCompChanged);
42
43   Q_PROPERTY(int videoSceneMode READ videoSceneMode WRITE setVideoSceneMode NOTIFY videoSceneModeChanged);
44   Q_PROPERTY(int videoColorFilter READ videoColorFilter WRITE setVideoColorFilter NOTIFY videoColorFilterChanged);
45   Q_PROPERTY(int videoWhiteBalance READ videoWhiteBalance WRITE setVideoWhiteBalance NOTIFY videoWhiteBalanceChanged);
46   Q_PROPERTY(qreal videoEvComp READ videoEvComp WRITE setVideoEvComp NOTIFY videoEvCompChanged);
47
48   Q_PROPERTY(int imageFlashMode READ imageFlashMode WRITE setImageFlashMode NOTIFY imageFlashModeChanged);
49   Q_PROPERTY(int imageIso READ imageIso WRITE setImageIso NOTIFY imageIsoChanged);
50
51   Q_PROPERTY(QString imageAspectRatio READ imageAspectRatio WRITE setImageAspectRatio NOTIFY imageAspectRatioChanged);
52   Q_PROPERTY(QString imageResolution READ imageResolution WRITE setImageResolution NOTIFY imageResolutionChanged);
53
54   Q_PROPERTY(QString videoAspectRatio READ videoAspectRatio WRITE setVideoAspectRatio NOTIFY videoAspectRatioChanged);
55   Q_PROPERTY(QString videoResolution READ videoResolution WRITE setVideoResolution NOTIFY videoResolutionChanged);
56
57   Q_PROPERTY(bool soundEnabled READ isSoundEnabled WRITE setSoundEnabled NOTIFY soundEnabledChanged);
58   Q_PROPERTY(bool videoTorchOn READ isVideoTorchOn WRITE setVideoTorchOn NOTIFY videoTorchOnChanged);
59
60   Q_PROPERTY(bool showToolBar READ isToolBarShown WRITE setToolBarShown NOTIFY toolBarShownChanged);
61   Q_PROPERTY(bool videoMuted READ isVideoMuted WRITE setVideoMuted NOTIFY videoMutedChanged);
62
63   Q_PROPERTY(bool gridEnabled READ isGridEnabled WRITE setGridEnabled NOTIFY gridEnabledChanged);
64
65   Q_PROPERTY(bool faceDetectionEnabled READ isFaceDetectionEnabled WRITE setFaceDetectionEnabled NOTIFY faceDetectionEnabledChanged);
66   Q_PROPERTY(bool zoomAsShutter READ isZoomAsShutterEnabled WRITE setZoomAsShutterEnabled NOTIFY zoomAsShutterChanged);
67   Q_PROPERTY(bool proximityAsShutter READ isProximityAsShutterEnabled WRITE setProximityAsShutterEnabled NOTIFY proximityAsShutterChanged);
68   Q_PROPERTY(int device READ device WRITE setDevice NOTIFY deviceChanged);
69   Q_PROPERTY(bool enablePreview READ isPreviewEnabled WRITE setPreviewEnabled NOTIFY previewEnabledChanged);
70
71 public:
72   Settings(QObject *parent = 0);
73   ~Settings();
74
75   int mode() const;
76   void setMode(int mode);
77
78   QString creatorName() const;
79   void setCreatorName(const QString& name);
80
81   bool useGps() const;
82   void setUseGps(bool enable);
83
84   bool useGeotags() const;
85   void setUseGeotags(bool enable);
86
87   int imageSceneMode();
88   void setImageSceneMode(int mode);
89
90   int imageColorFilter();
91   void setImageColorFilter(int filter);
92
93   int imageWhiteBalance();
94   void setImageWhiteBalance(int wb);
95
96   qreal imageEvComp();
97   void setImageEvComp(qreal ev);
98
99   int videoSceneMode();
100   void setVideoSceneMode(int mode);
101
102   int videoColorFilter();
103   void setVideoColorFilter(int filter);
104
105   int videoWhiteBalance();
106   void setVideoWhiteBalance(int wb);
107
108   qreal videoEvComp();
109   void setVideoEvComp(qreal ev);
110
111   int imageFlashMode();
112   void setImageFlashMode(int mode);
113
114   int imageIso();
115   void setImageIso(int iso);
116
117   QString imageAspectRatio();
118   void setImageAspectRatio(const QString& aspectRatio);
119
120   QString imageResolution();
121   void setImageResolution(const QString& resolution);
122
123   QString videoAspectRatio();
124   void setVideoAspectRatio(const QString& aspectRatio);
125
126   QString videoResolution();
127   void setVideoResolution(const QString& resolution);
128
129   bool isSoundEnabled() const;
130   void setSoundEnabled(bool enabled);
131
132   bool isVideoTorchOn();
133   void setVideoTorchOn(bool on);
134
135   bool isToolBarShown() const;
136   void setToolBarShown(bool shown);
137
138   bool isVideoMuted() const;
139   void setVideoMuted(bool muted);
140
141   bool isGridEnabled() const;
142   void setGridEnabled(bool enabled);
143
144   bool isFaceDetectionEnabled() const;
145   void setFaceDetectionEnabled(bool enabled);
146
147   bool isZoomAsShutterEnabled() const;
148   void setZoomAsShutterEnabled(bool enabled);
149
150   bool isProximityAsShutterEnabled() const;
151   void setProximityAsShutterEnabled(bool enabled);
152
153   int device() const;
154   void setDevice(int device);
155
156   QString fileNamingStamp(const QString& id) const;
157   void setFileNamingStamp(const QString& id, const QString& stamp);
158
159   int fileNamingCounter(const QString& id) const;
160   void setFileNamingCounter(const QString& id, int counter);
161
162   bool isPreviewEnabled() const;
163   void setPreviewEnabled(bool enabled);
164
165 signals:
166   void modeChanged();
167   void creatorNameChanged();
168   void useGpsChanged();
169   void useGeotagsChanged();
170   void imageSceneModeChanged();
171   void imageColorFilterChanged();
172   void imageWhiteBalanceChanged();
173   void imageEvCompChanged();
174   void videoSceneModeChanged();
175   void videoColorFilterChanged();
176   void videoWhiteBalanceChanged();
177   void videoEvCompChanged();
178   void imageFlashModeChanged();
179   void imageIsoChanged();
180   void imageAspectRatioChanged();
181   void imageResolutionChanged();
182   void videoAspectRatioChanged();
183   void videoResolutionChanged();
184   void soundEnabledChanged();
185   void videoTorchOnChanged();
186   void toolBarShownChanged();
187   void videoMutedChanged();
188   void gridEnabledChanged();
189   void faceDetectionEnabledChanged();
190   void zoomAsShutterChanged();
191   void proximityAsShutterChanged();
192   void deviceAboutToChange();
193   void deviceChanged();
194   void previewEnabledChanged();
195
196 private:
197   DeviceSettings *deviceSettings();
198   QVariant deviceValue(const char *key, const QVariant& defaultValue);
199   void setDeviceValue(const char *key, const QVariant& value);
200
201   QSettings *m_settings;
202   DeviceSettings *m_device;
203 };
204
205 #endif /* SETTINGS_H */