When night mode changes, we apply the mode settings again in order to use the night...
authorMohammed Sameer <msameer@foolab.org>
Sat, 8 Sep 2012 11:36:37 +0000 (14:36 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sat, 8 Sep 2012 11:38:23 +0000 (14:38 +0300)
lib/qtcamscene.cpp

index b0f6bf8..a18e196 100644 (file)
@@ -31,6 +31,23 @@ QtCamScene::SceneMode QtCamScene::value() {
 }
 
 bool QtCamScene::setValue(const QtCamScene::SceneMode& mode) {
+  SceneMode old = value();
+
   // Scene mode is always forced in order to reset the other capabilities.
-  return d_ptr->setIntValue(mode, true);
+  bool ret = d_ptr->setIntValue(mode, true);
+
+  if (!ret) {
+    return ret;
+  }
+
+  if (!d_ptr->dev || !d_ptr->dev->activeMode() || old == mode) {
+    return ret;
+  }
+
+  if (old == Night || mode == Night) {
+    // We must ask the mode to reset the settings to use night mode resolution if needed.
+    d_ptr->dev->activeMode()->applySettings();
+  }
+
+  return ret;
 }