Added stopping() signal and emit stopping(), stopped() and started()
authorMohammed Sameer <msameer@foolab.org>
Wed, 29 Aug 2012 14:04:16 +0000 (17:04 +0300)
committerMohammed Sameer <msameer@foolab.org>
Thu, 6 Sep 2012 16:10:09 +0000 (19:10 +0300)
lib/qtcamdevice.cpp
lib/qtcamdevice.h
lib/qtcamdevice_p.h

index f93efb3..5db3fd2 100644 (file)
@@ -48,8 +48,9 @@ QtCamDevice::QtCamDevice(QtCamConfig *config, const QString& name,
 
   QObject::connect(d_ptr->listener, SIGNAL(error(const QString&, int, const QString&)),
                   this, SLOT(_d_error(const QString&, int, const QString&)));
-  QObject::connect(d_ptr->listener, SIGNAL(started()), this, SIGNAL(started()));
-  QObject::connect(d_ptr->listener, SIGNAL(stopped()), this, SIGNAL(stopped()));
+  QObject::connect(d_ptr->listener, SIGNAL(started()), this, SLOT(_d_started()));
+  QObject::connect(d_ptr->listener, SIGNAL(stopped()), this, SLOT(_d_stopped()));
+  QObject::connect(d_ptr->listener, SIGNAL(stopping()), this, SLOT(_d_stopping()));
 
   g_signal_connect(d_ptr->cameraBin, "notify::idle",
                   G_CALLBACK(QtCamDevicePrivate::on_idle_changed), d_ptr);
index b5c7ae5..1b6d229 100644 (file)
@@ -42,11 +42,18 @@ public:
 signals:
   void error(const QString& message, int code, const QString& debug);
   void started();
+  void stopping();
   void stopped();
   void idleStateChanged(bool isIdle);
+  void modeChanged();
+  void runningStateChanged(bool running);
 
 private:
   Q_PRIVATE_SLOT(d_ptr, void _d_error(const QString&, int, const QString&))
+  Q_PRIVATE_SLOT(d_ptr, void _d_started())
+  Q_PRIVATE_SLOT(d_ptr, void _d_stopped())
+  Q_PRIVATE_SLOT(d_ptr, void _d_stopping())
+
   friend class QtCamMetaData;
   QtCamDevicePrivate *d_ptr;
 };
index 34d7022..8315bdb 100644 (file)
@@ -110,6 +110,30 @@ public:
                              Q_ARG(int, code), Q_ARG(QString, debug));
   }
 
+  void _d_stopped() {
+    QMetaObject::invokeMethod(q_ptr, "stopped");
+  }
+
+  void _d_stopping() {
+    if (active) {
+      QMetaObject::invokeMethod(active, "canCaptureChanged", Qt::QueuedConnection);
+    }
+
+    QMetaObject::invokeMethod(q_ptr, "stopping", Qt::QueuedConnection);
+    QMetaObject::invokeMethod(q_ptr, "runningStateChanged", Qt::QueuedConnection,
+                             Q_ARG(bool, false));
+  }
+
+  void _d_started() {
+    if (active) {
+      QMetaObject::invokeMethod(active, "canCaptureChanged", Qt::QueuedConnection);
+    }
+
+    QMetaObject::invokeMethod(q_ptr, "started", Qt::QueuedConnection);
+    QMetaObject::invokeMethod(q_ptr, "runningStateChanged", Qt::QueuedConnection,
+                             Q_ARG(bool, true));
+  }
+
   void setAudioCaptureCaps() {
     QString captureCaps = conf->audioCaptureCaps();
     if (!captureCaps.isEmpty()) {