1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the plugins of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QDECLARATIVECAMERAEXPOSURE_H
41#define QDECLARATIVECAMERAEXPOSURE_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists for the convenience
48// of other Qt classes. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include "qdeclarativecamera_p.h"
55#include <qcamera.h>
56#include <qcameraexposure.h>
57
58QT_BEGIN_NAMESPACE
59
60class QDeclarativeCamera;
61
62class QDeclarativeCameraExposure : public QObject
63{
64 Q_OBJECT
65 Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged)
66
67 Q_PROPERTY(int iso READ isoSensitivity NOTIFY isoSensitivityChanged)
68 Q_PROPERTY(qreal shutterSpeed READ shutterSpeed NOTIFY shutterSpeedChanged)
69 Q_PROPERTY(qreal aperture READ aperture NOTIFY apertureChanged)
70
71 Q_PROPERTY(qreal manualShutterSpeed READ manualShutterSpeed WRITE setManualShutterSpeed NOTIFY manualShutterSpeedChanged)
72 Q_PROPERTY(qreal manualAperture READ manualAperture WRITE setManualAperture NOTIFY manualApertureChanged)
73 Q_PROPERTY(qreal manualIso READ manualIsoSensitivity WRITE setManualIsoSensitivity NOTIFY manualIsoSensitivityChanged)
74
75 Q_PROPERTY(ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged)
76 Q_PROPERTY(QVariantList supportedExposureModes READ supportedExposureModes NOTIFY supportedExposureModesChanged REVISION 1)
77
78 Q_PROPERTY(QPointF spotMeteringPoint READ spotMeteringPoint WRITE setSpotMeteringPoint NOTIFY spotMeteringPointChanged)
79 Q_PROPERTY(MeteringMode meteringMode READ meteringMode WRITE setMeteringMode NOTIFY meteringModeChanged)
80
81 Q_ENUMS(ExposureMode)
82 Q_ENUMS(MeteringMode)
83public:
84 enum ExposureMode {
85 ExposureAuto = QCameraExposure::ExposureAuto,
86 ExposureManual = QCameraExposure::ExposureManual,
87 ExposurePortrait = QCameraExposure::ExposurePortrait,
88 ExposureNight = QCameraExposure::ExposureNight,
89 ExposureBacklight = QCameraExposure::ExposureBacklight,
90 ExposureSpotlight = QCameraExposure::ExposureSpotlight,
91 ExposureSports = QCameraExposure::ExposureSports,
92 ExposureSnow = QCameraExposure::ExposureSnow,
93 ExposureBeach = QCameraExposure::ExposureBeach,
94 ExposureLargeAperture = QCameraExposure::ExposureLargeAperture,
95 ExposureSmallAperture = QCameraExposure::ExposureSmallAperture,
96 ExposureAction = QCameraExposure::ExposureAction,
97 ExposureLandscape = QCameraExposure::ExposureLandscape,
98 ExposureNightPortrait = QCameraExposure::ExposureNightPortrait,
99 ExposureTheatre = QCameraExposure::ExposureTheatre,
100 ExposureSunset = QCameraExposure::ExposureSunset,
101 ExposureSteadyPhoto = QCameraExposure::ExposureSteadyPhoto,
102 ExposureFireworks = QCameraExposure::ExposureFireworks,
103 ExposureParty = QCameraExposure::ExposureParty,
104 ExposureCandlelight = QCameraExposure::ExposureCandlelight,
105 ExposureBarcode = QCameraExposure::ExposureBarcode,
106 ExposureModeVendor = QCameraExposure::ExposureModeVendor
107 };
108
109 enum MeteringMode {
110 MeteringMatrix = QCameraExposure::MeteringMatrix,
111 MeteringAverage = QCameraExposure::MeteringAverage,
112 MeteringSpot = QCameraExposure::MeteringSpot
113 };
114
115 ~QDeclarativeCameraExposure();
116
117 ExposureMode exposureMode() const;
118 QVariantList supportedExposureModes() const;
119 qreal exposureCompensation() const;
120
121 int isoSensitivity() const;
122 qreal shutterSpeed() const;
123 qreal aperture() const;
124
125 int manualIsoSensitivity() const;
126 qreal manualShutterSpeed() const;
127 qreal manualAperture() const;
128
129 QPointF spotMeteringPoint() const;
130 void setSpotMeteringPoint(const QPointF &point);
131
132 MeteringMode meteringMode() const;
133 void setMeteringMode(MeteringMode mode);
134
135public Q_SLOTS:
136 void setExposureMode(ExposureMode);
137 void setExposureCompensation(qreal ev);
138
139 void setManualAperture(qreal);
140 void setManualShutterSpeed(qreal);
141 void setManualIsoSensitivity(int iso);
142
143 void setAutoAperture();
144 void setAutoShutterSpeed();
145 void setAutoIsoSensitivity();
146
147Q_SIGNALS:
148 void isoSensitivityChanged(int);
149 void apertureChanged(qreal);
150 void shutterSpeedChanged(qreal);
151
152 void manualIsoSensitivityChanged(int);
153 void manualApertureChanged(qreal);
154 void manualShutterSpeedChanged(qreal);
155
156 void exposureCompensationChanged(qreal);
157 void exposureModeChanged(ExposureMode);
158 void supportedExposureModesChanged();
159
160 void meteringModeChanged(MeteringMode);
161 void spotMeteringPointChanged(QPointF);
162
163private:
164 friend class QDeclarativeCamera;
165 QDeclarativeCameraExposure(QCamera *camera, QObject *parent = 0);
166
167 QCameraExposure *m_exposure;
168 int m_manualIso;
169 qreal m_manualAperture;
170 qreal m_manualShutterSpeed;
171};
172
173QT_END_NAMESPACE
174
175QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraExposure))
176
177#endif
178

source code of qtmultimedia/src/imports/multimedia/qdeclarativecameraexposure_p.h