summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2012-01-10 13:32:24 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-25 06:14:59 +0100
commit2db9b4b1c86cc2f8c293102518af382bc5ae92fd (patch)
treeb71b1d45859385701bf0bab1c3390d6cbc793785 /src
parenta9d78fbec94c80241c1f90f660cf27dc259a0df4 (diff)
QCameraExposure API refactoring
QCameraExposureControl: Separated requested from actual exposure values. Removed ParameterFlags, it's confusing and seldom used. Moved ExposureMode and MeteringMode to parameters. QCameraExposure: Added requestedAperture/ShutterSpeed/Iso getters Change-Id: I408586d85e6c9de0c8a711c32b3c90ea46052270 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/multimedia/qdeclarativetorch.cpp10
-rw-r--r--src/multimedia/camera/qcameraexposure.cpp174
-rw-r--r--src/multimedia/camera/qcameraexposure.h15
-rw-r--r--src/multimedia/controls/qcameraexposurecontrol.cpp110
-rw-r--r--src/multimedia/controls/qcameraexposurecontrol.h55
5 files changed, 184 insertions, 180 deletions
diff --git a/src/imports/multimedia/qdeclarativetorch.cpp b/src/imports/multimedia/qdeclarativetorch.cpp
index 1dbc1d102..6fdfc082f 100644
--- a/src/imports/multimedia/qdeclarativetorch.cpp
+++ b/src/imports/multimedia/qdeclarativetorch.cpp
@@ -80,7 +80,7 @@ QDeclarativeTorch::QDeclarativeTorch(QObject *parent)
m_flash = service ? service->requestControl<QCameraFlashControl*>() : 0;
if (m_exposure)
- connect(m_exposure, SIGNAL(exposureParameterChanged(int)), SLOT(parameterChanged(int)));
+ connect(m_exposure, SIGNAL(valueChanged(int)), SLOT(parameterChanged(int)));
// XXX There's no signal for flash mode changed
}
@@ -153,7 +153,7 @@ int QDeclarativeTorch::power() const
if (!m_exposure)
return 0;
- return m_exposure->exposureParameter(QCameraExposureControl::FlashPower).toInt();
+ return m_exposure->requestedValue(QCameraExposureControl::TorchPower).toInt();
}
/*!
@@ -166,10 +166,8 @@ void QDeclarativeTorch::setPower(int power)
return;
power = qBound(0, power, 100);
- if (this->power() != power) {
- m_exposure->setExposureParameter(QCameraExposureControl::FlashPower, power);
- emit powerChanged();
- }
+ if (this->power() != power)
+ m_exposure->setValue(QCameraExposureControl::TorchPower, power);
}
/* Check for changes in flash power */
diff --git a/src/multimedia/camera/qcameraexposure.cpp b/src/multimedia/camera/qcameraexposure.cpp
index f0bdfe3d1..16330f0c7 100644
--- a/src/multimedia/camera/qcameraexposure.cpp
+++ b/src/multimedia/camera/qcameraexposure.cpp
@@ -65,10 +65,6 @@ QT_BEGIN_NAMESPACE
//#define DEBUG_EXPOSURE_CHANGES 1
-#ifdef DEBUG_EXPOSURE_CHANGES
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-#endif
-
namespace
{
class CameraExposureRegisterMetaTypes
@@ -92,6 +88,11 @@ public:
void initControls();
QCameraExposure *q_ptr;
+ template<typename T> T actualExposureParameter(QCameraExposureControl::ExposureParameter parameter, const T &defaultValue) const;
+ template<typename T> T requestedExposureParameter(QCameraExposureControl::ExposureParameter parameter, const T &defaultValue) const;
+ template<typename T> void setExposureParameter(QCameraExposureControl::ExposureParameter parameter, const T &value);
+ void resetExposureParameter(QCameraExposureControl::ExposureParameter parameter);
+
QCamera *camera;
QCameraExposureControl *exposureControl;
QCameraFlashControl *flashControl;
@@ -112,9 +113,9 @@ void QCameraExposurePrivate::initControls()
flashControl = qobject_cast<QCameraFlashControl *>(service->requestControl(QCameraFlashControl_iid));
}
if (exposureControl) {
- q->connect(exposureControl, SIGNAL(exposureParameterChanged(int)),
+ q->connect(exposureControl, SIGNAL(actualValueChanged(int)),
q, SLOT(_q_exposureParameterChanged(int)));
- q->connect(exposureControl, SIGNAL(exposureParameterRangeChanged(int)),
+ q->connect(exposureControl, SIGNAL(parameterRangeChanged(int)),
q, SLOT(_q_exposureParameterRangeChanged(int)));
}
@@ -122,14 +123,44 @@ void QCameraExposurePrivate::initControls()
q->connect(flashControl, SIGNAL(flashReady(bool)), q, SIGNAL(flashReady(bool)));
}
+template<typename T>
+T QCameraExposurePrivate::actualExposureParameter(QCameraExposureControl::ExposureParameter parameter, const T &defaultValue) const
+{
+ QVariant value = exposureControl ? exposureControl->actualValue(parameter) : QVariant();
+
+ return value.isValid() ? value.value<T>() : defaultValue;
+}
+
+template<typename T>
+T QCameraExposurePrivate::requestedExposureParameter(QCameraExposureControl::ExposureParameter parameter, const T &defaultValue) const
+{
+ QVariant value = exposureControl ? exposureControl->requestedValue(parameter) : QVariant();
+
+ return value.isValid() ? value.value<T>() : defaultValue;
+}
+
+template<typename T>
+void QCameraExposurePrivate::setExposureParameter(QCameraExposureControl::ExposureParameter parameter, const T &value)
+{
+ if (exposureControl)
+ exposureControl->setValue(parameter, QVariant::fromValue<T>(value));
+}
+
+void QCameraExposurePrivate::resetExposureParameter(QCameraExposureControl::ExposureParameter parameter)
+{
+ if (exposureControl)
+ exposureControl->setValue(parameter, QVariant());
+}
+
+
void QCameraExposurePrivate::_q_exposureParameterChanged(int parameter)
{
Q_Q(QCameraExposure);
#if DEBUG_EXPOSURE_CHANGES
qDebug() << "Exposure parameter changed:"
- << ENUM_NAME(QCameraExposureControl, "ExposureParameter", parameter)
- << exposureControl->exposureParameter(QCameraExposureControl::ExposureParameter(parameter));
+ << QCameraExposureControl::ExposureParameter(parameter)
+ << exposureControl->actualValue(QCameraExposureControl::ExposureParameter(parameter));
#endif
switch (parameter) {
@@ -236,7 +267,6 @@ bool QCameraExposure::isFlashReady() const
return d_func()->flashControl ? d_func()->flashControl->isFlashReady() : false;
}
-
/*!
\property QCameraExposure::exposureMode
\brief The exposure mode being used.
@@ -246,13 +276,12 @@ bool QCameraExposure::isFlashReady() const
QCameraExposure::ExposureMode QCameraExposure::exposureMode() const
{
- return d_func()->exposureControl ? d_func()->exposureControl->exposureMode() : QCameraExposure::ExposureAuto;
+ return d_func()->actualExposureParameter<QCameraExposure::ExposureMode>(QCameraExposureControl::ExposureMode, QCameraExposure::ExposureAuto);
}
void QCameraExposure::setExposureMode(QCameraExposure::ExposureMode mode)
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureMode(mode);
+ d_func()->setExposureParameter<QCameraExposure::ExposureMode>(QCameraExposureControl::ExposureMode, mode);
}
/*!
@@ -261,8 +290,12 @@ void QCameraExposure::setExposureMode(QCameraExposure::ExposureMode mode)
bool QCameraExposure::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
{
- return d_func()->exposureControl ?
- d_func()->exposureControl->isExposureModeSupported(mode) : false;
+ if (!d_func()->exposureControl)
+ return false;
+
+ bool continuous = false;
+ return d_func()->exposureControl->supportedParameterRange(QCameraExposureControl::ExposureMode, &continuous)
+ .contains(QVariant::fromValue<QCameraExposure::ExposureMode>(mode));
}
/*!
@@ -274,16 +307,12 @@ bool QCameraExposure::isExposureModeSupported(QCameraExposure::ExposureMode mode
qreal QCameraExposure::exposureCompensation() const
{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::ExposureCompensation).toReal();
- else
- return 0;
+ return d_func()->actualExposureParameter<qreal>(QCameraExposureControl::ExposureCompensation, 0.0);
}
void QCameraExposure::setExposureCompensation(qreal ev)
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ExposureCompensation, QVariant(ev));
+ d_func()->setExposureParameter<qreal>(QCameraExposureControl::ExposureCompensation, ev);
}
/*!
@@ -295,13 +324,12 @@ void QCameraExposure::setExposureCompensation(qreal ev)
QCameraExposure::MeteringMode QCameraExposure::meteringMode() const
{
- return d_func()->exposureControl ? d_func()->exposureControl->meteringMode() : QCameraExposure::MeteringMatrix;
+ return d_func()->actualExposureParameter<QCameraExposure::MeteringMode>(QCameraExposureControl::MeteringMode, QCameraExposure::MeteringMatrix);
}
void QCameraExposure::setMeteringMode(QCameraExposure::MeteringMode mode)
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setMeteringMode(mode);
+ d_func()->setExposureParameter<QCameraExposure::MeteringMode>(QCameraExposureControl::MeteringMode, mode);
}
/*!
@@ -320,13 +348,13 @@ void QCameraExposure::setMeteringMode(QCameraExposure::MeteringMode mode)
QPointF QCameraExposure::spotMeteringPoint() const
{
- return d_func()->exposureControl ? d_func()->exposureControl->exposureParameter(QCameraExposureControl::SpotMeteringPoint).toPointF() : QPointF();
+ return d_func()->exposureControl ? d_func()->exposureControl->actualValue(QCameraExposureControl::SpotMeteringPoint).toPointF() : QPointF();
}
void QCameraExposure::setSpotMeteringPoint(const QPointF &point)
{
if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::SpotMeteringPoint, point);
+ d_func()->exposureControl->setValue(QCameraExposureControl::SpotMeteringPoint, point);
}
@@ -335,15 +363,26 @@ void QCameraExposure::setSpotMeteringPoint(const QPointF &point)
*/
bool QCameraExposure::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
{
- return d_func()->exposureControl ? d_func()->exposureControl->isMeteringModeSupported(mode) : false;
+ if (!d_func()->exposureControl)
+ return false;
+
+ bool continuous = false;
+ return d_func()->exposureControl->supportedParameterRange(QCameraExposureControl::MeteringMode, &continuous)
+ .contains(QVariant::fromValue<QCameraExposure::MeteringMode>(mode));
}
int QCameraExposure::isoSensitivity() const
{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::ISO).toInt();
+ return d_func()->actualExposureParameter<int>(QCameraExposureControl::ISO, -1);
+}
- return -1;
+/*!
+ Returns the requested ISO sensitivity
+ or -1 if automatic ISO is turned on.
+*/
+int QCameraExposure::requestedIsoSensitivity() const
+{
+ return d_func()->requestedExposureParameter<int>(QCameraExposureControl::ISO, -1);
}
/*!
@@ -357,11 +396,15 @@ QList<int> QCameraExposure::supportedIsoSensitivities(bool *continuous) const
QList<int> res;
QCameraExposureControl *control = d_func()->exposureControl;
+ bool tmp = false;
+ if (!continuous)
+ continuous = &tmp;
+
if (!control)
return res;
foreach (const QVariant &value,
- control->supportedParameterRange(QCameraExposureControl::ISO)) {
+ control->supportedParameterRange(QCameraExposureControl::ISO, continuous)) {
bool ok = false;
int intValue = value.toInt(&ok);
if (ok)
@@ -370,10 +413,6 @@ QList<int> QCameraExposure::supportedIsoSensitivities(bool *continuous) const
qWarning() << "Incompatible ISO value type, int is expected";
}
- if (continuous)
- *continuous = control->exposureParameterFlags(QCameraExposureControl::ISO) &
- QCameraExposureControl::ContinuousRange;
-
return res;
}
@@ -384,8 +423,7 @@ QList<int> QCameraExposure::supportedIsoSensitivities(bool *continuous) const
void QCameraExposure::setManualIsoSensitivity(int iso)
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ISO, QVariant(iso));
+ d_func()->setExposureParameter<int>(QCameraExposureControl::ISO, iso);
}
/*!
@@ -395,8 +433,7 @@ void QCameraExposure::setManualIsoSensitivity(int iso)
void QCameraExposure::setAutoIsoSensitivity()
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ISO, QVariant());
+ d_func()->resetExposureParameter(QCameraExposureControl::ISO);
}
/*!
@@ -423,18 +460,25 @@ void QCameraExposure::setAutoIsoSensitivity()
\property QCameraExposure::aperture
\brief Lens aperture is specified as an F number, the ratio of the focal length to effective aperture diameter.
- \sa supportedApertures(), setAutoAperture(), setManualAperture()
+ \sa supportedApertures(), setAutoAperture(), setManualAperture(), requestedAperture()
*/
qreal QCameraExposure::aperture() const
{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::Aperture).toReal();
+ return d_func()->actualExposureParameter<qreal>(QCameraExposureControl::Aperture, -1.0);
+}
- return -1.0;
+/*!
+ Returns the requested manual aperture
+ or -1.0 if automatic aperture is turned on.
+*/
+qreal QCameraExposure::requestedAperture() const
+{
+ return d_func()->requestedExposureParameter<qreal>(QCameraExposureControl::Aperture, -1.0);
}
+
/*!
Returns the list of aperture values camera supports.
The apertures list can change depending on the focal length,
@@ -448,11 +492,15 @@ QList<qreal> QCameraExposure::supportedApertures(bool * continuous) const
QList<qreal> res;
QCameraExposureControl *control = d_func()->exposureControl;
+ bool tmp = false;
+ if (!continuous)
+ continuous = &tmp;
+
if (!control)
return res;
foreach (const QVariant &value,
- control->supportedParameterRange(QCameraExposureControl::Aperture)) {
+ control->supportedParameterRange(QCameraExposureControl::Aperture, continuous)) {
bool ok = false;
qreal realValue = value.toReal(&ok);
if (ok)
@@ -461,10 +509,6 @@ QList<qreal> QCameraExposure::supportedApertures(bool * continuous) const
qWarning() << "Incompatible aperture value type, qreal is expected";
}
- if (continuous)
- *continuous = control->exposureParameterFlags(QCameraExposureControl::Aperture) &
- QCameraExposureControl::ContinuousRange;
-
return res;
}
@@ -475,8 +519,7 @@ QList<qreal> QCameraExposure::supportedApertures(bool * continuous) const
void QCameraExposure::setManualAperture(qreal aperture)
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::Aperture, QVariant(aperture));
+ d_func()->setExposureParameter<qreal>(QCameraExposureControl::Aperture, aperture);
}
/*!
@@ -486,8 +529,7 @@ void QCameraExposure::setManualAperture(qreal aperture)
void QCameraExposure::setAutoAperture()
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::Aperture, QVariant());
+ d_func()->resetExposureParameter(QCameraExposureControl::Aperture);
}
/*!
@@ -496,10 +538,16 @@ void QCameraExposure::setAutoAperture()
qreal QCameraExposure::shutterSpeed() const
{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::ShutterSpeed).toReal();
+ return d_func()->actualExposureParameter<qreal>(QCameraExposureControl::ShutterSpeed, -1.0);
+}
- return -1.0;
+/*!
+ Returns the requested manual shutter speed in seconds
+ or -1.0 if automatic shutter speed is turned on.
+*/
+qreal QCameraExposure::requestedShutterSpeed() const
+{
+ return d_func()->requestedExposureParameter<qreal>(QCameraExposureControl::ShutterSpeed, -1.0);
}
/*!
@@ -511,13 +559,17 @@ qreal QCameraExposure::shutterSpeed() const
QList<qreal> QCameraExposure::supportedShutterSpeeds(bool *continuous) const
{
QList<qreal> res;
-
QCameraExposureControl *control = d_func()->exposureControl;
+
+ bool tmp = false;
+ if (!continuous)
+ continuous = &tmp;
+
if (!control)
return res;
foreach (const QVariant &value,
- control->supportedParameterRange(QCameraExposureControl::ShutterSpeed)) {
+ control->supportedParameterRange(QCameraExposureControl::ShutterSpeed, continuous)) {
bool ok = false;
qreal realValue = value.toReal(&ok);
if (ok)
@@ -526,10 +578,6 @@ QList<qreal> QCameraExposure::supportedShutterSpeeds(bool *continuous) const
qWarning() << "Incompatible shutter speed value type, qreal is expected";
}
- if (continuous)
- *continuous = control->exposureParameterFlags(QCameraExposureControl::ShutterSpeed) &
- QCameraExposureControl::ContinuousRange;
-
return res;
}
@@ -539,8 +587,7 @@ QList<qreal> QCameraExposure::supportedShutterSpeeds(bool *continuous) const
void QCameraExposure::setManualShutterSpeed(qreal seconds)
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ShutterSpeed, QVariant(seconds));
+ d_func()->setExposureParameter<qreal>(QCameraExposureControl::ShutterSpeed, seconds);
}
/*!
@@ -549,8 +596,7 @@ void QCameraExposure::setManualShutterSpeed(qreal seconds)
void QCameraExposure::setAutoShutterSpeed()
{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ShutterSpeed, QVariant());
+ d_func()->resetExposureParameter(QCameraExposureControl::ShutterSpeed);
}
diff --git a/src/multimedia/camera/qcameraexposure.h b/src/multimedia/camera/qcameraexposure.h
index ad25d68c5..576b73357 100644
--- a/src/multimedia/camera/qcameraexposure.h
+++ b/src/multimedia/camera/qcameraexposure.h
@@ -117,29 +117,30 @@ public:
qreal exposureCompensation() const;
MeteringMode meteringMode() const;
-
bool isMeteringModeSupported(MeteringMode mode) const;
QPointF spotMeteringPoint() const;
void setSpotMeteringPoint(const QPointF &point);
int isoSensitivity() const;
- QList<int> supportedIsoSensitivities(bool *continuous = 0) const;
-
qreal aperture() const;
- QList<qreal> supportedApertures(bool *continuous = 0) const;
-
qreal shutterSpeed() const;
+
+ int requestedIsoSensitivity() const;
+ qreal requestedAperture() const;
+ qreal requestedShutterSpeed() const;
+
+ QList<int> supportedIsoSensitivities(bool *continuous = 0) const;
+ QList<qreal> supportedApertures(bool * continuous = 0) const;
QList<qreal> supportedShutterSpeeds(bool *continuous = 0) const;
public Q_SLOTS:
void setFlashMode(FlashModes mode);
void setExposureMode(ExposureMode mode);
+ void setMeteringMode(MeteringMode mode);
void setExposureCompensation(qreal ev);
- void setMeteringMode(MeteringMode mode);
-
void setManualIsoSensitivity(int iso);
void setAutoIsoSensitivity();
diff --git a/src/multimedia/controls/qcameraexposurecontrol.cpp b/src/multimedia/controls/qcameraexposurecontrol.cpp
index 8bae85dd0..da0ebd3a9 100644
--- a/src/multimedia/controls/qcameraexposurecontrol.cpp
+++ b/src/multimedia/controls/qcameraexposurecontrol.cpp
@@ -90,53 +90,14 @@ QCameraExposureControl::QCameraExposureControl(QObject *parent):
}
/*!
- Destroys the camera control object.
+ Destroys the camera exposure control object.
*/
QCameraExposureControl::~QCameraExposureControl()
{
}
/*!
- \fn QCamera::ExposureMode QCameraExposureControl::exposureMode() const
-
- Returns the exposure mode.
-*/
-
-
-/*!
- \fn void QCameraExposureControl::setExposureMode(QCameraExposure::ExposureMode mode)
-
- Set the exposure mode to \a mode.
-*/
-
-
-/*!
- \fn bool QCameraExposureControl::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
-
- Returns true if the exposure \a mode is supported.
-*/
-
-
-/*!
- \fn QCameraExposure::MeteringMode QCameraExposureControl::meteringMode() const
- Returns the current metering mode.
-*/
-
-/*!
- \fn void QCameraExposureControl::setMeteringMode(QCameraExposure::MeteringMode mode)
-
- Set the metering mode to \a mode.
-*/
-
-/*!
- \fn bool QCameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
- Returns true if the metering \a mode is supported.
-*/
-
-/*!
\enum QCameraExposureControl::ExposureParameter
- \value InvalidParameter
- Parameter is invalid.
\value ISO
Camera ISO sensitivity, specified as integer value.
\value Aperture
@@ -153,84 +114,97 @@ QCameraExposureControl::~QCameraExposureControl()
with 0 value means no flash and 1.0 corresponds to full flash power.
This value is only used in the \l{QCameraExposure::FlashManual}{manual flash mode}.
+ \value TorchPower
+ Manual torch power, specified as qreal value.
+ Accepted power range is [0..1.0],
+ with 0 value means no light and 1.0 corresponds to full torch power.
+
+ This value is only used in the \l{QCameraExposure::FlashTorch}{torch flash mode}.
\value FlashCompensation
Flash compensation, specified as qreal EV value.
\value SpotMeteringPoint
The relative frame coordinate of the point to use for exposure metering
in spot metering mode, specified as a QPointF.
+ \value ExposureMode
+ Camera exposure mode.
+ \value MeteringMode
+ Camera metering mode.
\value ExtendedExposureParameter
The base value for platform specific extended parameters.
For such parameters the sequential values starting from ExtendedExposureParameter shuld be used.
*/
/*!
- \enum QCameraExposureControl::ParameterFlag
- \value AutomaticValue
- Use the automatic values for parameters.
- \value ReadOnly
- Parameters are read only.
- \value ContinuousRange
- Parameters are continuous in their range.
-*/
-
-/*!
\fn QCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
Returns true is exposure \a parameter is supported by backend.
+ \since 5.0
*/
/*!
- \fn QCameraExposureControl::exposureParameter(ExposureParameter parameter) const
+ \fn QCameraExposureControl::requestedValue(ExposureParameter parameter) const
+
+ Returns the requested exposure \a parameter value.
- Returns the exposure \a parameter value, or invalid QVariant() if the value is unknown or not supported.
+ \since 5.0
*/
/*!
- \fn QCameraExposureControl::exposureParameterFlags(ExposureParameter parameter) const
+ \fn QCameraExposureControl::actualValue(ExposureParameter parameter) const
- Returns the properties of exposure \a parameter.
+ Returns the actual exposure \a parameter value, or invalid QVariant() if the value is unknown or not supported.
+
+ The actual parameter value may differ for the requested one if automatic mode is selected or
+ camera supports only limited set of values within the supported range.
+ \since 5.0
*/
/*!
- \fn QCameraExposureControl::supportedParameterRange(ExposureParameter parameter) const
+ \fn QCameraExposureControl::supportedParameterRange(ExposureParameter parameter, bool *continuous = 0) const
Returns the list of supported \a parameter values;
+
+ If the camera supports arbitrary exposure parameter value within the supported range,
+ *\a continuous is set to true, otherwise *\a continuous is set to false.
+
+ \since 5.0
*/
/*!
- \fn bool QCameraExposureControl::setExposureParameter(ExposureParameter parameter, const QVariant& value)
+ \fn bool QCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value)
Set the exposure \a parameter to \a value.
If a null or invalid QVariant is passed, backend should choose the value automatically,
- and if possible report the actual value to user with QCameraExposureControl::exposureParameter().
+ and if possible report the actual value to user with QCameraExposureControl::actualValue().
Returns true if parameter is supported and value is correct.
+ \since 5.0
*/
/*!
- \fn QCameraExposureControl::extendedParameterName(ExposureParameter parameter)
+ \fn void QCameraExposureControl::requestedValueChanged(int parameter)
- Returns the extended exposure \a parameter name.
+ Signal emitted when the requested exposure \a parameter value has changed,
+ usually in result of setValue() call.
+ \since 5.0
*/
/*!
- \fn void QCameraExposureControl::flashReady(bool ready)
-
- Signal emitted when flash state changes, flash is charged \a ready.
-*/
+ \fn void QCameraExposureControl::actualValueChanged(int parameter)
-/*!
- \fn void QCameraExposureControl::exposureParameterChanged(int parameter)
+ Signal emitted when the actual exposure \a parameter value has changed,
+ usually in result of auto exposure algorithms or manual exposure parameter applied.
- Signal emitted when the exposure \a parameter has changed.
+ \since 5.0
*/
/*!
+ \fn void QCameraExposureControl::parameterRangeChanged(int parameter)
- \fn void QCameraExposureControl::exposureParameterRangeChanged(int parameter)
+ Signal emitted when the supported range of exposure \a parameter values has changed.
- Signal emitted when the exposure \a parameter range has changed.
+ \since 5.0
*/
diff --git a/src/multimedia/controls/qcameraexposurecontrol.h b/src/multimedia/controls/qcameraexposurecontrol.h
index 6c5b768b6..76c97b391 100644
--- a/src/multimedia/controls/qcameraexposurecontrol.h
+++ b/src/multimedia/controls/qcameraexposurecontrol.h
@@ -65,45 +65,30 @@ public:
~QCameraExposureControl();
enum ExposureParameter {
- InvalidParameter = 0,
- ISO = 1,
- Aperture = 2,
- ShutterSpeed = 3,
- ExposureCompensation = 4,
- FlashPower = 5,
- FlashCompensation = 6,
- SpotMeteringPoint = 7,
+ ISO,
+ Aperture,
+ ShutterSpeed,
+ ExposureCompensation,
+ FlashPower,
+ FlashCompensation,
+ TorchPower,
+ SpotMeteringPoint,
+ ExposureMode,
+ MeteringMode,
ExtendedExposureParameter = 1000
};
- enum ParameterFlag {
- AutomaticValue = 0x01,
- ReadOnly = 0x02,
- ContinuousRange = 0x04
- };
- Q_DECLARE_FLAGS(ParameterFlags, ParameterFlag)
-
- virtual QCameraExposure::ExposureMode exposureMode() const = 0;
- virtual void setExposureMode(QCameraExposure::ExposureMode mode) = 0;
- virtual bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const = 0;
-
- virtual QCameraExposure::MeteringMode meteringMode() const = 0;
- virtual void setMeteringMode(QCameraExposure::MeteringMode mode) = 0;
- virtual bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const = 0;
-
virtual bool isParameterSupported(ExposureParameter parameter) const = 0;
- virtual QVariant exposureParameter(ExposureParameter parameter) const = 0;
- virtual ParameterFlags exposureParameterFlags(ExposureParameter parameter) const = 0;
- virtual QVariantList supportedParameterRange(ExposureParameter parameter) const = 0;
- virtual bool setExposureParameter(ExposureParameter parameter, const QVariant& value) = 0;
+ virtual QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const = 0;
- virtual QString extendedParameterName(ExposureParameter parameter) = 0;
+ virtual QVariant requestedValue(ExposureParameter parameter) const = 0;
+ virtual QVariant actualValue(ExposureParameter parameter) const = 0;
+ virtual bool setValue(ExposureParameter parameter, const QVariant& value) = 0;
Q_SIGNALS:
- void flashReady(bool);
-
- void exposureParameterChanged(int parameter);
- void exposureParameterRangeChanged(int parameter);
+ void requestedValueChanged(int parameter);
+ void actualValueChanged(int parameter);
+ void parameterRangeChanged(int parameter);
protected:
QCameraExposureControl(QObject* parent = 0);
@@ -112,11 +97,11 @@ protected:
#define QCameraExposureControl_iid "com.nokia.Qt.QCameraExposureControl/1.0"
Q_MEDIA_DECLARE_CONTROL(QCameraExposureControl, QCameraExposureControl_iid)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QCameraExposureControl::ParameterFlags)
+QT_END_NAMESPACE
-Q_MEDIA_ENUM_DEBUG(QCameraExposureControl, ExposureParameter)
+Q_DECLARE_METATYPE(QCameraExposureControl::ExposureParameter)
-QT_END_NAMESPACE
+Q_MEDIA_ENUM_DEBUG(QCameraExposureControl, ExposureParameter)
QT_END_HEADER