summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/multimedia/qdeclarativecamera_p.h7
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure.cpp34
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure_p.h12
-rw-r--r--src/multimedia/camera/qcameraexposure.cpp27
-rw-r--r--src/multimedia/camera/qcameraexposure.h3
-rw-r--r--src/multimedia/controls/qcameraexposurecontrol.cpp4
-rw-r--r--src/multimedia/controls/qcameraexposurecontrol.h1
-rw-r--r--src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp19
-rw-r--r--src/plugins/simulator/camera/simulatorcameraexposurecontrol.h1
9 files changed, 106 insertions, 2 deletions
diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h
index 7004f7e58..6de84f05f 100644
--- a/src/imports/multimedia/qdeclarativecamera_p.h
+++ b/src/imports/multimedia/qdeclarativecamera_p.h
@@ -104,6 +104,7 @@ class QDeclarativeCamera : public QObject, public QDeclarativeParserStatus
Q_ENUMS(FlashMode)
Q_ENUMS(ExposureMode)
+ Q_ENUMS(MeteringMode)
Q_ENUMS(FocusMode)
Q_ENUMS(FocusPointMode)
@@ -164,6 +165,12 @@ public:
ExposureModeVendor = QCameraExposure::ExposureModeVendor
};
+ enum MeteringMode {
+ MeteringMatrix = QCameraExposure::MeteringMatrix,
+ MeteringAverage = QCameraExposure::MeteringAverage,
+ MeteringSpot = QCameraExposure::MeteringSpot
+ };
+
enum FocusMode {
FocusManual = QCameraFocus::ManualFocus,
FocusHyperfocal = QCameraFocus::HyperfocalFocus,
diff --git a/src/imports/multimedia/qdeclarativecameraexposure.cpp b/src/imports/multimedia/qdeclarativecameraexposure.cpp
index 5eca87ca9..79d939e83 100644
--- a/src/imports/multimedia/qdeclarativecameraexposure.cpp
+++ b/src/imports/multimedia/qdeclarativecameraexposure.cpp
@@ -253,7 +253,41 @@ void QDeclarativeCameraExposure::setExposureMode(QDeclarativeCamera::ExposureMod
\fn void QDeclarativeCameraExposure::exposureModeChanged(QDeclarativeCamera::ExposureMode)
*/
+/*!
+ \qmlproperty QPointF CameraExposure::spotMeteringPoint
+ \property QDeclarativeCameraExposure::spotMeteringPoint
+
+ The relative frame coordinates of the point to use for exposure metering (in relative
+ frame coordinates). This point is only used in spot metering mode, and typically defaults
+ to the center \c (0.5, 0.5).
+ */
+
+QPointF QDeclarativeCameraExposure::spotMeteringPoint() const
+{
+ return m_exposure->spotMeteringPoint();
+}
+
+void QDeclarativeCameraExposure::setSpotMeteringPoint(const QPointF &point)
+{
+ QPointF oldPoint(spotMeteringPoint());
+ m_exposure->setSpotMeteringPoint(point);
+ if (oldPoint != spotMeteringPoint())
+ emit spotMeteringPointChanged(spotMeteringPoint());
+}
+
+QDeclarativeCamera::MeteringMode QDeclarativeCameraExposure::meteringMode() const
+{
+ return QDeclarativeCamera::MeteringMode(m_exposure->meteringMode());
+}
+
+void QDeclarativeCameraExposure::setMeteringMode(QDeclarativeCamera::MeteringMode mode)
+{
+ QDeclarativeCamera::MeteringMode oldMode = meteringMode();
+ m_exposure->setMeteringMode(QCameraExposure::MeteringMode(mode));
+ if (oldMode != meteringMode())
+ emit meteringModeChanged(meteringMode());
+}
QT_END_NAMESPACE
diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h
index bd2788fcd..127e62384 100644
--- a/src/imports/multimedia/qdeclarativecameraexposure_p.h
+++ b/src/imports/multimedia/qdeclarativecameraexposure_p.h
@@ -78,6 +78,9 @@ class QDeclarativeCameraExposure : public QObject
Q_PROPERTY(QDeclarativeCamera::ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged)
+ Q_PROPERTY(QPointF spotMeteringPoint READ spotMeteringPoint WRITE setSpotMeteringPoint NOTIFY spotMeteringPointChanged)
+ Q_PROPERTY(QDeclarativeCamera::MeteringMode meteringMode READ meteringMode WRITE setMeteringMode NOTIFY meteringModeChanged)
+
public:
~QDeclarativeCameraExposure();
@@ -92,6 +95,12 @@ public:
qreal manualShutterSpeed() const;
qreal manualAperture() const;
+ QPointF spotMeteringPoint() const;
+ void setSpotMeteringPoint(const QPointF &point);
+
+ QDeclarativeCamera::MeteringMode meteringMode() const;
+ void setMeteringMode(QDeclarativeCamera::MeteringMode mode);
+
public Q_SLOTS:
void setExposureMode(QDeclarativeCamera::ExposureMode);
void setExposureCompensation(qreal ev);
@@ -116,6 +125,9 @@ Q_SIGNALS:
void exposureCompensationChanged(qreal);
void exposureModeChanged(QDeclarativeCamera::ExposureMode);
+ void meteringModeChanged(QDeclarativeCamera::MeteringMode);
+ void spotMeteringPointChanged(QPointF);
+
private:
friend class QDeclarativeCamera;
QDeclarativeCameraExposure(QCamera *camera, QObject *parent = 0);
diff --git a/src/multimedia/camera/qcameraexposure.cpp b/src/multimedia/camera/qcameraexposure.cpp
index 5c75ad9e2..a618fa317 100644
--- a/src/multimedia/camera/qcameraexposure.cpp
+++ b/src/multimedia/camera/qcameraexposure.cpp
@@ -312,6 +312,33 @@ void QCameraExposure::setMeteringMode(QCameraExposure::MeteringMode mode)
}
/*!
+ \property QCameraExposure::spotMeteringPoint
+
+ When supported, this property is the (normalized) position of the point of the image
+ where exposure metering will be performed. This is typically used to indicate an
+ "interesting" area of the image that should be exposed properly.
+
+ The coordinates are relative frame coordinates:
+ QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center,
+ which is typically the default spot metering point.
+
+ The spot metering point is only used with spot metering mode.
+ \since 1.1
+ */
+
+QPointF QCameraExposure::spotMeteringPoint() const
+{
+ return d_func()->exposureControl ? d_func()->exposureControl->exposureParameter(QCameraExposureControl::SpotMeteringPoint).toPointF() : QPointF();
+}
+
+void QCameraExposure::setSpotMeteringPoint(const QPointF &point)
+{
+ if (d_func()->exposureControl)
+ d_func()->exposureControl->setExposureParameter(QCameraExposureControl::SpotMeteringPoint, point);
+}
+
+
+/*!
Returns true if the metering \a mode is supported.
\since 1.1
*/
diff --git a/src/multimedia/camera/qcameraexposure.h b/src/multimedia/camera/qcameraexposure.h
index 088e7c036..96350a9c1 100644
--- a/src/multimedia/camera/qcameraexposure.h
+++ b/src/multimedia/camera/qcameraexposure.h
@@ -120,6 +120,9 @@ public:
bool isMeteringModeSupported(MeteringMode mode) const;
+ QPointF spotMeteringPoint() const;
+ void setSpotMeteringPoint(const QPointF &point);
+
int isoSensitivity() const;
QList<int> supportedIsoSensitivities(bool *continuous = 0) const;
diff --git a/src/multimedia/controls/qcameraexposurecontrol.cpp b/src/multimedia/controls/qcameraexposurecontrol.cpp
index 4a6f655f8..cd54a1b77 100644
--- a/src/multimedia/controls/qcameraexposurecontrol.cpp
+++ b/src/multimedia/controls/qcameraexposurecontrol.cpp
@@ -133,7 +133,6 @@ QCameraExposureControl::~QCameraExposureControl()
\since 1.1
*/
-
/*!
\fn bool QCameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
Returns true if the metering \a mode is supported.
@@ -162,6 +161,9 @@ QCameraExposureControl::~QCameraExposureControl()
This value is only used in the \l{QCameraExposure::FlashManual}{manual 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 ExtendedExposureParameter
The base value for platform specific extended parameters.
For such parameters the sequential values starting from ExtendedExposureParameter shuld be used.
diff --git a/src/multimedia/controls/qcameraexposurecontrol.h b/src/multimedia/controls/qcameraexposurecontrol.h
index ff60784bf..1574bf5b4 100644
--- a/src/multimedia/controls/qcameraexposurecontrol.h
+++ b/src/multimedia/controls/qcameraexposurecontrol.h
@@ -72,6 +72,7 @@ public:
ExposureCompensation = 4,
FlashPower = 5,
FlashCompensation = 6,
+ SpotMeteringPoint = 7,
ExtendedExposureParameter = 1000
};
diff --git a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
index 1ee820d8c..f4de0dba9 100644
--- a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
+++ b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
@@ -48,6 +48,7 @@ SimulatorCameraExposureControl::SimulatorCameraExposureControl(SimulatorCameraSe
QCameraExposureControl(parent),
mExposureMode(QCameraExposure::ExposureAuto),
mMeteringMode(QCameraExposure::MeteringAverage),
+ mSpot(0.5, 0.5),
mSession(session),
mSettings(0)
{
@@ -138,6 +139,7 @@ bool SimulatorCameraExposureControl::isParameterSupported(ExposureParameter para
case QCameraExposureControl::Aperture:
case QCameraExposureControl::ShutterSpeed:
case QCameraExposureControl::ExposureCompensation:
+ case QCameraExposureControl::SpotMeteringPoint:
return true;
case QCameraExposureControl::FlashPower:
case QCameraExposureControl::FlashCompensation:
@@ -161,6 +163,10 @@ QVariant SimulatorCameraExposureControl::exposureParameter(ExposureParameter par
return QVariant(shutterSpeed());
case QCameraExposureControl::ExposureCompensation:
return QVariant(exposureCompensation());
+
+ case QCameraExposureControl::SpotMeteringPoint:
+ return mSpot;
+
case QCameraExposureControl::FlashPower:
case QCameraExposureControl::FlashCompensation:
// Not supported
@@ -303,6 +309,16 @@ bool SimulatorCameraExposureControl::setExposureParameter(ExposureParameter para
case QCameraExposureControl::FlashCompensation:
return false;
+ case QCameraExposureControl::SpotMeteringPoint:
+ {
+ static QRectF valid(0, 0, 1, 1);
+ if (valid.contains(value.toPointF())) {
+ mSpot = value.toPointF();
+ return true;
+ }
+ return false;
+ }
+
default:
// Not supported
return false;
@@ -324,7 +340,8 @@ QString SimulatorCameraExposureControl::extendedParameterName(ExposureParameter
return QString("Flash Power");
case QCameraExposureControl::FlashCompensation:
return QString("Flash Compensation");
-
+ case QCameraExposureControl::SpotMeteringPoint:
+ return QString("Spot Metering Point");
default:
return QString();
}
diff --git a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
index 5e00a6d44..5b7067b77 100644
--- a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
+++ b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
@@ -116,6 +116,7 @@ private: // Internal - Implementing ExposureParameter
private: // Data
QCameraExposure::ExposureMode mExposureMode;
QCameraExposure::MeteringMode mMeteringMode;
+ QPointF mSpot;
SimulatorCameraSession *mSession;
SimulatorCameraSettings *mSettings;
};