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;
34 class NotificationsContainer;
45 class FlickerReduction;
51 class Camera : public QDeclarativeItem {
54 Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
55 Q_PROPERTY(QVariant deviceId READ deviceId NOTIFY deviceIdChanged);
56 Q_PROPERTY(CameraMode mode READ mode NOTIFY modeChanged);
57 Q_PROPERTY(bool idle READ isIdle NOTIFY idleStateChanged);
58 Q_PROPERTY(bool running READ isRunning NOTIFY runningStateChanged);
59 Q_PROPERTY(QString imageSuffix READ imageSuffix CONSTANT);
60 Q_PROPERTY(QString videoSuffix READ videoSuffix CONSTANT);
61 Q_PROPERTY(Notifications *notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged);
63 Q_PROPERTY(QRectF renderArea READ renderArea NOTIFY renderAreaChanged);
64 Q_PROPERTY(QSizeF videoResolution READ videoResolution NOTIFY videoResolutionChanged);
66 Q_PROPERTY(Zoom *zoom READ zoom NOTIFY zoomChanged);
67 Q_PROPERTY(Flash *flash READ flash NOTIFY flashChanged);
68 Q_PROPERTY(Scene *scene READ scene NOTIFY sceneChanged);
69 Q_PROPERTY(EvComp *evComp READ evComp NOTIFY evCompChanged);
70 Q_PROPERTY(WhiteBalance *whiteBalance READ whiteBalance NOTIFY whiteBalanceChanged);
71 Q_PROPERTY(ColorTone *colorTone READ colorTone NOTIFY colorToneChanged);
72 Q_PROPERTY(Iso *iso READ iso NOTIFY isoChanged);
73 Q_PROPERTY(Exposure *exposure READ exposure NOTIFY exposureChanged);
74 Q_PROPERTY(Aperture *aperture READ aperture NOTIFY apertureChanged);
75 Q_PROPERTY(NoiseReduction *noiseReduction READ noiseReduction NOTIFY noiseReductionChanged);
76 Q_PROPERTY(FlickerReduction *flickerReduction READ flickerReduction NOTIFY flickerReductionChanged);
77 Q_PROPERTY(Focus *focus READ focus NOTIFY focusChanged);
78 Q_PROPERTY(AutoFocus *autoFocus READ autoFocus NOTIFY autoFocusChanged);
80 Q_PROPERTY(VideoMute *videoMute READ videoMute NOTIFY videoMuteChanged);
81 Q_PROPERTY(VideoTorch *videoTorch READ videoTorch NOTIFY videoTorchChanged);
83 Q_PROPERTY(bool renderingEnabled READ isRenderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged);
94 Camera(QDeclarativeItem *parent = 0);
97 virtual void componentComplete();
99 int deviceCount() const;
100 Q_INVOKABLE QString deviceName(int index) const;
101 Q_INVOKABLE QVariant deviceId(int index) const;
103 Q_INVOKABLE bool reset(const QVariant& deviceId, const CameraMode& mode);
105 QVariant deviceId() const;
109 QtCamDevice *device() const;
111 Q_INVOKABLE bool start();
112 Q_INVOKABLE bool stop(bool force = false);
117 QString imageSuffix() const;
118 QString videoSuffix() const;
120 Notifications *notifications() const;
121 void setNotifications(Notifications *notifications);
124 Flash *flash() const;
125 Scene *scene() const;
126 EvComp *evComp() const;
127 WhiteBalance *whiteBalance() const;
128 ColorTone *colorTone() const;
130 Exposure *exposure() const;
131 Aperture *aperture() const;
132 NoiseReduction *noiseReduction() const;
133 FlickerReduction *flickerReduction() const;
134 Focus *focus() const;
135 AutoFocus *autoFocus() const;
137 VideoMute *videoMute() const;
138 VideoTorch *videoTorch() const;
140 QRectF renderArea() const;
141 QSizeF videoResolution() const;
143 bool isRenderingEnabled() const;
144 void setRenderingEnabled(bool enabled);
147 void deviceCountChanged();
148 void deviceIdChanged();
149 void deviceChanged();
151 void idleStateChanged();
152 void runningStateChanged();
153 void error(const QString& message, int code, const QString& debug);
154 void notificationsChanged();
155 void renderAreaChanged();
156 void videoResolutionChanged();
161 void evCompChanged();
162 void whiteBalanceChanged();
163 void colorToneChanged();
165 void exposureChanged();
166 void apertureChanged();
167 void noiseReductionChanged();
168 void flickerReductionChanged();
170 void autoFocusChanged();
172 void videoMuteChanged();
173 void videoTorchChanged();
174 void renderingEnabledChanged();
177 void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
181 bool setDeviceId(const QVariant& deviceId);
182 bool setMode(const CameraMode& mode);
184 void resetCapabilities();
189 QtCamGraphicsViewfinder *m_vf;
191 NotificationsContainer *m_notifications;
197 WhiteBalance *m_whiteBalance;
198 ColorTone *m_colorTone;
200 Exposure *m_exposure;
201 Aperture *m_aperture;
202 NoiseReduction *m_noiseReduction;
203 FlickerReduction *m_flickerReduction;
205 AutoFocus *m_autoFocus;
207 VideoMute *m_videoMute;
208 VideoTorch *m_videoTorch;
211 #endif /* CAMERA_H */