From 944d72c2c080596d5014a30e722a3b7edc94a577 Mon Sep 17 00:00:00 2001 From: Mohammed Sameer Date: Sun, 2 Sep 2012 14:24:17 +0300 Subject: [PATCH] Implemented white balance mode --- lib/lib.pro | 6 ++++-- lib/qtcamcapability.h | 2 +- lib/qtcamwb.cpp | 35 +++++++++++++++++++++++++++++++++++ lib/qtcamwb.h | 28 ++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 lib/qtcamwb.cpp create mode 100644 lib/qtcamwb.h diff --git a/lib/lib.pro b/lib/lib.pro index 2d6b2cf..b63e0a8 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -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 diff --git a/lib/qtcamcapability.h b/lib/qtcamcapability.h index d22f5da..cc321da 100644 --- a/lib/qtcamcapability.h +++ b/lib/qtcamcapability.h @@ -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 index 0000000..a20db42 --- /dev/null +++ b/lib/qtcamwb.cpp @@ -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 index 0000000..0ae2cfd --- /dev/null +++ b/lib/qtcamwb.h @@ -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 */ -- 2.25.1