From 9220da744cd45c855e6028a84cd7583320079a2f Mon Sep 17 00:00:00 2001 From: Mohammed Sameer Date: Sun, 15 Sep 2013 21:41:44 +0300 Subject: [PATCH] Added enablePreview() and disablePreview() to QtCamMode Using these calls we can enable and disable posting of capture preview images --- lib/qtcamimagemode.cpp | 6 +++++- lib/qtcamimagemode.h | 2 ++ lib/qtcammode.cpp | 4 ++++ lib/qtcammode.h | 3 +++ lib/qtcamvideomode.cpp | 6 +++++- lib/qtcamvideomode.h | 2 ++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/qtcamimagemode.cpp b/lib/qtcamimagemode.cpp index 6aae13b..e3217c4 100644 --- a/lib/qtcamimagemode.cpp +++ b/lib/qtcamimagemode.cpp @@ -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); - 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. @@ -147,3 +147,7 @@ QtCamImageSettings *QtCamImageMode::settings() const { QtCamImageResolution QtCamImageMode::currentResolution() { return d->resolution; } + +void QtCamImageMode::enablePreview() { + d_ptr->setPreviewSize(d->resolution.previewResolution()); +} diff --git a/lib/qtcamimagemode.h b/lib/qtcamimagemode.h index 47d51c1..173761a 100644 --- a/lib/qtcamimagemode.h +++ b/lib/qtcamimagemode.h @@ -51,6 +51,8 @@ public: QtCamImageSettings *settings() const; + void enablePreview(); + signals: void captureStarted(); void captureEnded(); diff --git a/lib/qtcammode.cpp b/lib/qtcammode.cpp index 8e72b55..81d5781 100644 --- a/lib/qtcammode.cpp +++ b/lib/qtcammode.cpp @@ -159,3 +159,7 @@ bool QtCamMode::isActive() { QtCamDevice *QtCamMode::device() const { return d_ptr->dev->q_ptr; } + +void QtCamMode::disablePreview() { + d_ptr->setPreviewSize(QSize()); +} diff --git a/lib/qtcammode.h b/lib/qtcammode.h index acc3645..e447cc6 100644 --- a/lib/qtcammode.h +++ b/lib/qtcammode.h @@ -52,6 +52,9 @@ public: QtCamDevice *device() const; + virtual void enablePreview() = 0; + void disablePreview(); + public slots: void activate(); diff --git a/lib/qtcamvideomode.cpp b/lib/qtcamvideomode.cpp index 762c108..d4b8035 100644 --- a/lib/qtcamvideomode.cpp +++ b/lib/qtcamvideomode.cpp @@ -133,7 +133,7 @@ void QtCamVideoMode::applySettings() { 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"); @@ -239,4 +239,8 @@ QtCamVideoResolution QtCamVideoMode::currentResolution() { return d->resolution; } +void QtCamVideoMode::enablePreview() { + d_ptr->setPreviewSize(d->resolution.previewResolution()); +} + #include "moc_qtcamvideomode.cpp" diff --git a/lib/qtcamvideomode.h b/lib/qtcamvideomode.h index 77a489e..784ec53 100644 --- a/lib/qtcamvideomode.h +++ b/lib/qtcamvideomode.h @@ -55,6 +55,8 @@ public: QtCamVideoSettings *settings(); + void enablePreview(); + public slots: void stopRecording(bool sync); -- 2.25.1