4 * This file is part of CameraPlus.
6 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <QDeclarativeItem>
32 class QtCamGraphicsViewfinder;
33 class DeclarativeQtCameraNotifications;
34 class NotificationsContainer;
45 class FlickerReduction;
52 class Camera : public QDeclarativeItem {
55 Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
56 Q_PROPERTY(QVariant deviceId READ deviceId NOTIFY deviceIdChanged);
57 Q_PROPERTY(CameraMode mode READ mode NOTIFY modeChanged);
58 Q_PROPERTY(bool idle READ isIdle NOTIFY idleStateChanged);
59 Q_PROPERTY(bool running READ isRunning NOTIFY runningStateChanged);
60 Q_PROPERTY(QString imageSuffix READ imageSuffix CONSTANT);
61 Q_PROPERTY(QString videoSuffix READ videoSuffix CONSTANT);
62 Q_PROPERTY(DeclarativeQtCameraNotifications *notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged);
64 Q_PROPERTY(QRectF renderArea READ renderArea NOTIFY renderAreaChanged);
65 Q_PROPERTY(QSizeF videoResolution READ videoResolution NOTIFY videoResolutionChanged);
67 Q_PROPERTY(Zoom *zoom READ zoom NOTIFY zoomChanged);
68 Q_PROPERTY(Flash *flash READ flash NOTIFY flashChanged);
69 Q_PROPERTY(Scene *scene READ scene NOTIFY sceneChanged);
70 Q_PROPERTY(EvComp *evComp READ evComp NOTIFY evCompChanged);
71 Q_PROPERTY(WhiteBalance *whiteBalance READ whiteBalance NOTIFY whiteBalanceChanged);
72 Q_PROPERTY(ColorTone *colorTone READ colorTone NOTIFY colorToneChanged);
73 Q_PROPERTY(Iso *iso READ iso NOTIFY isoChanged);
74 Q_PROPERTY(Exposure *exposure READ exposure NOTIFY exposureChanged);
75 Q_PROPERTY(Aperture *aperture READ aperture NOTIFY apertureChanged);
76 Q_PROPERTY(NoiseReduction *noiseReduction READ noiseReduction NOTIFY noiseReductionChanged);
77 Q_PROPERTY(FlickerReduction *flickerReduction READ flickerReduction NOTIFY flickerReductionChanged);
78 Q_PROPERTY(Focus *focus READ focus NOTIFY focusChanged);
79 Q_PROPERTY(AutoFocus *autoFocus READ autoFocus NOTIFY autoFocusChanged);
80 Q_PROPERTY(Roi *roi READ roi NOTIFY roiChanged);
82 Q_PROPERTY(VideoMute *videoMute READ videoMute NOTIFY videoMuteChanged);
83 Q_PROPERTY(VideoTorch *videoTorch READ videoTorch NOTIFY videoTorchChanged);
85 Q_PROPERTY(bool renderingEnabled READ isRenderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged);
96 Camera(QDeclarativeItem *parent = 0);
99 virtual void componentComplete();
101 int deviceCount() const;
102 Q_INVOKABLE QString deviceName(int index) const;
103 Q_INVOKABLE QVariant deviceId(int index) const;
105 Q_INVOKABLE bool reset(const QVariant& deviceId, const CameraMode& mode);
107 QVariant deviceId() const;
111 QtCamDevice *device() const;
113 Q_INVOKABLE bool start();
114 Q_INVOKABLE bool stop(bool force = false);
119 QString imageSuffix() const;
120 QString videoSuffix() const;
122 DeclarativeQtCameraNotifications *notifications() const;
123 void setNotifications(DeclarativeQtCameraNotifications *notifications);
126 Flash *flash() const;
127 Scene *scene() const;
128 EvComp *evComp() const;
129 WhiteBalance *whiteBalance() const;
130 ColorTone *colorTone() const;
132 Exposure *exposure() const;
133 Aperture *aperture() const;
134 NoiseReduction *noiseReduction() const;
135 FlickerReduction *flickerReduction() const;
136 Focus *focus() const;
137 AutoFocus *autoFocus() const;
140 VideoMute *videoMute() const;
141 VideoTorch *videoTorch() const;
143 QRectF renderArea() const;
144 QSizeF videoResolution() const;
146 bool isRenderingEnabled() const;
147 void setRenderingEnabled(bool enabled);
150 void deviceCountChanged();
151 void deviceIdChanged();
152 void deviceChanged();
154 void idleStateChanged();
155 void runningStateChanged();
156 void error(const QString& message, int code, const QString& debug);
157 void notificationsChanged();
158 void renderAreaChanged();
159 void videoResolutionChanged();
164 void evCompChanged();
165 void whiteBalanceChanged();
166 void colorToneChanged();
168 void exposureChanged();
169 void apertureChanged();
170 void noiseReductionChanged();
171 void flickerReductionChanged();
173 void autoFocusChanged();
176 void videoMuteChanged();
177 void videoTorchChanged();
178 void renderingEnabledChanged();
181 void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
185 bool setDeviceId(const QVariant& deviceId);
186 bool setMode(const CameraMode& mode);
188 void resetCapabilities();
193 QtCamGraphicsViewfinder *m_vf;
195 NotificationsContainer *m_notifications;
201 WhiteBalance *m_whiteBalance;
202 ColorTone *m_colorTone;
204 Exposure *m_exposure;
205 Aperture *m_aperture;
206 NoiseReduction *m_noiseReduction;
207 FlickerReduction *m_flickerReduction;
209 AutoFocus *m_autoFocus;
212 VideoMute *m_videoMute;
213 VideoTorch *m_videoTorch;
216 #endif /* CAMERA_H */