Implemented white balance mode
authorMohammed Sameer <msameer@foolab.org>
Sun, 2 Sep 2012 11:24:17 +0000 (14:24 +0300)
committerMohammed Sameer <msameer@foolab.org>
Thu, 6 Sep 2012 16:10:10 +0000 (19:10 +0300)
lib/lib.pro
lib/qtcamcapability.h
lib/qtcamwb.cpp [new file with mode: 0644]
lib/qtcamwb.h [new file with mode: 0644]

index 2d6b2cf..b63e0a8 100644 (file)
@@ -15,14 +15,16 @@ HEADERS += qtcamconfig.h qtcamera.h qtcamscanner.h qtcamdevice.h qtcamviewfinder
            qtcamgraphicsviewfinder.h qtcamviewfinderrenderer.h \
            qtcamviewfinderrenderergeneric.h qtcamimagesettings.h qtcamvideosettings.h \
            qtcamimagemode.h qtcamvideomode.h qtcammetadata.h qtcamcapability.h \
-           qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h
+           qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \
+           qtcamwb.h
 
 SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \
            qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \
            qtcamgraphicsviewfinder.cpp qtcamviewfinderrenderer.cpp \
            qtcamviewfinderrenderergeneric.cpp qtcamimagesettings.cpp qtcamvideosettings.cpp \
            qtcamimagemode.cpp qtcamvideomode.cpp qtcammetadata.cpp qtcamcapability.cpp \
-           qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp
+           qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \
+           qtcamwb.cpp
 
 HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h
 
index d22f5da..cc321da 100644 (file)
@@ -16,7 +16,7 @@ public:
   typedef enum {
     EvComp = (1 << 0),
     IsoSpeed = (1 << 1),
-    WbMode = (1 << 2),
+    Wb = (1 << 2),
     ColourTone = (1 << 3),
     Scene = (1 << 4),
     Flash = (1 << 5),
diff --git a/lib/qtcamwb.cpp b/lib/qtcamwb.cpp
new file mode 100644 (file)
index 0000000..a20db42
--- /dev/null
@@ -0,0 +1,35 @@
+#include "qtcamwb.h"
+#include "qtcamcapability_p.h"
+
+QtCamWb::QtCamWb(QtCamDevice *dev, QObject *parent) :
+  QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Wb, "white-balance-mode"),
+                 parent) {
+
+}
+
+QtCamWb::~QtCamWb() {
+
+}
+
+QtCamWb::WbMode QtCamWb::value() {
+  int val = 0;
+  if (!d_ptr->intValue(&val)) {
+    return QtCamWb::Auto;
+  }
+
+  switch (val) {
+  case QtCamWb::Daylight:
+  case QtCamWb::Cloudy:
+  case QtCamWb::Sunset:
+  case QtCamWb::Tungsten:
+  case QtCamWb::Flourescent:
+    return (QtCamWb::WbMode)val;
+
+  default:
+    return QtCamWb::Auto;
+  }
+}
+
+bool QtCamWb::setValue(const QtCamWb::WbMode& mode) {
+  return d_ptr->setIntValue(mode);
+}
diff --git a/lib/qtcamwb.h b/lib/qtcamwb.h
new file mode 100644 (file)
index 0000000..0ae2cfd
--- /dev/null
@@ -0,0 +1,28 @@
+// -*- c++ -*-
+
+#ifndef QT_CAM_WB_H
+#define QT_CAM_WB_H
+
+#include "qtcamcapability.h"
+
+class QtCamWb : public QtCamCapability {
+  Q_OBJECT
+
+public:
+  typedef enum {
+    Auto = 0,
+    Daylight = 1,
+    Cloudy = 2,
+    Sunset = 3,
+    Tungsten = 4,
+    Flourescent = 5
+  } WbMode;
+
+  QtCamWb(QtCamDevice *dev, QObject *parent = 0);
+  ~QtCamWb();
+
+  WbMode value();
+  bool setValue(const WbMode& mode);
+};
+
+#endif /* QT_CAM_WB_H */