Query the minimum, maximum and default values if needed from the GParamSpec objects
[harmattan/cameraplus] / lib / qtcamcapability_p.h
index 54d9829..1ff58be 100644 (file)
@@ -1,5 +1,25 @@
 // -*- c++ -*-
 
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
 #ifndef QT_CAM_CAPABILITY_P_H
 #define QT_CAM_CAPABILITY_P_H
 
@@ -34,6 +54,14 @@ public:
 
   }
 
+  GParamSpec *paramSpec() {
+    if (!src || prop.isEmpty()) {
+      return 0;
+    }
+
+    return g_object_class_find_property(G_OBJECT_GET_CLASS(src), prop.toUtf8().constData());
+  }
+
   void startMonitoring() {
     if (src) {
       QString p = QString("notify::%1").arg(prop);
@@ -47,6 +75,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;