Added iso capability
authorMohammed Sameer <msameer@foolab.org>
Sat, 8 Sep 2012 17:07:38 +0000 (20:07 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sat, 8 Sep 2012 17:07:38 +0000 (20:07 +0300)
lib/lib.pro
lib/qtcamcapability_p.h
lib/qtcamiso.cpp [new file with mode: 0644]
lib/qtcamiso.h [new file with mode: 0644]

index 2f330fa..e80bbc9 100644 (file)
@@ -17,7 +17,7 @@ HEADERS += qtcamconfig.h qtcamera.h qtcamscanner.h qtcamdevice.h qtcamviewfinder
            qtcamimagemode.h qtcamvideomode.h qtcammetadata.h qtcamcapability.h \
            qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \
            qtcamwhitebalance.h qtcamcolortone.h qtcamflickerreduction.h \
-           qtcamnoisereduction.h
+           qtcamnoisereduction.h qtcamiso.h
 
 SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \
            qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \
@@ -26,7 +26,7 @@ SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamvi
            qtcamimagemode.cpp qtcamvideomode.cpp qtcammetadata.cpp qtcamcapability.cpp \
            qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \
            qtcamwhitebalance.cpp qtcamcolortone.cpp qtcamflickerreduction.cpp \
-           qtcamnoisereduction.cpp
+           qtcamnoisereduction.cpp qtcamiso.cpp
 
 HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h
 
index 54d9829..4cc43a9 100644 (file)
@@ -47,6 +47,26 @@ public:
     }
   }
 
+  bool uintValue(unsigned int *val) {
+    if (!src) {
+      return false;
+    }
+
+    g_object_get(src, prop.toAscii().data(), val, NULL);
+
+    return true;
+  }
+
+  bool setUintValue(unsigned int val) {
+    if (!src) {
+      return false;
+    }
+
+    g_object_set(src, prop.toAscii().data(), val, NULL);
+
+    return true;
+  }
+
   bool intValue(int *val) {
     if (!src) {
       return false;
diff --git a/lib/qtcamiso.cpp b/lib/qtcamiso.cpp
new file mode 100644 (file)
index 0000000..a7d2982
--- /dev/null
@@ -0,0 +1,37 @@
+#include "qtcamiso.h"
+#include "qtcamcapability_p.h"
+
+#define ISO_MIN 0
+#define ISO_MAX 6400
+
+QtCamIso::QtCamIso(QtCamDevice *dev, QObject *parent) :
+  QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::IsoSpeed, "iso-speed"),
+                 parent) {
+  // TODO: QML
+}
+
+QtCamIso::~QtCamIso() {
+
+}
+
+unsigned int QtCamIso::value() {
+  unsigned int val = 0;
+
+  if (!d_ptr->uintValue(&val)) {
+    return 0;
+  }
+
+  return val;
+}
+
+bool QtCamIso::setValue(unsigned int val) {
+  return d_ptr->setUintValue(val);
+}
+
+unsigned int QtCamIso::minimumValue() {
+  return ISO_MIN;
+}
+
+unsigned int QtCamIso::maximumValue() {
+  return ISO_MAX;
+}
diff --git a/lib/qtcamiso.h b/lib/qtcamiso.h
new file mode 100644 (file)
index 0000000..f482089
--- /dev/null
@@ -0,0 +1,22 @@
+// -*- c++ -*-
+
+#ifndef QT_CAM_ISO_H
+#define QT_CAM_ISO_H
+
+#include "qtcamcapability.h"
+
+class QtCamIso : public QtCamCapability {
+  Q_OBJECT
+
+public:
+  QtCamIso(QtCamDevice *dev, QObject *parent = 0);
+  ~QtCamIso();
+
+  unsigned int value();
+  bool setValue(unsigned int val);
+
+  unsigned int minimumValue();
+  unsigned int maximumValue();
+};
+
+#endif /* QT_CAM_ISO_H */