Added enablePreview() and disablePreview() to QtCamMode
authorMohammed Sameer <msameer@foolab.org>
Sun, 15 Sep 2013 18:41:44 +0000 (21:41 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 15 Sep 2013 18:41:44 +0000 (21:41 +0300)
Using these calls we can enable and disable posting of capture preview images

lib/qtcamimagemode.cpp
lib/qtcamimagemode.h
lib/qtcammode.cpp
lib/qtcammode.h
lib/qtcamvideomode.cpp
lib/qtcamvideomode.h

index 6aae13b..e3217c4 100644 (file)
@@ -80,7 +80,7 @@ void QtCamImageMode::applySettings() {
   // we use. For now we will not set any FPS.
   d_ptr->setCaps("image-capture-caps", d->resolution.captureResolution(), -1);
 
   // we use. For now we will not set any FPS.
   d_ptr->setCaps("image-capture-caps", d->resolution.captureResolution(), -1);
 
-  d_ptr->setPreviewSize(d->resolution.previewResolution());
+  enablePreview();
 
   // 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.
 
   // 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.
@@ -147,3 +147,7 @@ QtCamImageSettings *QtCamImageMode::settings() const {
 QtCamImageResolution QtCamImageMode::currentResolution() {
   return d->resolution;
 }
 QtCamImageResolution QtCamImageMode::currentResolution() {
   return d->resolution;
 }
+
+void QtCamImageMode::enablePreview() {
+  d_ptr->setPreviewSize(d->resolution.previewResolution());
+}
index 47d51c1..173761a 100644 (file)
@@ -51,6 +51,8 @@ public:
 
   QtCamImageSettings *settings() const;
 
 
   QtCamImageSettings *settings() const;
 
+  void enablePreview();
+
 signals:
   void captureStarted();
   void captureEnded();
 signals:
   void captureStarted();
   void captureEnded();
index 8e72b55..81d5781 100644 (file)
@@ -159,3 +159,7 @@ bool QtCamMode::isActive() {
 QtCamDevice *QtCamMode::device() const {
   return d_ptr->dev->q_ptr;
 }
 QtCamDevice *QtCamMode::device() const {
   return d_ptr->dev->q_ptr;
 }
+
+void QtCamMode::disablePreview() {
+  d_ptr->setPreviewSize(QSize());
+}
index acc3645..e447cc6 100644 (file)
@@ -52,6 +52,9 @@ public:
 
   QtCamDevice *device() const;
 
 
   QtCamDevice *device() const;
 
+  virtual void enablePreview() = 0;
+  void disablePreview();
+
 public slots:
   void activate();
 
 public slots:
   void activate();
 
index 762c108..d4b8035 100644 (file)
@@ -133,7 +133,7 @@ void QtCamVideoMode::applySettings() {
 
   d_ptr->setCaps("video-capture-caps", d->resolution.captureResolution(), fps);
 
 
   d_ptr->setCaps("video-capture-caps", d->resolution.captureResolution(), fps);
 
-  d_ptr->setPreviewSize(d->resolution.previewResolution());
+  enablePreview();
 
   // Not sure this is needed but just in case.
   d_ptr->resetCaps("image-capture-caps");
 
   // Not sure this is needed but just in case.
   d_ptr->resetCaps("image-capture-caps");
@@ -239,4 +239,8 @@ QtCamVideoResolution QtCamVideoMode::currentResolution() {
   return d->resolution;
 }
 
   return d->resolution;
 }
 
+void QtCamVideoMode::enablePreview() {
+  d_ptr->setPreviewSize(d->resolution.previewResolution());
+}
+
 #include "moc_qtcamvideomode.cpp"
 #include "moc_qtcamvideomode.cpp"
index 77a489e..784ec53 100644 (file)
@@ -55,6 +55,8 @@ public:
 
   QtCamVideoSettings *settings();
 
 
   QtCamVideoSettings *settings();
 
+  void enablePreview();
+
 public slots:
   void stopRecording(bool sync);
 
 public slots:
   void stopRecording(bool sync);