Added reset button to exposure settings
[harmattan/cameraplus] / lib / qtcamcapability_p.h
index 4cc43a9..51b36f2 100644 (file)
@@ -1,9 +1,30 @@
 // -*- c++ -*-
 
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012-2013 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
 
 #include <gst/gst.h>
+#include "qtcamcapability.h"
 #include "qtcamdevice.h"
 #include "qtcamdevice_p.h"
 
@@ -34,10 +55,18 @@ 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);
-      handler = g_signal_connect(src, p.toAscii().data(), G_CALLBACK(camera_src_notify), this);
+      handler = g_signal_connect(src, p.toLatin1().data(), G_CALLBACK(camera_src_notify), this);
     }
   }
 
@@ -52,7 +81,7 @@ public:
       return false;
     }
 
-    g_object_get(src, prop.toAscii().data(), val, NULL);
+    g_object_get(src, prop.toLatin1().data(), val, NULL);
 
     return true;
   }
@@ -62,7 +91,7 @@ public:
       return false;
     }
 
-    g_object_set(src, prop.toAscii().data(), val, NULL);
+    g_object_set(src, prop.toLatin1().data(), val, NULL);
 
     return true;
   }
@@ -72,7 +101,7 @@ public:
       return false;
     }
 
-    g_object_get(src, prop.toAscii().data(), val, NULL);
+    g_object_get(src, prop.toLatin1().data(), val, NULL);
 
     return true;
   }
@@ -83,15 +112,15 @@ public:
     }
 
     if (force) {
-      g_object_set(src, prop.toAscii().data(), val, NULL);
+      g_object_set(src, prop.toLatin1().data(), val, NULL);
       return true;
     }
 
     int old = 0;
-    g_object_get(src, prop.toAscii().data(), &old, NULL);
+    g_object_get(src, prop.toLatin1().data(), &old, NULL);
 
     if (old != val) {
-      g_object_set(src, prop.toAscii().data(), val, NULL);
+      g_object_set(src, prop.toLatin1().data(), val, NULL);
     }
 
     return true;
@@ -102,7 +131,7 @@ public:
       return false;
     }
 
-    g_object_get(src, prop.toAscii().data(), val, NULL);
+    g_object_get(src, prop.toLatin1().data(), val, NULL);
 
     return true;
   }
@@ -112,7 +141,7 @@ public:
       return false;
     }
 
-    g_object_set(src, prop.toAscii().data(), val, NULL);
+    g_object_set(src, prop.toLatin1().data(), val, NULL);
 
     return true;
   }