Introduce a base class for capabilities.
authorMohammed Sameer <msameer@foolab.org>
Sun, 7 Apr 2013 22:10:40 +0000 (01:10 +0300)
committerMohammed Sameer <msameer@foolab.org>
Fri, 2 Aug 2013 21:29:54 +0000 (00:29 +0300)
Introduce the Capability base class for all capabilities.
It has only one property for now (isSupported).

Conflicts:
declarative/declarative.pro
declarative/plugin.cpp

26 files changed:
declarative/aperture.cpp
declarative/aperture.h
declarative/colortone.cpp
declarative/colortone.h
declarative/declarative.pro
declarative/evcomp.cpp
declarative/evcomp.h
declarative/exposure.cpp
declarative/exposure.h
declarative/flash.cpp
declarative/flash.h
declarative/flickerreduction.cpp
declarative/flickerreduction.h
declarative/focus.cpp
declarative/focus.h
declarative/iso.cpp
declarative/iso.h
declarative/noisereduction.cpp
declarative/noisereduction.h
declarative/plugin.cpp
declarative/scene.cpp
declarative/scene.h
declarative/whitebalance.cpp
declarative/whitebalance.h
declarative/zoom.cpp
declarative/zoom.h

index 9eacc16..ab4ffd6 100644 (file)
 #include "qtcamaperture.h"
 
 Aperture::Aperture(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_aperture(new QtCamAperture(dev, this)) {
 
+  setCapability(m_aperture);
+
   QObject::connect(m_aperture, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
   QObject::connect(m_aperture, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
   QObject::connect(m_aperture, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
index 7ce88ce..a59a344 100644 (file)
 #ifndef APERTURE_H
 #define APERTURE_H
 
-#include <QObject>
+#include "capability.h"
 
 class QtCamAperture;
 class QtCamDevice;
 
-class Aperture : public QObject {
+class Aperture : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(unsigned int value READ value WRITE setValue NOTIFY valueChanged);
index 48301f3..54eda2e 100644 (file)
 #include "colortone.h"
 
 ColorTone::ColorTone(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_color(new QtCamColorTone(dev, this)) {
 
+  setCapability(m_color);
+
   QObject::connect(m_color, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
 }
 
index 0789acd..e35f8c6 100644 (file)
 #ifndef COLOR_TONE_H
 #define COLOR_TONE_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamcolortone.h"
 
 class QtCamDevice;
 
-class ColorTone : public QObject {
+class ColorTone : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(ColorToneMode value READ value WRITE setValue NOTIFY valueChanged);
index e1fe398..18dcfe6 100644 (file)
@@ -21,7 +21,7 @@ HEADERS += plugin.h previewprovider.h camera.h mode.h imagemode.h videomode.h \
            flickerreduction.h videomute.h metadata.h imagesettings.h \
            imageresolutionmodel.h videosettings.h videoresolutionmodel.h \
            notificationscontainer.h sounds.h focus.h autofocus.h \
-           roi.h cameraconfig.h videoplayer.h viewfinder.h
+           roi.h cameraconfig.h videoplayer.h viewfinder.h capability.h
 
 SOURCES += plugin.cpp previewprovider.cpp camera.cpp mode.cpp imagemode.cpp videomode.cpp \
            zoom.cpp flash.cpp scene.cpp evcomp.cpp videotorch.cpp whitebalance.cpp \
@@ -29,7 +29,7 @@ SOURCES += plugin.cpp previewprovider.cpp camera.cpp mode.cpp imagemode.cpp vide
            flickerreduction.cpp videomute.cpp metadata.cpp imagesettings.cpp \
            imageresolutionmodel.cpp videosettings.cpp videoresolutionmodel.cpp \
            notificationscontainer.cpp sounds.cpp focus.cpp autofocus.cpp \
-           roi.cpp cameraconfig.cpp videoplayer.cpp viewfinder.cpp
+           roi.cpp cameraconfig.cpp videoplayer.cpp viewfinder.cpp capability.cpp
 
 PLUGIN_IMPORT_PATH = QtCamera
 target.path = $$[QT_INSTALL_IMPORTS]/$$PLUGIN_IMPORT_PATH
index 6b722d4..dfed9cf 100644 (file)
 #include "qtcamevcomp.h"
 
 EvComp::EvComp(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_evComp(new QtCamEvComp(dev, this)) {
 
+  setCapability(m_evComp);
+
   QObject::connect(m_evComp, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
   QObject::connect(m_evComp, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
   QObject::connect(m_evComp, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
index a0ab9eb..cc546c4 100644 (file)
 #ifndef EV_COMP_H
 #define EV_COMP_H
 
-#include <QObject>
+#include "capability.h"
 
 class QtCamEvComp;
 class QtCamDevice;
 
-class EvComp : public QObject {
+class EvComp : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged);
index 7196840..df820e4 100644 (file)
 #include "qtcamexposure.h"
 
 Exposure::Exposure(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_exposure(new QtCamExposure(dev, this)) {
 
+  setCapability(m_exposure);
+
   QObject::connect(m_exposure, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
   QObject::connect(m_exposure, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
   QObject::connect(m_exposure, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
index 1d4c2be..421b993 100644 (file)
 #ifndef EXPOSURE_H
 #define EXPOSURE_H
 
-#include <QObject>
+#include "capability.h"
 
 class QtCamExposure;
 class QtCamDevice;
 
-class Exposure : public QObject {
+class Exposure : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(unsigned int value READ value WRITE setValue NOTIFY valueChanged);
index 9af7fbd..2ce93c4 100644 (file)
 #include "flash.h"
 
 Flash::Flash(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_flash(new QtCamFlash(dev, this)) {
 
+  setCapability(m_flash);
+
   QObject::connect(m_flash, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
   QObject::connect(m_flash, SIGNAL(flashReadyChanged()), this, SIGNAL(readyChanged()));
 }
index 343ed3d..bece520 100644 (file)
 #ifndef FLASH_H
 #define FLASH_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamflash.h"
 
 class QtCamDevice;
 
-class Flash : public QObject {
+class Flash : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(FlashMode value READ value WRITE setValue NOTIFY valueChanged);
index 7deeee9..7d49d67 100644 (file)
 #include "flickerreduction.h"
 
 FlickerReduction::FlickerReduction(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_fr(new QtCamFlickerReduction(dev, this)) {
 
+  setCapability(m_fr);
+
   QObject::connect(m_fr, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
 }
 
index 6cfe5ef..d82ccf9 100644 (file)
 #ifndef FLICKER_REDUCTION_H
 #define FLICKER_REDUCTION_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamflickerreduction.h"
 
 class QtCamDevice;
 
-class FlickerReduction : public QObject {
+class FlickerReduction : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(FlickerReductionMode value READ value WRITE setValue NOTIFY valueChanged);
index 7a93fd4..31c88f3 100644 (file)
 #include "focus.h"
 
 Focus::Focus(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_f(new QtCamFocus(dev, this)) {
 
+  setCapability(m_f);
+
   QObject::connect(m_f, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
 }
 
index ba21f5c..b5dbe49 100644 (file)
 #ifndef FOCUS_H
 #define FOCUS_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamfocus.h"
 
 class QtCamDevice;
 
-class Focus : public QObject {
+class Focus : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(FocusMode value READ value WRITE setValue NOTIFY valueChanged);
index c5d6088..af39af6 100644 (file)
 #include "qtcamiso.h"
 
 Iso::Iso(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_iso(new QtCamIso(dev, this)) {
 
+  setCapability(m_iso);
+
   QObject::connect(m_iso, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
   QObject::connect(m_iso, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
   QObject::connect(m_iso, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
index 7e6669c..9055ae6 100644 (file)
 #ifndef ISO_H
 #define ISO_H
 
-#include <QObject>
+#include "capability.h"
 
 class QtCamIso;
 class QtCamDevice;
 
-class Iso : public QObject {
+class Iso : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(unsigned int value READ value WRITE setValue NOTIFY valueChanged);
index a16de30..b7affe6 100644 (file)
 #include "noisereduction.h"
 
 NoiseReduction::NoiseReduction(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_nr(new QtCamNoiseReduction(dev, this)) {
 
+  setCapability(m_nr);
+
   QObject::connect(m_nr, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
 }
 
index 55263d0..964faca 100644 (file)
 #ifndef NOISE_REDUCTION_H
 #define NOISE_REDUCTION_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamnoisereduction.h"
 
 class QtCamDevice;
 
-class NoiseReduction : public QObject {
+class NoiseReduction : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(NoiseReductionMode value READ value WRITE setValue NOTIFY valueChanged);
index a295da0..dbc34ff 100644 (file)
@@ -48,6 +48,7 @@
 #include "cameraconfig.h"
 #include "videoplayer.h"
 #include "viewfinder.h"
+#include "capability.h"
 #if defined(QT4)
 #include <QDeclarativeEngine>
 #elif defined(QT5)
@@ -120,6 +121,7 @@ void Plugin::registerTypes(const char *uri) {
 
   qmlRegisterType<VideoPlayer>("QtCameraExtras", MAJOR, MINOR, "VideoPlayer");
   qmlRegisterType<Viewfinder>(uri, MAJOR, MINOR, "Viewfinder");
+  qmlRegisterType<Capability>();
 }
 
 #if defined(QT4)
index 3eca58f..b08fd61 100644 (file)
 #include "scene.h"
 
 Scene::Scene(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_scene(new QtCamScene(dev, this)) {
 
+  setCapability(m_scene);
+
   QObject::connect(m_scene, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
 }
 
index 6327af4..d7d6c31 100644 (file)
 #ifndef SCENE_H
 #define SCENE_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamscene.h"
 
 class QtCamDevice;
 
-class Scene : public QObject {
+class Scene : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(SceneMode value READ value WRITE setValue NOTIFY valueChanged);
index bc6ed5a..3957274 100644 (file)
 #include "whitebalance.h"
 
 WhiteBalance::WhiteBalance(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_wb(new QtCamWhiteBalance(dev, this)) {
 
+  setCapability(m_wb);
+
   QObject::connect(m_wb, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
 }
 
index 3ca7d01..adab5c6 100644 (file)
 #ifndef WHITE_BALANCE_H
 #define WHITE_BALANCE_H
 
-#include <QObject>
+#include "capability.h"
 #include "qtcamwhitebalance.h"
 
 class QtCamDevice;
 
-class WhiteBalance : public QObject {
+class WhiteBalance : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(WhiteBalanceMode value READ value WRITE setValue NOTIFY valueChanged);
index 879bbfa..2d05ba6 100644 (file)
 #include "qtcamzoom.h"
 
 Zoom::Zoom(QtCamDevice *dev, QObject *parent) :
-  QObject(parent),
+  Capability(parent),
   m_zoom(new QtCamZoom(dev, this)) {
 
+  setCapability(m_zoom);
+
   QObject::connect(m_zoom, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
   QObject::connect(m_zoom, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
   QObject::connect(m_zoom, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
index 0042a59..2f847e0 100644 (file)
 #ifndef ZOOM_H
 #define ZOOM_H
 
-#include <QObject>
+#include "capability.h"
 
 class QtCamZoom;
 class QtCamDevice;
 
-class Zoom : public QObject {
+class Zoom : public Capability {
   Q_OBJECT
 
   Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged);