Updated copyright year
[harmattan/cameraplus] / lib / qtcammode.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef QT_CAM_MODE_H
24 #define QT_CAM_MODE_H
25
26 #include <QObject>
27 #include <QPair>
28
29 class QtCamModePrivate;
30 class QtCamDevicePrivate;
31 class QSize;
32 class QImage;
33 class QtCamDevice;
34
35 class QtCamMode : public QObject {
36   Q_OBJECT
37
38   Q_PROPERTY(bool canCapture READ canCapture NOTIFY canCaptureChanged);
39   Q_PROPERTY(bool active READ isActive NOTIFY activeChanged);
40
41 public:
42   QtCamMode(QtCamModePrivate *d, const char *mode, QObject *parent = 0);
43   virtual ~QtCamMode();
44
45   void deactivate();
46
47   virtual bool canCapture();
48
49   bool isActive();
50
51   virtual void applySettings() = 0;
52
53   QtCamDevice *device() const;
54
55 public slots:
56   void activate();
57
58 signals:
59   void previewAvailable(const QImage& image, const QString& fileName);
60   void saved(const QString& fileName);
61   void canCaptureChanged();
62   void activeChanged();
63
64 protected:
65   virtual void start() = 0;
66   virtual void stop() = 0;
67
68   QtCamModePrivate *d_ptr;
69 };
70
71 #endif /* QT_CAM_MODE_H */