Emit canCaptureChanged on the active mode when ready-for-capture changes
authorMohammed Sameer <msameer@foolab.org>
Wed, 29 Aug 2012 14:19:37 +0000 (17:19 +0300)
committerMohammed Sameer <msameer@foolab.org>
Thu, 6 Sep 2012 16:10:09 +0000 (19:10 +0300)
lib/qtcamdevice.cpp
lib/qtcamdevice_p.h

index 5db3fd2..93139e3 100644 (file)
@@ -55,6 +55,9 @@ QtCamDevice::QtCamDevice(QtCamConfig *config, const QString& name,
   g_signal_connect(d_ptr->cameraBin, "notify::idle",
                   G_CALLBACK(QtCamDevicePrivate::on_idle_changed), d_ptr);
 
+  g_signal_connect(d_ptr->wrapperVideoSource, "notify::ready-for-capture",
+                  G_CALLBACK(QtCamDevicePrivate::on_ready_for_capture_changed), d_ptr);
+
   d_ptr->image = new QtCamImageMode(d_ptr, this);
   d_ptr->video = new QtCamVideoMode(d_ptr, this);
 }
index 2a3a70c..6056605 100644 (file)
@@ -8,6 +8,7 @@
 #include "qtcamconfig.h"
 #include "qtcamviewfinder.h"
 #include "qtcamdevice.h"
+#include "qtcammode.h"
 
 class QtCamGStreamerMessageListener;
 class QtCamMode;
@@ -156,6 +157,18 @@ public:
     return ready == TRUE;
   }
 
+  static void on_ready_for_capture_changed(GObject *obj, GParamSpec *pspec,
+                                          QtCamDevicePrivate *d)  {
+    Q_UNUSED(obj);
+    Q_UNUSED(pspec);
+
+    if (!d->active) {
+      return;
+    }
+
+    QMetaObject::invokeMethod(d->active, "canCaptureChanged", Qt::QueuedConnection);
+  }
+
   static void on_idle_changed(GObject *obj, GParamSpec *pspec, QtCamDevicePrivate *d) {
     Q_UNUSED(obj);
     Q_UNUSED(pspec);