Handle the case when we have different paths for videos and images
[harmattan/cameraplus] / src / settings.h
index 51a5919..b08a057 100644 (file)
@@ -1,18 +1,38 @@
 // -*- c++ -*-
 
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
 #ifndef SETTINGS_H
 #define SETTINGS_H
 
 #include <QObject>
 
 class QSettings;
+class DeviceSettings;
 
 class Settings : public QObject {
   Q_OBJECT
 
   Q_PROPERTY(int mode READ mode WRITE setMode NOTIFY modeChanged);
   Q_PROPERTY(QString creatorName READ creatorName WRITE setCreatorName NOTIFY creatorNameChanged);
-  Q_PROPERTY(int postCaptureTimeout READ postCaptureTimeout WRITE setPostCaptureTimeout NOTIFY postCaptureTimeoutChanged);
   Q_PROPERTY(bool useGps READ useGps WRITE setUseGps NOTIFY useGpsChanged);
   Q_PROPERTY(bool useGeotags READ useGeotags WRITE setUseGeotags NOTIFY useGeotagsChanged);
   Q_PROPERTY(int imageSceneMode READ imageSceneMode WRITE setImageSceneMode NOTIFY imageSceneModeChanged);
@@ -28,6 +48,25 @@ class Settings : public QObject {
   Q_PROPERTY(int imageFlashMode READ imageFlashMode WRITE setImageFlashMode NOTIFY imageFlashModeChanged);
   Q_PROPERTY(int imageIso READ imageIso WRITE setImageIso NOTIFY imageIsoChanged);
 
+  Q_PROPERTY(QString imageAspectRatio READ imageAspectRatio WRITE setImageAspectRatio NOTIFY imageAspectRatioChanged);
+  Q_PROPERTY(QString imageResolution READ imageResolution WRITE setImageResolution NOTIFY imageResolutionChanged);
+
+  Q_PROPERTY(QString videoAspectRatio READ videoAspectRatio WRITE setVideoAspectRatio NOTIFY videoAspectRatioChanged);
+  Q_PROPERTY(QString videoResolution READ videoResolution WRITE setVideoResolution NOTIFY videoResolutionChanged);
+
+  Q_PROPERTY(bool soundEnabled READ isSoundEnabled WRITE setSoundEnabled NOTIFY soundEnabledChanged);
+  Q_PROPERTY(bool videoTorchOn READ isVideoTorchOn WRITE setVideoTorchOn NOTIFY videoTorchOnChanged);
+
+  Q_PROPERTY(bool showToolBar READ isToolBarShown WRITE setToolBarShown NOTIFY toolBarShownChanged);
+  Q_PROPERTY(bool videoMuted READ isVideoMuted WRITE setVideoMuted NOTIFY videoMutedChanged);
+
+  Q_PROPERTY(bool gridEnabled READ isGridEnabled WRITE setGridEnabled NOTIFY gridEnabledChanged);
+
+  Q_PROPERTY(bool faceDetectionEnabled READ isFaceDetectionEnabled WRITE setFaceDetectionEnabled NOTIFY faceDetectionEnabledChanged);
+  Q_PROPERTY(bool zoomAsShutter READ isZoomAsShutterEnabled WRITE setZoomAsShutterEnabled NOTIFY zoomAsShutterChanged);
+  Q_PROPERTY(bool proximityAsShutter READ isProximityAsShutterEnabled WRITE setProximityAsShutterEnabled NOTIFY proximityAsShutterChanged);
+  Q_PROPERTY(int device READ device WRITE setDevice NOTIFY deviceChanged);
+
 public:
   Settings(QObject *parent = 0);
   ~Settings();
@@ -38,49 +77,90 @@ public:
   QString creatorName() const;
   void setCreatorName(const QString& name);
 
-  int postCaptureTimeout() const;
-  void setPostCaptureTimeout(int timeout);
-
   bool useGps() const;
   void setUseGps(bool enable);
 
   bool useGeotags() const;
   void setUseGeotags(bool enable);
 
-  int imageSceneMode() const;
+  int imageSceneMode();
   void setImageSceneMode(int mode);
 
-  int imageColorFilter() const;
+  int imageColorFilter();
   void setImageColorFilter(int filter);
 
-  int imageWhiteBalance() const;
+  int imageWhiteBalance();
   void setImageWhiteBalance(int wb);
 
-  qreal imageEvComp() const;
+  qreal imageEvComp();
   void setImageEvComp(qreal ev);
 
-  int videoSceneMode() const;
+  int videoSceneMode();
   void setVideoSceneMode(int mode);
 
-  int videoColorFilter() const;
+  int videoColorFilter();
   void setVideoColorFilter(int filter);
 
-  int videoWhiteBalance() const;
+  int videoWhiteBalance();
   void setVideoWhiteBalance(int wb);
 
-  qreal videoEvComp() const;
+  qreal videoEvComp();
   void setVideoEvComp(qreal ev);
 
-  int imageFlashMode() const;
+  int imageFlashMode();
   void setImageFlashMode(int mode);
 
-  int imageIso() const;
+  int imageIso();
   void setImageIso(int iso);
 
+  QString imageAspectRatio();
+  void setImageAspectRatio(const QString& aspectRatio);
+
+  QString imageResolution();
+  void setImageResolution(const QString& resolution);
+
+  QString videoAspectRatio();
+  void setVideoAspectRatio(const QString& aspectRatio);
+
+  QString videoResolution();
+  void setVideoResolution(const QString& resolution);
+
+  bool isSoundEnabled() const;
+  void setSoundEnabled(bool enabled);
+
+  bool isVideoTorchOn();
+  void setVideoTorchOn(bool on);
+
+  bool isToolBarShown() const;
+  void setToolBarShown(bool shown);
+
+  bool isVideoMuted() const;
+  void setVideoMuted(bool muted);
+
+  bool isGridEnabled() const;
+  void setGridEnabled(bool enabled);
+
+  bool isFaceDetectionEnabled() const;
+  void setFaceDetectionEnabled(bool enabled);
+
+  bool isZoomAsShutterEnabled() const;
+  void setZoomAsShutterEnabled(bool enabled);
+
+  bool isProximityAsShutterEnabled() const;
+  void setProximityAsShutterEnabled(bool enabled);
+
+  int device() const;
+  void setDevice(int device);
+
+  QString fileNamingStamp(const QString& id) const;
+  void setFileNamingStamp(const QString& id, const QString& stamp);
+
+  int fileNamingCounter(const QString& id) const;
+  void setFileNamingCounter(const QString& id, int counter);
+
 signals:
   void modeChanged();
   void creatorNameChanged();
-  void postCaptureTimeoutChanged();
   void useGpsChanged();
   void useGeotagsChanged();
   void imageSceneModeChanged();
@@ -93,9 +173,28 @@ signals:
   void videoEvCompChanged();
   void imageFlashModeChanged();
   void imageIsoChanged();
+  void imageAspectRatioChanged();
+  void imageResolutionChanged();
+  void videoAspectRatioChanged();
+  void videoResolutionChanged();
+  void soundEnabledChanged();
+  void videoTorchOnChanged();
+  void toolBarShownChanged();
+  void videoMutedChanged();
+  void gridEnabledChanged();
+  void faceDetectionEnabledChanged();
+  void zoomAsShutterChanged();
+  void proximityAsShutterChanged();
+  void deviceAboutToChange();
+  void deviceChanged();
 
 private:
+  DeviceSettings *deviceSettings();
+  QVariant deviceValue(const char *key, const QVariant& defaultValue);
+  void setDeviceValue(const char *key, const QVariant& value);
+
   QSettings *m_settings;
+  DeviceSettings *m_device;
 };
 
 #endif /* SETTINGS_H */