Cleaned up some commented out defines
[harmattan/cameraplus] / lib / qtcamimagemode.cpp
index 05a6d10..8a913e5 100644 (file)
@@ -78,10 +78,11 @@ void QtCamImageMode::applySettings() {
   // we use. For now we will not set any FPS.
   d_ptr->setCaps("image-capture-caps", d->resolution.captureResolution(), -1);
 
-  setPreviewSize(d->resolution.previewResolution());
+  d_ptr->setPreviewSize(d->resolution.previewResolution());
 
-  // TODO: ?
-  // d_ptr->resetCaps("video-capture-caps");
+  // If we don't reset the caps then: if we switch from video to image then we fail
+  // the next time we restart the pipeline.
+  d_ptr->resetCaps("video-capture-caps");
 }
 
 void QtCamImageMode::start() {
@@ -101,7 +102,7 @@ bool QtCamImageMode::capture(const QString& fileName) {
     return false;
   }
 
-  setFileName(fileName);
+  d_ptr->setFileName(fileName);
 
   g_object_set(d_ptr->dev->cameraBin, "location", fileName.toUtf8().data(), NULL);
   g_signal_emit_by_name(d_ptr->dev->cameraBin, "start-capture", NULL);
@@ -112,7 +113,14 @@ bool QtCamImageMode::capture(const QString& fileName) {
 bool QtCamImageMode::setResolution(const QtCamImageResolution& resolution) {
   d->resolution = resolution;
 
-  if (!d_ptr->dev->q_ptr->isRunning() || !d_ptr->dev->q_ptr->isIdle()) {
+  if (!d_ptr->dev->q_ptr->isRunning()) {
+    // We will return true here because setting the resolution on a non-running pipeline
+    // doesn't make much sense (Probably the only use case is as a kind of optimization only).
+    // We will set it anyway when the pipeline gets started.
+    return true;
+  }
+
+  if (!d_ptr->dev->q_ptr->isIdle()) {
     return false;
   }