Revert "Implemented per device resolution setting and selection"
authorMohammed Sameer <msameer@foolab.org>
Fri, 16 Aug 2013 18:22:26 +0000 (21:22 +0300)
committerMohammed Sameer <msameer@foolab.org>
Fri, 16 Aug 2013 18:22:26 +0000 (21:22 +0300)
This reverts commit 04e7179e1a1fe4957dd38ccf9b9555f02e9b4b83.

Conflicts:
qml/CameraSettings.qml
qml/ImageOverlay.qml
qml/VideoOverlay.qml

qml/ImageResolutionSettings.qml
qml/MainPage.qml
qml/VideoOverlay.qml
qml/VideoResolutionSettings.qml
src/settings.cpp
src/settings.h

index b968b95..df1b6b1 100644 (file)
@@ -28,11 +28,6 @@ Column {
 
     spacing: 10
 
-    property string __aspectRatio: settings.device == 1 ?
-        settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
-    property string __resolution: settings.device == 1 ?
-        settings.secondaryImageResolution : settings.primaryImageResolution
-
     SectionHeader {
         text: qsTr("Aspect ratio")
         visible: aspectRatioRow.visible
@@ -49,14 +44,8 @@ Column {
             model: imageSettings.aspectRatios
             delegate: CameraButton {
                 text: qsTr(modelData)
-                checked: __aspectRatio == modelData
-                onClicked: {
-                    if (settings.device == 1) {
-                        settings.secondaryImageAspectRatio = modelData
-                    } else {
-                        settings.primaryImageAspectRatio = modelData
-                    }
-                }
+                checked: settings.imageAspectRatio == modelData
+                onClicked: settings.imageAspectRatio = modelData
             }
         }
     }
@@ -76,34 +65,19 @@ Column {
         Binding {
             target: imageSettings.resolutions
             property: "aspectRatio"
-            value: settings.primaryImageAspectRatio
-            when: settings.device == 0
-        }
-
-        Binding {
-            target: imageSettings.resolutions
-            property: "aspectRatio"
-            value: settings.secondaryImageAspectRatio
-            when: settings.device == 1
+            value: settings.imageAspectRatio
         }
 
         Repeater {
             id: resolutions
-
-            model: imageSettings.resolutions.aspectRatio == __aspectRatio ?
+            model: imageSettings.resolutions.aspectRatio == settings.imageAspectRatio ?
                 imageSettings.resolutions : undefined
 
             delegate: CameraButton {
                 capitalize: true
                 text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
-                checked: __resolution == resolutionName
-                onClicked: {
-                    if (settings.device == 1) {
-                        settings.secondaryImageResolution = resolutionName
-                    } else {
-                        settings.primaryImageResolution = resolutionName
-                    }
-                }
+                checked: settings.imageResolution == resolutionName
+                onClicked: settings.imageResolution = resolutionName
             }
         }
     }
index 863a58c..90ab26e 100644 (file)
@@ -197,10 +197,7 @@ CameraPage {
         camera: viewfinder.camera
 
         function setImageResolution() {
-            var aspectRatio = settings.device == 1 ? settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
-            var resolution = settings.device == 1 ? settings.secondaryImageResolution : settings.primaryImageResolution
-
-            if (!imageSettings.setResolution(aspectRatio, resolution)) {
+            if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
                 showError(qsTr("Failed to set required resolution"))
             }
         }
@@ -217,10 +214,7 @@ CameraPage {
         camera: viewfinder.camera
 
         function setVideoResolution() {
-            var aspectRatio = settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
-            var resolution = settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
-
-            if (!videoSettings.setResolution(aspectRatio, resolution)) {
+            if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
                 showError(qsTr("Failed to set required resolution"))
             }
         }
@@ -235,15 +229,17 @@ CameraPage {
     Connections {
         target: settings
 
-        onPrimaryImageResolutionChanged: imageSettings.setImageResolution()
-        onPrimaryImageAspectRatioChanged: imageSettings.setImageResolution()
-        onSecondaryImageResolutionChanged: imageSettings.setImageResolution()
-        onSecondaryImageAspectRatioChanged: imageSettings.setImageResolution()
+        onImageAspectRatioChanged: {
+            imageSettings.setImageResolution()
+        }
+
+        onImageResolutionChanged: {
+            imageSettings.setImageResolution()
+        }
 
-        onPrimaryVideoResolutionChanged: videoSettings.setVideoResolution()
-        onPrimaryVideoAspectRatioChanged: videoSettings.setVideoResolution()
-        onSecondaryVideoResolutionChanged: videoSettings.setVideoResolution()
-        onSecondaryVideoAspectRatioChanged: videoSettings.setVideoResolution()
+        onVideoResolutionChanged: {
+            videoSettings.setVideoResolution()
+        }
     }
 
     ModeController {
index 48ce2ff..24d44aa 100644 (file)
@@ -150,9 +150,8 @@ Item {
 
             Indicator {
                 id: resolutionIndicator
-                property string videoResolution: settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
-                property string videoRatio: settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
-                source: cameraTheme.videoIcon(videoRatio, videoResolution, settings.device)
+                source: cameraTheme.videoIcon(settings.videoAspectRatio,
+                    settings.videoResolution, settings.device)
             }
 
             Indicator {
index aa89d10..c105c55 100644 (file)
@@ -28,9 +28,6 @@ Column {
 
     spacing: 10
 
-    property string __resolution: settings.device == 1 ?
-        settings.secondaryVideoResolution : settings.primaryVideoResolution
-
     visible: videoSettings.resolutions.count > 1
 
     SectionHeader {
@@ -50,14 +47,8 @@ Column {
             delegate: CameraButton {
                 capitalize: true
                 text: qsTr("%1 %2").arg(resolutionName).arg(resolution)
-                checked: __resolution == resolutionName
-                onClicked: {
-                    if (settings.device == 1) {
-                        settings.secondaryVideoResolution = resolutionName
-                    } else {
-                        settings.primaryVideoResolution = resolutionName
-                    }
-                }
+                checked: settings.videoResolution == resolutionName
+                onClicked: settings.videoResolution = resolutionName
             }
         }
     }
index 52c87d5..1d099a0 100644 (file)
@@ -33,6 +33,9 @@
 #define DEFAULT_EV_COMP                 0.0
 #define DEFAULT_FLASH_MODE              0
 #define DEFAULT_IMAGE_ISO               0
+#define DEFAULT_IMAGE_RESOLUTION        "high"
+#define DEFAULT_IMAGE_ASPECT_RATIO      "16:9"
+#define DEFAULT_VIDEO_RESOLUTION        "high"
 #define DEFAULT_SOUND_ENABLED           true
 #define DEFAULT_VIDEO_TORCH_ON          false
 #define DEFAULT_SHOW_TOOL_BAR           false
 #define DEFAULT_ZOOM_AS_SHUTTER         false
 #define DEFAULT_DEVICE                  0
 
-#define DEFAULT_PRIMARY_IMAGE_RESOLUTION        "high"
-#define DEFAULT_PRIMARY_IMAGE_ASPECT_RATIO      "16:9"
-#define DEFAULT_PRIMARY_VIDEO_RESOLUTION        "high"
-#define DEFAULT_PRIMARY_VIDEO_ASPECT_RATIO      "16:9"
-
-#define DEFAULT_SECONDARY_IMAGE_RESOLUTION       "low"
-#define DEFAULT_SECONDARY_IMAGE_ASPECT_RATIO     "4:3"
-#define DEFAULT_SECONDARY_VIDEO_RESOLUTION       "low"
-#define DEFAULT_SECONDARY_VIDEO_ASPECT_RATIO     "4:3"
-
 Settings::Settings(QObject *parent) :
   QObject(parent),
   m_settings(new QSettings(PATH, QSettings::IniFormat, this)) {
@@ -229,6 +222,52 @@ void Settings::setImageIso(int iso) {
   }
 }
 
+QString Settings::imageAspectRatio() const {
+  return m_settings->value("image/aspectRatio", DEFAULT_IMAGE_ASPECT_RATIO).toString();
+}
+
+void Settings::setImageAspectRatio(const QString& aspectRatio) {
+  if (aspectRatio != imageAspectRatio()) {
+    m_settings->setValue("image/aspectRatio", aspectRatio);
+    emit imageAspectRatioChanged();
+  }
+}
+
+QString Settings::imageResolution() const {
+  return m_settings->value("image/resolution", DEFAULT_IMAGE_RESOLUTION).toString();
+}
+
+void Settings::setImageResolution(const QString& resolution) {
+  if (resolution != imageResolution()) {
+    m_settings->setValue("image/resolution", resolution);
+    emit imageResolutionChanged();
+  }
+}
+
+QString Settings::videoAspectRatio() const {
+  // This is not used for anything so we will return an empty string for now
+  // which will make the backend return all resolutions.
+
+  return QString();
+}
+
+void Settings::setVideoAspectRatio(const QString& aspectRatio) {
+  Q_UNUSED(aspectRatio);
+
+  // This is not used for anything so we will just ignore it.
+}
+
+QString Settings::videoResolution() const {
+  return m_settings->value("video/resolution", DEFAULT_VIDEO_RESOLUTION).toString();
+}
+
+void Settings::setVideoResolution(const QString& resolution) {
+  if (resolution != videoResolution()) {
+    m_settings->setValue("video/resolution", resolution);
+    emit videoResolutionChanged();
+  }
+}
+
 bool Settings::isSoundEnabled() const {
   return m_settings->value("camera/soundEnabled", DEFAULT_SOUND_ENABLED).toBool();
 }
@@ -318,99 +357,3 @@ void Settings::setDevice(int device) {
     emit deviceChanged();
   }
 }
-
-QString Settings::primaryImageAspectRatio() const {
-  return m_settings->value("image/primaryAspectRatio",
-                          DEFAULT_PRIMARY_IMAGE_ASPECT_RATIO).toString();
-}
-
-void Settings::setPrimaryImageAspectRatio(const QString& aspectRatio) {
-  if (primaryImageAspectRatio() != aspectRatio) {
-    m_settings->setValue("image/primaryAspectRatio", aspectRatio);
-    emit primaryImageAspectRatioChanged();
-  }
-}
-
-QString Settings::primaryImageResolution() const {
-  return m_settings->value("image/primaryResolution",
-                          DEFAULT_PRIMARY_IMAGE_RESOLUTION).toString();
-}
-
-void Settings::setPrimaryImageResolution(const QString& resolution) {
-  if (primaryImageResolution() != resolution) {
-    m_settings->setValue("image/primaryResolution", resolution);
-    emit primaryImageResolutionChanged();
-  }
-}
-
-QString Settings::primaryVideoAspectRatio() const {
-  return m_settings->value("video/primaryAspectRatio",
-                          DEFAULT_PRIMARY_VIDEO_ASPECT_RATIO).toString();
-}
-
-void Settings::setPrimaryVideoAspectRatio(const QString& aspectRatio) {
-  if (primaryVideoAspectRatio() != aspectRatio) {
-    m_settings->setValue("video/primaryAspectRatio", aspectRatio);
-    emit primaryVideoAspectRatioChanged();
-  }
-}
-
-QString Settings::primaryVideoResolution() const {
-  return m_settings->value("video/primaryResolution",
-                          DEFAULT_PRIMARY_VIDEO_RESOLUTION).toString();
-}
-
-void Settings::setPrimaryVideoResolution(const QString& resolution) {
-  if (primaryVideoResolution() != resolution) {
-    m_settings->setValue("video/primaryResolution", resolution);
-    emit primaryVideoResolutionChanged();
-  }
-}
-
-QString Settings::secondaryImageAspectRatio() const {
-  return m_settings->value("image/secondaryAspectRatio",
-                          DEFAULT_SECONDARY_IMAGE_ASPECT_RATIO).toString();
-}
-
-void Settings::setSecondaryImageAspectRatio(const QString& aspectRatio) {
-  if (secondaryImageAspectRatio() != aspectRatio) {
-    m_settings->setValue("image/secondaryAspectRatio", aspectRatio);
-    emit secondaryImageAspectRatioChanged();
-  }
-}
-
-QString Settings::secondaryImageResolution() const {
-  return m_settings->value("image/secondaryResolution",
-                          DEFAULT_SECONDARY_IMAGE_RESOLUTION).toString();
-}
-
-void Settings::setSecondaryImageResolution(const QString& resolution) {
-  if (secondaryImageResolution() != resolution) {
-    m_settings->setValue("image/secondaryResolution", resolution);
-    emit secondaryImageResolutionChanged();
-  }
-}
-
-QString Settings::secondaryVideoAspectRatio() const {
-  return m_settings->value("video/secondaryAspectRatio",
-                          DEFAULT_SECONDARY_VIDEO_ASPECT_RATIO).toString();
-}
-
-void Settings::setSecondaryVideoAspectRatio(const QString& aspectRatio) {
-  if (secondaryVideoAspectRatio() != aspectRatio) {
-    m_settings->setValue("video/secondaryAspectRatio", aspectRatio);
-    emit secondaryVideoAspectRatioChanged();
-  }
-}
-
-QString Settings::secondaryVideoResolution() const {
-  return m_settings->value("video/secondaryResolution",
-                          DEFAULT_SECONDARY_VIDEO_RESOLUTION).toString();
-}
-
-void Settings::setSecondaryVideoResolution(const QString& resolution) {
-  if (secondaryVideoResolution() != resolution) {
-    m_settings->setValue("video/secondaryResolution", resolution);
-    emit secondaryVideoResolutionChanged();
-  }
-}
index 807712d..b27dea6 100644 (file)
@@ -47,14 +47,11 @@ 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 primaryImageAspectRatio READ primaryImageAspectRatio WRITE setPrimaryImageAspectRatio NOTIFY primaryImageAspectRatioChanged);
-  Q_PROPERTY(QString primaryImageResolution READ primaryImageResolution WRITE setPrimaryImageResolution NOTIFY primaryImageResolutionChanged);
-  Q_PROPERTY(QString primaryVideoAspectRatio READ primaryVideoAspectRatio WRITE setPrimaryVideoAspectRatio NOTIFY primaryVideoAspectRatioChanged);
-  Q_PROPERTY(QString primaryVideoResolution READ primaryVideoResolution WRITE setPrimaryVideoResolution NOTIFY primaryVideoResolutionChanged);
-  Q_PROPERTY(QString secondaryImageAspectRatio READ secondaryImageAspectRatio WRITE setSecondaryImageAspectRatio NOTIFY secondaryImageAspectRatioChanged);
-  Q_PROPERTY(QString secondaryImageResolution READ secondaryImageResolution WRITE setSecondaryImageResolution NOTIFY secondaryImageResolutionChanged);
-  Q_PROPERTY(QString secondaryVideoAspectRatio READ secondaryVideoAspectRatio WRITE setSecondaryVideoAspectRatio NOTIFY secondaryVideoAspectRatioChanged);
-  Q_PROPERTY(QString secondaryVideoResolution READ secondaryVideoResolution WRITE setSecondaryVideoResolution NOTIFY secondaryVideoResolutionChanged);
+  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);
@@ -114,6 +111,18 @@ public:
   int imageIso() const;
   void setImageIso(int iso);
 
+  QString imageAspectRatio() const;
+  void setImageAspectRatio(const QString& aspectRatio);
+
+  QString imageResolution() const;
+  void setImageResolution(const QString& resolution);
+
+  QString videoAspectRatio() const;
+  void setVideoAspectRatio(const QString& aspectRatio);
+
+  QString videoResolution() const;
+  void setVideoResolution(const QString& resolution);
+
   bool isSoundEnabled() const;
   void setSoundEnabled(bool enabled);
 
@@ -138,30 +147,6 @@ public:
   int device() const;
   void setDevice(int device);
 
-  QString primaryImageAspectRatio() const;
-  void setPrimaryImageAspectRatio(const QString& aspectRatio);
-
-  QString primaryImageResolution() const;
-  void setPrimaryImageResolution(const QString& resolution);
-
-  QString primaryVideoAspectRatio() const;
-  void setPrimaryVideoAspectRatio(const QString& aspectRatio);
-
-  QString primaryVideoResolution() const;
-  void setPrimaryVideoResolution(const QString& resolution);
-
-  QString secondaryImageAspectRatio() const;
-  void setSecondaryImageAspectRatio(const QString& aspectRatio);
-
-  QString secondaryImageResolution() const;
-  void setSecondaryImageResolution(const QString& resolution);
-
-  QString secondaryVideoAspectRatio() const;
-  void setSecondaryVideoAspectRatio(const QString& aspectRatio);
-
-  QString secondaryVideoResolution() const;
-  void setSecondaryVideoResolution(const QString& resolution);
-
 signals:
   void modeChanged();
   void creatorNameChanged();
@@ -177,6 +162,10 @@ signals:
   void videoEvCompChanged();
   void imageFlashModeChanged();
   void imageIsoChanged();
+  void imageAspectRatioChanged();
+  void imageResolutionChanged();
+  void videoAspectRatioChanged();
+  void videoResolutionChanged();
   void soundEnabledChanged();
   void videoTorchOnChanged();
   void toolBarShownChanged();
@@ -185,14 +174,6 @@ signals:
   void faceDetectionEnabledChanged();
   void zoomAsShutterChanged();
   void deviceChanged();
-  void primaryImageAspectRatioChanged();
-  void primaryImageResolutionChanged();
-  void primaryVideoAspectRatioChanged();
-  void primaryVideoResolutionChanged();
-  void secondaryImageAspectRatioChanged();
-  void secondaryImageResolutionChanged();
-  void secondaryVideoAspectRatioChanged();
-  void secondaryVideoResolutionChanged();
 
 private:
   QSettings *m_settings;