projects
/
harmattan
/
cameraplus
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fcbab5b
)
Query the minimum, maximum and default values if needed from the GParamSpec objects
author
Mohammed Sameer
<msameer@foolab.org>
Sun, 7 Oct 2012 23:16:46 +0000
(
02:16
+0300)
committer
Mohammed Sameer
<msameer@foolab.org>
Sun, 7 Oct 2012 23:23:06 +0000
(
02:23
+0300)
lib/qtcamaperture.cpp
patch
|
blob
|
history
lib/qtcamaperture.h
patch
|
blob
|
history
lib/qtcamcapability_p.h
patch
|
blob
|
history
lib/qtcamevcomp.cpp
patch
|
blob
|
history
lib/qtcamevcomp.h
patch
|
blob
|
history
lib/qtcamexposure.cpp
patch
|
blob
|
history
lib/qtcamexposure.h
patch
|
blob
|
history
lib/qtcamiso.cpp
patch
|
blob
|
history
lib/qtcamiso.h
patch
|
blob
|
history
lib/qtcamzoom.cpp
patch
|
blob
|
history
diff --git
a/lib/qtcamaperture.cpp
b/lib/qtcamaperture.cpp
index
07d95f4
..
b6187d9
100644
(file)
--- a/
lib/qtcamaperture.cpp
+++ b/
lib/qtcamaperture.cpp
@@
-21,10
+21,6
@@
#include "qtcamaperture.h"
#include "qtcamcapability_p.h"
#include "qtcamaperture.h"
#include "qtcamcapability_p.h"
-// TODO: hardcoded
-#define APERTURE_MIN 0
-#define APERTURE_MAX 255
-
QtCamAperture::QtCamAperture(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Aperture, "aperture"),
parent) {
QtCamAperture::QtCamAperture(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Aperture, "aperture"),
parent) {
@@
-36,11
+32,9
@@
QtCamAperture::~QtCamAperture() {
}
unsigned int QtCamAperture::value() {
}
unsigned int QtCamAperture::value() {
- unsigned int val =
0
;
+ unsigned int val =
defaultValue()
;
- if (!d_ptr->uintValue(&val)) {
- return 0;
- }
+ d_ptr->uintValue(&val);
return val;
}
return val;
}
@@
-50,9
+44,31
@@
bool QtCamAperture::setValue(unsigned int val) {
}
unsigned int QtCamAperture::minimumValue() {
}
unsigned int QtCamAperture::minimumValue() {
- return APERTURE_MIN;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->minimum;
+ }
+
+ return 0;
}
unsigned int QtCamAperture::maximumValue() {
}
unsigned int QtCamAperture::maximumValue() {
- return APERTURE_MAX;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->maximum;
+ }
+
+ return 0;
+}
+
+unsigned int QtCamAperture::defaultValue() {
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->default_value;
+ }
+
+ return 0;
}
}
diff --git
a/lib/qtcamaperture.h
b/lib/qtcamaperture.h
index
812e7b5
..
ab5e9e6
100644
(file)
--- a/
lib/qtcamaperture.h
+++ b/
lib/qtcamaperture.h
@@
-32,6
+32,8
@@
public:
QtCamAperture(QtCamDevice *dev, QObject *parent = 0);
~QtCamAperture();
QtCamAperture(QtCamDevice *dev, QObject *parent = 0);
~QtCamAperture();
+ unsigned int defaultValue();
+
unsigned int value();
bool setValue(unsigned int val);
unsigned int value();
bool setValue(unsigned int val);
diff --git
a/lib/qtcamcapability_p.h
b/lib/qtcamcapability_p.h
index
ada68aa
..
1ff58be
100644
(file)
--- a/
lib/qtcamcapability_p.h
+++ b/
lib/qtcamcapability_p.h
@@
-54,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);
void startMonitoring() {
if (src) {
QString p = QString("notify::%1").arg(prop);
diff --git
a/lib/qtcamevcomp.cpp
b/lib/qtcamevcomp.cpp
index
42d36a4
..
fe23f95
100644
(file)
--- a/
lib/qtcamevcomp.cpp
+++ b/
lib/qtcamevcomp.cpp
@@
-20,10
+20,7
@@
#include "qtcamevcomp.h"
#include "qtcamcapability_p.h"
#include "qtcamevcomp.h"
#include "qtcamcapability_p.h"
-
-// TODO: hardcoded
-#define EV_COMP_MIN -2.5
-#define EV_COMP_MAX +2.5
+#include <QDebug>
QtCamEvComp::QtCamEvComp(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::EvComp, "ev-compensation"),
QtCamEvComp::QtCamEvComp(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::EvComp, "ev-compensation"),
@@
-36,11
+33,9
@@
QtCamEvComp::~QtCamEvComp() {
}
qreal QtCamEvComp::value() {
}
qreal QtCamEvComp::value() {
- qreal val =
0.0
;
+ qreal val =
defaultValue()
;
- if (!d_ptr->floatValue(&val)) {
- return 0.0;
- }
+ d_ptr->floatValue(&val);
return val;
}
return val;
}
@@
-50,9
+45,31
@@
bool QtCamEvComp::setValue(qreal val) {
}
qreal QtCamEvComp::minimumValue() {
}
qreal QtCamEvComp::minimumValue() {
- return EV_COMP_MIN;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_FLOAT(p)) {
+ return G_PARAM_SPEC_FLOAT(p)->minimum;
+ }
+
+ return 0;
}
qreal QtCamEvComp::maximumValue() {
}
qreal QtCamEvComp::maximumValue() {
- return EV_COMP_MAX;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_FLOAT(p)) {
+ return G_PARAM_SPEC_FLOAT(p)->maximum;
+ }
+
+ return 0;
+}
+
+qreal QtCamEvComp::defaultValue() {
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_FLOAT(p)) {
+ return G_PARAM_SPEC_FLOAT(p)->default_value;
+ }
+
+ return 0;
}
}
diff --git
a/lib/qtcamevcomp.h
b/lib/qtcamevcomp.h
index
1d82f1a
..
9a7f2b2
100644
(file)
--- a/
lib/qtcamevcomp.h
+++ b/
lib/qtcamevcomp.h
@@
-32,6
+32,8
@@
public:
QtCamEvComp(QtCamDevice *dev, QObject *parent = 0);
~QtCamEvComp();
QtCamEvComp(QtCamDevice *dev, QObject *parent = 0);
~QtCamEvComp();
+ qreal defaultValue();
+
qreal value();
bool setValue(qreal val);
qreal value();
bool setValue(qreal val);
diff --git
a/lib/qtcamexposure.cpp
b/lib/qtcamexposure.cpp
index
c1cb612
..
efd1f6e
100644
(file)
--- a/
lib/qtcamexposure.cpp
+++ b/
lib/qtcamexposure.cpp
@@
-21,10
+21,6
@@
#include "qtcamexposure.h"
#include "qtcamcapability_p.h"
#include "qtcamexposure.h"
#include "qtcamcapability_p.h"
-// TODO: hardcoded
-#define EXPOSURE_MIN 0
-#define EXPOSURE_MAX 4294967295u
-
QtCamExposure::QtCamExposure(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Exposure, "exposure"),
parent) {
QtCamExposure::QtCamExposure(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Exposure, "exposure"),
parent) {
@@
-36,11
+32,9
@@
QtCamExposure::~QtCamExposure() {
}
unsigned int QtCamExposure::value() {
}
unsigned int QtCamExposure::value() {
- unsigned int val =
0
;
+ unsigned int val =
defaultValue()
;
- if (!d_ptr->uintValue(&val)) {
- return 0;
- }
+ d_ptr->uintValue(&val);
return val;
}
return val;
}
@@
-50,9
+44,31
@@
bool QtCamExposure::setValue(unsigned int val) {
}
unsigned int QtCamExposure::minimumValue() {
}
unsigned int QtCamExposure::minimumValue() {
- return EXPOSURE_MIN;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->minimum;
+ }
+
+ return 0;
}
unsigned int QtCamExposure::maximumValue() {
}
unsigned int QtCamExposure::maximumValue() {
- return EXPOSURE_MAX;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->maximum;
+ }
+
+ return 0;
+}
+
+unsigned int QtCamExposure::defaultValue() {
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->default_value;
+ }
+
+ return 0;
}
}
diff --git
a/lib/qtcamexposure.h
b/lib/qtcamexposure.h
index
74d92c2
..
f87a2ef
100644
(file)
--- a/
lib/qtcamexposure.h
+++ b/
lib/qtcamexposure.h
@@
-32,6
+32,8
@@
public:
QtCamExposure(QtCamDevice *dev, QObject *parent = 0);
~QtCamExposure();
QtCamExposure(QtCamDevice *dev, QObject *parent = 0);
~QtCamExposure();
+ unsigned int defaultValue();
+
unsigned int value();
bool setValue(unsigned int val);
unsigned int value();
bool setValue(unsigned int val);
diff --git
a/lib/qtcamiso.cpp
b/lib/qtcamiso.cpp
index
b70c5e0
..
8646cce
100644
(file)
--- a/
lib/qtcamiso.cpp
+++ b/
lib/qtcamiso.cpp
@@
-21,10
+21,6
@@
#include "qtcamiso.h"
#include "qtcamcapability_p.h"
#include "qtcamiso.h"
#include "qtcamcapability_p.h"
-// TODO: hardcoded
-#define ISO_MIN 0
-#define ISO_MAX 6400
-
QtCamIso::QtCamIso(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::IsoSpeed, "iso-speed"),
parent) {
QtCamIso::QtCamIso(QtCamDevice *dev, QObject *parent) :
QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::IsoSpeed, "iso-speed"),
parent) {
@@
-36,11
+32,9
@@
QtCamIso::~QtCamIso() {
}
unsigned int QtCamIso::value() {
}
unsigned int QtCamIso::value() {
- unsigned int val =
0
;
+ unsigned int val =
defaultValue()
;
- if (!d_ptr->uintValue(&val)) {
- return 0;
- }
+ d_ptr->uintValue(&val);
return val;
}
return val;
}
@@
-50,9
+44,31
@@
bool QtCamIso::setValue(unsigned int val) {
}
unsigned int QtCamIso::minimumValue() {
}
unsigned int QtCamIso::minimumValue() {
- return ISO_MIN;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->minimum;
+ }
+
+ return 0;
}
unsigned int QtCamIso::maximumValue() {
}
unsigned int QtCamIso::maximumValue() {
- return ISO_MAX;
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->maximum;
+ }
+
+ return 0;
+}
+
+unsigned int QtCamIso::defaultValue() {
+ GParamSpec *p = d_ptr->paramSpec();
+
+ if (p && G_IS_PARAM_SPEC_UINT(p)) {
+ return G_PARAM_SPEC_UINT(p)->default_value;
+ }
+
+ return 0;
}
}
diff --git
a/lib/qtcamiso.h
b/lib/qtcamiso.h
index
c8d4d6d
..
88aa77a
100644
(file)
--- a/
lib/qtcamiso.h
+++ b/
lib/qtcamiso.h
@@
-32,6
+32,8
@@
public:
QtCamIso(QtCamDevice *dev, QObject *parent = 0);
~QtCamIso();
QtCamIso(QtCamDevice *dev, QObject *parent = 0);
~QtCamIso();
+ unsigned int defaultValue();
+
unsigned int value();
bool setValue(unsigned int val);
unsigned int value();
bool setValue(unsigned int val);
diff --git
a/lib/qtcamzoom.cpp
b/lib/qtcamzoom.cpp
index
3411179
..
2908bc5
100644
(file)
--- a/
lib/qtcamzoom.cpp
+++ b/
lib/qtcamzoom.cpp
@@
-119,7
+119,15
@@
bool QtCamZoom::setValue(qreal zoom) {
}
qreal QtCamZoom::minimumValue() {
}
qreal QtCamZoom::minimumValue() {
- // TODO: hardcoded
+ if (!d_ptr->bin) {
+ return 1.0;
+ }
+
+ GParamSpec *pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(d_ptr->bin), "max-zoom");
+ if (pspec && G_IS_PARAM_SPEC_FLOAT(pspec)) {
+ return G_PARAM_SPEC_FLOAT(pspec)->minimum;
+ }
+
return 1.0;
}
return 1.0;
}