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;
36 class Camera : public QDeclarativeItem {
39 Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
40 Q_PROPERTY(QVariant deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged);
41 Q_PROPERTY(CameraMode mode READ mode WRITE setMode NOTIFY modeChanged);
42 Q_PROPERTY(bool idle READ isIdle NOTIFY idleStateChanged);
43 Q_PROPERTY(bool running READ isRunning NOTIFY runningStateChanged);
44 Q_PROPERTY(QString imageSuffix READ imageSuffix CONSTANT);
45 Q_PROPERTY(QString videoSuffix READ videoSuffix CONSTANT);
46 Q_PROPERTY(Notifications *notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged);
56 Camera(QDeclarativeItem *parent = 0);
59 virtual void componentComplete();
61 int deviceCount() const;
62 Q_INVOKABLE QString deviceName(int index) const;
63 Q_INVOKABLE QVariant deviceId(int index) const;
65 void setDeviceId(const QVariant& id);
66 QVariant deviceId() const;
68 void setMode(const CameraMode& mode);
71 QtCamDevice *device() const;
73 Q_INVOKABLE bool start();
74 Q_INVOKABLE bool stop();
79 QString imageSuffix() const;
80 QString videoSuffix() const;
82 Notifications *notifications() const;
83 void setNotifications(Notifications *notifications);
86 void deviceCountChanged();
87 void deviceIdChanged();
90 void idleStateChanged();
91 void runningStateChanged();
92 void error(const QString& message, int code, const QString& debug);
93 void notificationsChanged();
96 void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
104 QtCamGraphicsViewfinder *m_vf;
106 NotificationsContainer *m_notifications;
109 #endif /* CAMERA_H */