canCapture and ative are properties now
authorMohammed Sameer <msameer@foolab.org>
Wed, 29 Aug 2012 14:13:28 +0000 (17:13 +0300)
committerMohammed Sameer <msameer@foolab.org>
Thu, 6 Sep 2012 16:10:09 +0000 (19:10 +0300)
lib/qtcammode.cpp
lib/qtcammode.h

index 4dc2b11..71440f6 100644 (file)
@@ -126,6 +126,10 @@ void QtCamMode::activate() {
   start();
 
   applySettings();
+
+  QMetaObject::invokeMethod(d_ptr->dev->q_ptr, "modeChanged");
+
+  emit activeChanged();
 }
 
 void QtCamMode::deactivate() {
@@ -142,6 +146,10 @@ void QtCamMode::deactivate() {
   stop();
 
   d_ptr->dev->active = 0;
+
+  QMetaObject::invokeMethod(d_ptr->dev->q_ptr, "modeChanged");
+
+  emit activeChanged();
 }
 
 bool QtCamMode::canCapture() {
index 168bc3f..6812609 100644 (file)
@@ -14,6 +14,9 @@ class QImage;
 class QtCamMode : public QObject {
   Q_OBJECT
 
+  Q_PROPERTY(bool canCapture READ canCapture NOTIFY canCaptureChanged);
+  Q_PROPERTY(bool active READ isActive NOTIFY activeChanged);
+
 public:
   QtCamMode(QtCamModePrivate *d, const char *mode, const char *done, QObject *parent = 0);
   virtual ~QtCamMode();
@@ -21,6 +24,7 @@ public:
   void deactivate();
 
   virtual bool canCapture();
+
   bool isActive();
 
   virtual void applySettings() = 0;
@@ -31,6 +35,8 @@ public slots:
 signals:
   void previewAvailable(const QImage& image, const QString& fileName);
   void saved(const QString& fileName);
+  void canCaptureChanged();
+  void activeChanged();
 
 protected:
   virtual void start() = 0;