Added QtCamImageMode captureStarted() and captureEnded() signals. Expose them to...
authorMohammed Sameer <msameer@foolab.org>
Sun, 4 Aug 2013 00:37:00 +0000 (03:37 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 4 Aug 2013 00:37:00 +0000 (03:37 +0300)
declarative/imagemode.cpp
declarative/imagemode.h
lib/qtcamdevice.h
lib/qtcamimagemode.h
lib/qtcamnotifications.cpp

index a58bf99..4f2fd23 100644 (file)
@@ -39,11 +39,21 @@ bool ImageMode::capture(const QString& fileName) {
 }
 
 void ImageMode::preChangeMode() {
+  if (m_image) {
+    QObject::disconnect(m_image, SIGNAL(captureStarted()), this, SIGNAL(captureStarted()));
+    QObject::disconnect(m_image, SIGNAL(captureEnded()), this, SIGNAL(captureEnded()));
+  }
+
   m_image = 0;
 }
 
 void ImageMode::postChangeMode() {
   m_image = m_cam->device()->imageMode();
+
+  if (m_image) {
+    QObject::connect(m_image, SIGNAL(captureStarted()), this, SIGNAL(captureStarted()));
+    QObject::connect(m_image, SIGNAL(captureEnded()), this, SIGNAL(captureEnded()));
+  }
 }
 
 void ImageMode::changeMode() {
index 0c23a08..a169d1a 100644 (file)
@@ -36,6 +36,10 @@ public:
 
   Q_INVOKABLE bool capture(const QString& fileName);
 
+signals:
+  void captureStarted();
+  void captureEnded();
+
 protected:
   virtual void preChangeMode();
   virtual void postChangeMode();
index 3ede324..5a73842 100644 (file)
@@ -86,6 +86,7 @@ private:
   friend class QtCamVideoMute;
   friend class QtCamAutoFocusPrivate;
   friend class QtCamRoiPrivate;
+  friend class QtCamNotifications;
 
   QtCamDevicePrivate *d_ptr;
 };
index 3444dc0..1e53449 100644 (file)
@@ -49,6 +49,10 @@ public:
 
   QtCamImageSettings *settings() const;
 
+signals:
+  void captureStarted();
+  void captureEnded();
+
 protected:
   virtual void start();
   virtual void stop();
index 327b6cc..717e7ae 100644 (file)
@@ -21,6 +21,8 @@
 #include "qtcamnotifications.h"
 #include "qtcamnotifications_p.h"
 #include "qtcamdevice.h"
+#include "qtcamdevice_p.h"
+#include "qtcamimagemode.h"
 #ifndef GST_USE_UNSTABLE_API
 #define GST_USE_UNSTABLE_API
 #endif /* GST_USE_UNSTABLE_API */
@@ -56,6 +58,11 @@ QtCamNotifications::QtCamNotifications(QtCamDevice *dev, QObject *parent) :
 
   QObject::connect(d_ptr->af, SIGNAL(messageSent(GstMessage *)),
                   this, SLOT(autoFocusStatusChanged(GstMessage *)));
+
+  QObject::connect(d_ptr->imageStart, SIGNAL(messageSent(GstMessage *)),
+                  d_ptr->dev->d_ptr->image, SIGNAL(captureStarted()), Qt::AutoConnection);
+  QObject::connect(d_ptr->imageEnd, SIGNAL(messageSent(GstMessage *)),
+                  d_ptr->dev->d_ptr->image, SIGNAL(captureEnded()), Qt::AutoConnection);
 }
 
 QtCamNotifications::~QtCamNotifications() {