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);
65 Q_PROPERTY(Zoom *zoom READ zoom NOTIFY zoomChanged);
66 Q_PROPERTY(Flash *flash READ flash NOTIFY flashChanged);
67 Q_PROPERTY(Scene *scene READ scene NOTIFY sceneChanged);
68 Q_PROPERTY(EvComp *evComp READ evComp NOTIFY evCompChanged);
69 Q_PROPERTY(WhiteBalance *whiteBalance READ whiteBalance NOTIFY whiteBalanceChanged);
70 Q_PROPERTY(ColorTone *colorTone READ colorTone NOTIFY colorToneChanged);
71 Q_PROPERTY(Iso *iso READ iso NOTIFY isoChanged);
72 Q_PROPERTY(Exposure *exposure READ exposure NOTIFY exposureChanged);
73 Q_PROPERTY(Aperture *aperture READ aperture NOTIFY apertureChanged);
74 Q_PROPERTY(NoiseReduction *noiseReduction READ noiseReduction NOTIFY noiseReductionChanged);
75 Q_PROPERTY(FlickerReduction *flickerReduction READ flickerReduction NOTIFY flickerReductionChanged);
76 Q_PROPERTY(Focus *focus READ focus NOTIFY focusChanged);
77 Q_PROPERTY(AutoFocus *autoFocus READ autoFocus NOTIFY autoFocusChanged);
79 Q_PROPERTY(VideoMute *videoMute READ videoMute NOTIFY videoMuteChanged);
80 Q_PROPERTY(VideoTorch *videoTorch READ videoTorch NOTIFY videoTorchChanged);
91 Camera(QDeclarativeItem *parent = 0);
94 virtual void componentComplete();
96 int deviceCount() const;
97 Q_INVOKABLE QString deviceName(int index) const;
98 Q_INVOKABLE QVariant deviceId(int index) const;
100 Q_INVOKABLE bool reset(const QVariant& deviceId, const CameraMode& mode);
102 QVariant deviceId() const;
106 QtCamDevice *device() const;
108 Q_INVOKABLE bool start();
109 Q_INVOKABLE bool stop(bool force = false);
114 QString imageSuffix() const;
115 QString videoSuffix() const;
117 Notifications *notifications() const;
118 void setNotifications(Notifications *notifications);
121 Flash *flash() const;
122 Scene *scene() const;
123 EvComp *evComp() const;
124 WhiteBalance *whiteBalance() const;
125 ColorTone *colorTone() const;
127 Exposure *exposure() const;
128 Aperture *aperture() const;
129 NoiseReduction *noiseReduction() const;
130 FlickerReduction *flickerReduction() const;
131 Focus *focus() const;
132 AutoFocus *autoFocus() const;
134 VideoMute *videoMute() const;
135 VideoTorch *videoTorch() const;
137 QRectF renderArea() const;
140 void deviceCountChanged();
141 void deviceIdChanged();
142 void deviceChanged();
144 void idleStateChanged();
145 void runningStateChanged();
146 void error(const QString& message, int code, const QString& debug);
147 void notificationsChanged();
148 void renderAreaChanged();
153 void evCompChanged();
154 void whiteBalanceChanged();
155 void colorToneChanged();
157 void exposureChanged();
158 void apertureChanged();
159 void noiseReductionChanged();
160 void flickerReductionChanged();
162 void autoFocusChanged();
164 void videoMuteChanged();
165 void videoTorchChanged();
168 void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
172 bool setDeviceId(const QVariant& deviceId);
173 bool setMode(const CameraMode& mode);
175 void resetCapabilities();
180 QtCamGraphicsViewfinder *m_vf;
182 NotificationsContainer *m_notifications;
188 WhiteBalance *m_whiteBalance;
189 ColorTone *m_colorTone;
191 Exposure *m_exposure;
192 Aperture *m_aperture;
193 NoiseReduction *m_noiseReduction;
194 FlickerReduction *m_flickerReduction;
196 AutoFocus *m_autoFocus;
198 VideoMute *m_videoMute;
199 VideoTorch *m_videoTorch;
202 #endif /* CAMERA_H */