Added an optional force parameter to Camera::stop()
authorMohammed Sameer <msameer@foolab.org>
Sat, 20 Oct 2012 00:54:48 +0000 (03:54 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sat, 20 Oct 2012 00:55:42 +0000 (03:55 +0300)
imports/camera.cpp
imports/camera.h

index 36f11ca..861b401 100644 (file)
@@ -45,8 +45,7 @@ Camera::Camera(QDeclarativeItem *parent) :
 
 Camera::~Camera() {
   if (m_dev) {
-    // TODO: stop properly
-    m_dev->stop();
+    m_dev->stop(true);
     m_dev->deleteLater();
     m_dev = 0;
   }
@@ -89,7 +88,7 @@ void Camera::setDeviceId(const QVariant& id) {
     return;
   }
 
-  if (m_dev && m_dev->stop()) {
+  if (m_dev && m_dev->stop(false)) {
     delete m_dev;
   }
   else if (m_dev) {
@@ -161,9 +160,9 @@ bool Camera::start() {
   return m_dev->start();
 }
 
-bool Camera::stop() {
+bool Camera::stop(bool force) {
   if (m_dev) {
-    return m_dev->stop();
+    return m_dev->stop(force);
   }
 
   return true;
index fc7c666..2f072ba 100644 (file)
@@ -71,7 +71,7 @@ public:
   QtCamDevice *device() const;
 
   Q_INVOKABLE bool start();
-  Q_INVOKABLE bool stop();
+  Q_INVOKABLE bool stop(bool force = false);
 
   bool isIdle();
   bool isRunning();