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 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 QCAMERAEXPOSURE_H
41#define QCAMERAEXPOSURE_H
42
43#include <QtMultimedia/qmediaobject.h>
44#include <QtMultimedia/qmediaenumdebug.h>
45
46QT_BEGIN_NAMESPACE
47
48
49class QCamera;
50class QCameraExposurePrivate;
51
52class Q_MULTIMEDIA_EXPORT QCameraExposure : public QObject
53{
54 Q_OBJECT
55 Q_PROPERTY(qreal aperture READ aperture NOTIFY apertureChanged)
56 Q_PROPERTY(qreal shutterSpeed READ shutterSpeed NOTIFY shutterSpeedChanged)
57 Q_PROPERTY(int isoSensitivity READ isoSensitivity NOTIFY isoSensitivityChanged)
58 Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged)
59 Q_PROPERTY(bool flashReady READ isFlashReady NOTIFY flashReady)
60 Q_PROPERTY(QCameraExposure::FlashModes flashMode READ flashMode WRITE setFlashMode)
61 Q_PROPERTY(QCameraExposure::ExposureMode exposureMode READ exposureMode WRITE setExposureMode)
62 Q_PROPERTY(QCameraExposure::MeteringMode meteringMode READ meteringMode WRITE setMeteringMode)
63
64 Q_ENUMS(FlashMode)
65 Q_ENUMS(ExposureMode)
66 Q_ENUMS(MeteringMode)
67public:
68 enum FlashMode {
69 FlashAuto = 0x1,
70 FlashOff = 0x2,
71 FlashOn = 0x4,
72 FlashRedEyeReduction = 0x8,
73 FlashFill = 0x10,
74 FlashTorch = 0x20,
75 FlashVideoLight = 0x40,
76 FlashSlowSyncFrontCurtain = 0x80,
77 FlashSlowSyncRearCurtain = 0x100,
78 FlashManual = 0x200
79 };
80 Q_DECLARE_FLAGS(FlashModes, FlashMode)
81
82 enum ExposureMode {
83 ExposureAuto = 0,
84 ExposureManual = 1,
85 ExposurePortrait = 2,
86 ExposureNight = 3,
87 ExposureBacklight = 4,
88 ExposureSpotlight = 5,
89 ExposureSports = 6,
90 ExposureSnow = 7,
91 ExposureBeach = 8,
92 ExposureLargeAperture = 9,
93 ExposureSmallAperture = 10,
94 ExposureAction = 11,
95 ExposureLandscape = 12,
96 ExposureNightPortrait = 13,
97 ExposureTheatre = 14,
98 ExposureSunset = 15,
99 ExposureSteadyPhoto = 16,
100 ExposureFireworks = 17,
101 ExposureParty = 18,
102 ExposureCandlelight = 19,
103 ExposureBarcode = 20,
104 ExposureModeVendor = 1000
105 };
106
107 enum MeteringMode {
108 MeteringMatrix = 1,
109 MeteringAverage = 2,
110 MeteringSpot = 3
111 };
112
113 bool isAvailable() const;
114
115 FlashModes flashMode() const;
116 bool isFlashModeSupported(FlashModes mode) const;
117 bool isFlashReady() const;
118
119 ExposureMode exposureMode() const;
120 bool isExposureModeSupported(ExposureMode mode) const;
121
122 qreal exposureCompensation() const;
123
124 MeteringMode meteringMode() const;
125 bool isMeteringModeSupported(MeteringMode mode) const;
126
127 QPointF spotMeteringPoint() const;
128 void setSpotMeteringPoint(const QPointF &point);
129
130 int isoSensitivity() const;
131 qreal aperture() const;
132 qreal shutterSpeed() const;
133
134 int requestedIsoSensitivity() const;
135 qreal requestedAperture() const;
136 qreal requestedShutterSpeed() const;
137
138 QList<int> supportedIsoSensitivities(bool *continuous = nullptr) const;
139 QList<qreal> supportedApertures(bool *continuous = nullptr) const;
140 QList<qreal> supportedShutterSpeeds(bool *continuous = nullptr) const;
141
142public Q_SLOTS:
143 void setFlashMode(FlashModes mode);
144 void setExposureMode(ExposureMode mode);
145 void setMeteringMode(MeteringMode mode);
146
147 void setExposureCompensation(qreal ev);
148
149 void setManualIsoSensitivity(int iso);
150 void setAutoIsoSensitivity();
151
152 void setManualAperture(qreal aperture);
153 void setAutoAperture();
154
155 void setManualShutterSpeed(qreal seconds);
156 void setAutoShutterSpeed();
157
158Q_SIGNALS:
159 void flashReady(bool);
160
161 void apertureChanged(qreal);
162 void apertureRangeChanged();
163 void shutterSpeedChanged(qreal speed);
164 void shutterSpeedRangeChanged();
165 void isoSensitivityChanged(int);
166 void exposureCompensationChanged(qreal);
167
168protected:
169 virtual ~QCameraExposure();
170
171private:
172 friend class QCamera;
173 friend class QCameraPrivate;
174 explicit QCameraExposure(QCamera *parent = nullptr);
175
176 Q_DISABLE_COPY(QCameraExposure)
177 Q_DECLARE_PRIVATE(QCameraExposure)
178 Q_PRIVATE_SLOT(d_func(), void _q_exposureParameterChanged(int))
179 Q_PRIVATE_SLOT(d_func(), void _q_exposureParameterRangeChanged(int))
180 QCameraExposurePrivate *d_ptr;
181};
182
183Q_DECLARE_OPERATORS_FOR_FLAGS(QCameraExposure::FlashModes)
184
185QT_END_NAMESPACE
186
187Q_DECLARE_METATYPE(QCameraExposure::ExposureMode)
188Q_DECLARE_METATYPE(QCameraExposure::FlashModes)
189Q_DECLARE_METATYPE(QCameraExposure::MeteringMode)
190
191Q_MEDIA_ENUM_DEBUG(QCameraExposure, ExposureMode)
192Q_MEDIA_ENUM_DEBUG(QCameraExposure, FlashMode)
193Q_MEDIA_ENUM_DEBUG(QCameraExposure, MeteringMode)
194
195#endif // QCAMERAEXPOSURE_H
196

source code of qtmultimedia/src/multimedia/camera/qcameraexposure.h