Added classes for Notifications (Sound playback use case)
authorMohammed Sameer <msameer@foolab.org>
Sun, 23 Sep 2012 13:23:59 +0000 (16:23 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 23 Sep 2012 21:22:05 +0000 (00:22 +0300)
The main class is QtCamNotifications which emits various signals when
image capture starts and ends and video recording starts and ends.

QML bindings consist of a Notifications interface and a notifications property
for Camera element.

We cannot use simple signals because at least the image capture start notification
gets emitted from another thread for performance reasons.

16 files changed:
imports/camera.cpp
imports/camera.h
imports/imports.pro
imports/notifications.cpp [new file with mode: 0644]
imports/notifications.h [new file with mode: 0644]
imports/notificationscontainer.cpp [new file with mode: 0644]
imports/notificationscontainer.h [new file with mode: 0644]
imports/plugin.cpp
lib/lib.pro
lib/qtcamdevice.cpp
lib/qtcamdevice.h
lib/qtcamdevice_p.h
lib/qtcamgstreamermessagelistener.cpp
lib/qtcamnotifications.cpp [new file with mode: 0644]
lib/qtcamnotifications.h [new file with mode: 0644]
lib/qtcamvideomode.cpp

index 94790b3..eac909e 100644 (file)
@@ -26,6 +26,8 @@
 #include "qtcamvideomode.h"
 #include "qtcamgraphicsviewfinder.h"
 #include "qtcamconfig.h"
+#include "notifications.h"
+#include "notificationscontainer.h"
 
 // TODO: a viewfinder class that inherits QDeclarativeItem
 
@@ -34,7 +36,8 @@ Camera::Camera(QDeclarativeItem *parent) :
   m_cam(new QtCamera(this)),
   m_dev(0),
   m_vf(new QtCamGraphicsViewfinder(m_cam->config(), this)),
-  m_mode(Camera::ImageMode) {
+  m_mode(Camera::ImageMode),
+  m_notifications(new NotificationsContainer(this)) {
 
   // TODO:
 }
@@ -98,6 +101,8 @@ void Camera::setDeviceId(const QVariant& id) {
   QObject::connect(m_dev, SIGNAL(error(const QString&, int, const QString&)),
                   this, SIGNAL(error(const QString&, int, const QString&)));
 
+  m_notifications->setDevice(m_dev);
+
   emit deviceIdChanged();
   emit deviceChanged();
 }
@@ -180,3 +185,13 @@ QString Camera::imageSuffix() const {
 QString Camera::videoSuffix() const {
   return m_cam->config()->videoSuffix();
 }
+
+Notifications *Camera::notifications() const {
+  return m_notifications->notifications();
+}
+
+void Camera::setNotifications(Notifications *notifications) {
+  if (m_notifications->setNotifications(notifications)) {
+    emit notificationsChanged();
+  }
+}
index f5d10ab..fc7c666 100644 (file)
 
 #include <QDeclarativeItem>
 #include <QVariant>
+#include <QPointer>
 
 class QtCamera;
 class QtCamDevice;
 class QtCamGraphicsViewfinder;
+class Notifications;
+class NotificationsContainer;
 
 class Camera : public QDeclarativeItem {
   Q_OBJECT
@@ -40,6 +43,8 @@ class Camera : public QDeclarativeItem {
   Q_PROPERTY(bool running READ isRunning NOTIFY runningStateChanged);
   Q_PROPERTY(QString imageSuffix READ imageSuffix CONSTANT);
   Q_PROPERTY(QString videoSuffix READ videoSuffix CONSTANT);
+  Q_PROPERTY(Notifications *notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged);
+
   Q_ENUMS(CameraMode);
 
 public:
@@ -74,6 +79,9 @@ public:
   QString imageSuffix() const;
   QString videoSuffix() const;
 
+  Notifications *notifications() const;
+  void setNotifications(Notifications *notifications);
+
 signals:
   void deviceCountChanged();
   void deviceIdChanged();
@@ -82,6 +90,7 @@ signals:
   void idleStateChanged();
   void runningStateChanged();
   void error(const QString& message, int code, const QString& debug);
+  void notificationsChanged();
 
 protected:
   void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
@@ -94,6 +103,7 @@ private:
   QVariant m_id;
   QtCamGraphicsViewfinder *m_vf;
   CameraMode m_mode;
+  NotificationsContainer *m_notifications;
 };
 
 #endif /* CAMERA_H */
index 095a37a..39cda15 100644 (file)
@@ -14,10 +14,10 @@ HEADERS += plugin.h previewprovider.h camera.h mode.h imagemode.h videomode.h \
            capability.h zoom.h flash.h scene.h evcomp.h videotorch.h whitebalance.h \
            colortone.h exposure.h aperture.h iso.h noisereduction.h \
            flickerreduction.h mute.h metadata.h imagesettings.h imageresolutionmodel.h \
-           videosettings.h videoresolutionmodel.h
+           videosettings.h videoresolutionmodel.h notifications.h notificationscontainer.h
 
 SOURCES += plugin.cpp previewprovider.cpp camera.cpp mode.cpp imagemode.cpp videomode.cpp \
            capability.cpp zoom.cpp flash.cpp scene.cpp evcomp.cpp videotorch.cpp whitebalance.cpp \
            colortone.cpp exposure.cpp aperture.cpp iso.cpp noisereduction.cpp \
            flickerreduction.cpp mute.cpp metadata.cpp imagesettings.cpp imageresolutionmodel.cpp \
-           videosettings.cpp videoresolutionmodel.cpp
+           videosettings.cpp videoresolutionmodel.cpp notifications.cpp notificationscontainer.cpp
diff --git a/imports/notifications.cpp b/imports/notifications.cpp
new file mode 100644 (file)
index 0000000..b1a17cd
--- /dev/null
@@ -0,0 +1,29 @@
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "notifications.h"
+
+Notifications::Notifications() {
+
+}
+
+Notifications::~Notifications() {
+
+}
diff --git a/imports/notifications.h b/imports/notifications.h
new file mode 100644 (file)
index 0000000..6b429f7
--- /dev/null
@@ -0,0 +1,40 @@
+// -*- c++ -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef NOTIFICATIONS_H
+#define NOTIFICATIONS_H
+
+#include <QObject>
+
+class Notifications {
+public:
+  Notifications();
+  virtual ~Notifications();
+
+  virtual void imageCaptureStarted() = 0;
+  virtual void imageCaptureEnded() = 0;
+  virtual void videoRecordingStarted() = 0;
+  virtual void videoRecordingEnded() = 0;
+};
+Q_DECLARE_INTERFACE(Notifications, "org.foolab.qml.CameraPlus/1.0");
+
+#endif /* NOTIFICATIONS_H */
diff --git a/imports/notificationscontainer.cpp b/imports/notificationscontainer.cpp
new file mode 100644 (file)
index 0000000..4f5ee5f
--- /dev/null
@@ -0,0 +1,107 @@
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "notificationscontainer.h"
+#include "qtcamdevice.h"
+#include "qtcamnotifications.h"
+#include "notifications.h"
+
+NotificationsContainer::NotificationsContainer(QObject *parent) :
+  QObject(parent), m_dev(0), m_notifications(0) {
+
+}
+
+NotificationsContainer::~NotificationsContainer() {
+  setDevice(0);
+
+  QMutexLocker locker(&m_mutex);
+  m_notifications = 0;
+}
+
+void NotificationsContainer::setDevice(QtCamDevice *dev) {
+  if (m_dev) {
+    QtCamNotifications *n = m_dev->notifications();
+    QObject::disconnect(n, SIGNAL(imageCaptureStarted()), this, SLOT(imageCaptureStarted()));
+    QObject::disconnect(n, SIGNAL(imageCaptureEnded()), this, SLOT(imageCaptureEnded()));
+    QObject::disconnect(n, SIGNAL(videoRecordingStarted()), this, SLOT(videoRecordingStarted()));
+    QObject::disconnect(n, SIGNAL(videoRecordingEnded()), this, SLOT(videoRecordingEnded()));
+  }
+
+  m_dev = dev;
+
+  if (m_dev) {
+    QtCamNotifications *n = m_dev->notifications();
+    QObject::connect(n, SIGNAL(imageCaptureStarted()),
+                    this, SLOT(imageCaptureStarted()), Qt::DirectConnection);
+    QObject::connect(n, SIGNAL(imageCaptureEnded()),
+                    this, SLOT(imageCaptureEnded()), Qt::DirectConnection);
+    QObject::connect(n, SIGNAL(videoRecordingStarted()),
+                    this, SLOT(videoRecordingStarted()), Qt::DirectConnection);
+    QObject::connect(n, SIGNAL(videoRecordingEnded()),
+                    this, SLOT(videoRecordingEnded()), Qt::DirectConnection);
+  }
+}
+
+Notifications *NotificationsContainer::notifications() const {
+  return m_notifications;
+}
+
+bool NotificationsContainer::setNotifications(Notifications *notifications) {
+  QMutexLocker lock(&m_mutex);
+
+  if (m_notifications != notifications) {
+    m_notifications = notifications;
+    return true;
+  }
+
+  return false;
+}
+
+void NotificationsContainer::imageCaptureStarted() {
+  QMutexLocker l(&m_mutex);
+
+  if (m_notifications) {
+    m_notifications->imageCaptureStarted();
+  }
+}
+
+void NotificationsContainer::imageCaptureEnded() {
+  QMutexLocker l(&m_mutex);
+
+  if (m_notifications) {
+    m_notifications->imageCaptureEnded();
+  }
+}
+
+void NotificationsContainer::videoRecordingStarted() {
+  QMutexLocker l(&m_mutex);
+
+  if (m_notifications) {
+    m_notifications->videoRecordingStarted();
+  }
+}
+
+void NotificationsContainer::videoRecordingEnded() {
+  QMutexLocker l(&m_mutex);
+
+  if (m_notifications) {
+    m_notifications->videoRecordingEnded();
+  }
+}
diff --git a/imports/notificationscontainer.h b/imports/notificationscontainer.h
new file mode 100644 (file)
index 0000000..b59038d
--- /dev/null
@@ -0,0 +1,56 @@
+// -*- c++ -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef NOTIFICATIONS_CNTAINER_H
+#define NOTIFICATIONS_CNTAINER_H
+
+#include <QObject>
+#include <QPointer>
+#include <QMutex>
+
+class QtCamDevice;
+class Notifications;
+
+class NotificationsContainer : public QObject {
+  Q_OBJECT
+
+public:
+  NotificationsContainer(QObject *parent = 0);
+  ~NotificationsContainer();
+
+  void setDevice(QtCamDevice *dev);
+  Notifications *notifications() const;
+  bool setNotifications(Notifications *notifications);
+
+private slots:
+  void imageCaptureStarted();
+  void imageCaptureEnded();
+  void videoRecordingStarted();
+  void videoRecordingEnded();
+
+private:
+  QPointer<QtCamDevice> m_dev;
+  Notifications *m_notifications;
+  QMutex m_mutex;
+};
+
+#endif /* NOTIFICATIONS_CNTAINER_H */
index a08107c..80f13e0 100644 (file)
@@ -42,6 +42,7 @@
 #include "imageresolutionmodel.h"
 #include "videosettings.h"
 #include "videoresolutionmodel.h"
+#include "notifications.h"
 
 #include <QtDeclarative>
 
@@ -69,6 +70,7 @@ void Plugin::registerTypes(QDeclarativeEngine *engine) {
   qmlRegisterType<MetaData>(URI, MAJOR, MINOR, "MetaData");
   qmlRegisterType<ImageSettings>(URI, MAJOR, MINOR, "ImageSettings");
   qmlRegisterType<VideoSettings>(URI, MAJOR, MINOR, "VideoSettings");
+  qmlRegisterInterface<Notifications>("Notifications");
 
   qmlRegisterUncreatableType<ImageResolutionModel>(URI, MAJOR, MINOR, "ImageResolutionModel",
                          "ImageResolutionModel can be obtained from ImageSettings");
index 1356612..820fc85 100644 (file)
@@ -18,7 +18,7 @@ HEADERS += qtcamconfig.h qtcamera.h qtcamscanner.h qtcamdevice.h qtcamviewfinder
            qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \
            qtcamwhitebalance.h qtcamcolortone.h qtcamflickerreduction.h \
            qtcamnoisereduction.h qtcamiso.h qtcamaperture.h qtcamexposure.h \
-           qtcammute.h
+           qtcammute.h qtcamnotifications.h
 
 SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \
            qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \
@@ -28,7 +28,7 @@ SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamvi
            qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \
            qtcamwhitebalance.cpp qtcamcolortone.cpp qtcamflickerreduction.cpp \
            qtcamnoisereduction.cpp qtcamiso.cpp qtcamaperture.cpp qtcamexposure.cpp \
-           qtcammute.cpp
+           qtcammute.cpp qtcamnotifications.cpp
 
 HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h
 
index bf9dd54..4e4850f 100644 (file)
@@ -28,6 +28,7 @@
 #include "qtcammode.h"
 #include "qtcamimagemode.h"
 #include "qtcamvideomode.h"
+#include "qtcamnotifications.h"
 
 // TODO: we want the ability to change the image and video gep from the app.
 
@@ -81,6 +82,8 @@ QtCamDevice::QtCamDevice(QtCamConfig *config, const QString& name,
 
   d_ptr->image = new QtCamImageMode(d_ptr, this);
   d_ptr->video = new QtCamVideoMode(d_ptr, this);
+
+  d_ptr->notifications = new QtCamNotifications(this, this);
 }
 
 QtCamDevice::~QtCamDevice() {
@@ -277,4 +280,8 @@ QtCamGStreamerMessageListener *QtCamDevice::listener() const {
   return d_ptr->listener;
 }
 
+QtCamNotifications *QtCamDevice::notifications() const {
+  return d_ptr->notifications;
+}
+
 #include "moc_qtcamdevice.cpp"
index 0fd92b7..8083101 100644 (file)
@@ -35,6 +35,7 @@ class QtCamMode;
 class QtCamGStreamerMessageListener;
 class QtCamMetaData;
 class QtCamCapability;
+class QtCamNotifications;
 
 class QtCamDevice : public QObject {
   Q_OBJECT
@@ -60,6 +61,8 @@ public:
   QtCamConfig *config() const;
   QtCamGStreamerMessageListener *listener() const;
 
+  QtCamNotifications *notifications() const;
+
 signals:
   void error(const QString& message, int code, const QString& debug);
   void started();
index 3020f62..45205c4 100644 (file)
@@ -46,7 +46,8 @@ public:
     active(0),
     viewfinder(0),
     conf(0),
-    error(false) {
+    error(false),
+    notifications(0) {
 
   }
 
@@ -233,6 +234,7 @@ public:
   QtCamConfig *conf;
   QtCamGStreamerMessageListener *listener;
   bool error;
+  QtCamNotifications *notifications;
 };
 
 #endif /* QT_CAM_DEVICE_P_H */
index c65e115..6254fd6 100644 (file)
@@ -36,6 +36,10 @@ public:
       return 0;
     }
 
+#if 0
+    qDebug() << "Message" << gst_structure_get_name(s);
+#endif
+
     QList<QtCamGStreamerMessageHandler *> list =
       map.values(gst_structure_get_name(s));
 
diff --git a/lib/qtcamnotifications.cpp b/lib/qtcamnotifications.cpp
new file mode 100644 (file)
index 0000000..5b50c0e
--- /dev/null
@@ -0,0 +1,73 @@
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "qtcamnotifications.h"
+#include "qtcamgstreamermessagehandler.h"
+#include "qtcamgstreamermessagelistener.h"
+#include "qtcamdevice.h"
+#include <QPointer>
+
+class QtCamNotificationsPrivate {
+public:
+  QtCamDevice *dev;
+  QPointer<QtCamGStreamerMessageHandler> imageStart;
+  QPointer<QtCamGStreamerMessageHandler> imageEnd;
+
+  QPointer<QtCamGStreamerMessageHandler> videoDone;
+  QPointer<QtCamGStreamerMessageListener> listener;
+};
+
+QtCamNotifications::QtCamNotifications(QtCamDevice *dev, QObject *parent) :
+  QObject(parent), d_ptr(new QtCamNotificationsPrivate) {
+  d_ptr->dev = dev;
+
+  d_ptr->listener = dev->listener();
+  d_ptr->imageStart = new QtCamGStreamerMessageHandler("photo-capture-start", this);
+  d_ptr->imageEnd = new QtCamGStreamerMessageHandler("photo-capture-end", this);
+  d_ptr->videoDone = new QtCamGStreamerMessageHandler("video-done", this);
+
+  if (d_ptr->listener) {
+    d_ptr->listener->addSyncHandler(d_ptr->imageStart);
+    d_ptr->listener->addHandler(d_ptr->imageEnd);
+    d_ptr->listener->addHandler(d_ptr->videoDone);
+  }
+
+  QObject::connect(d_ptr->imageStart, SIGNAL(messageSent(GstMessage *)),
+                  this, SIGNAL(imageCaptureStarted()), Qt::DirectConnection);
+
+  QObject::connect(d_ptr->imageEnd, SIGNAL(messageSent(GstMessage *)),
+                  this, SIGNAL(imageCaptureEnded()), Qt::DirectConnection);
+
+  QObject::connect(d_ptr->videoDone, SIGNAL(messageSent(GstMessage *)),
+                  this, SIGNAL(videoRecordingEnded()), Qt::DirectConnection);
+}
+
+QtCamNotifications::~QtCamNotifications() {
+  if (d_ptr->listener) {
+    d_ptr->listener->removeSyncHandler(d_ptr->imageStart);
+    d_ptr->listener->removeHandler(d_ptr->imageEnd);
+    d_ptr->listener->removeHandler(d_ptr->videoDone);
+  }
+
+  delete d_ptr->imageStart.data();
+  delete d_ptr->imageEnd.data();
+
+  delete d_ptr; d_ptr = 0;
+}
diff --git a/lib/qtcamnotifications.h b/lib/qtcamnotifications.h
new file mode 100644 (file)
index 0000000..395d004
--- /dev/null
@@ -0,0 +1,51 @@
+// -*- c++ -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef QT_CAM_NOTIFICATIONS_H
+#define QT_CAM_NOTIFICATIONS_H
+
+#include <QObject>
+
+class QtCamNotificationsPrivate;
+class QtCamDevice;
+
+class QtCamNotifications : public QObject {
+  Q_OBJECT
+
+public:
+  QtCamNotifications(QtCamDevice *dev, QObject *parent = 0);
+  ~QtCamNotifications();
+
+signals:
+  // This will be emitted from another signal.
+  void imageCaptureStarted();
+
+  void imageCaptureEnded();
+
+  void videoRecordingStarted();
+  void videoRecordingEnded();
+
+private:
+  QtCamNotificationsPrivate *d_ptr;
+};
+
+#endif /* QT_CAM_NOTIFICATIONS_H */
index e8de442..46a5502 100644 (file)
@@ -24,6 +24,7 @@
 #include "qtcamdevice_p.h"
 #include "qtcamdevice.h"
 #include "qtcamvideosettings.h"
+#include "qtcamnotifications.h"
 
 class QtCamVideoModePrivate : public QtCamModePrivate {
 public:
@@ -64,6 +65,7 @@ QtCamVideoMode::QtCamVideoMode(QtCamDevicePrivate *dev, QObject *parent) :
     }
   }
 
+  // TODO: Use signals from QtCamNotifications instead ?
   QObject::connect(d_ptr->dev->q_ptr, SIGNAL(idleStateChanged(bool)),
                   this, SLOT(_d_idleStateChanged(bool)));
 }
@@ -116,6 +118,8 @@ bool QtCamVideoMode::startRecording(const QString& fileName) {
 
   setFileName(fileName);
 
+  QMetaObject::invokeMethod(d_ptr->dev->notifications, "videoRecordingStarted");
+
   g_object_set(d_ptr->dev->cameraBin, "location", fileName.toUtf8().data(), NULL);
   g_signal_emit_by_name(d_ptr->dev->cameraBin, "start-capture", NULL);