|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef CXESTILLCAPTURECONTROL_H |
|
18 #define CXESTILLCAPTURECONTROL_H |
|
19 |
|
20 #include <QObject> |
|
21 #include <QMetaType> |
|
22 #include <QPixmap> |
|
23 #include "cxeerror.h" |
|
24 #include "cxequalitydetails.h" |
|
25 |
|
26 class CxeStillImage; |
|
27 class CxeImageDataQueue; |
|
28 |
|
29 /** |
|
30 * Still capture control implements basic still image capture functionality. It |
|
31 * automatically plays back the capture sound when capturing images (or a |
|
32 * sequence of images) and it also provides snapshots of captured images. |
|
33 * Still capture control also automatically makes sure that the images are |
|
34 * saved in the file system in the background. |
|
35 * |
|
36 * The CxeStillImage is used to access information (snapshot image, filename) |
|
37 * about captured images. The still capture control owns an array of CxeStillImage |
|
38 * objects representing the images that were captured. The CxeStillCaptureControl::reset() |
|
39 * function should be used to clear any data about previously captured images and to initialize |
|
40 * the control for a new capture. |
|
41 * |
|
42 * The images will be saved to the file system by CxeImageDataQueue and CxeImageDataItem classes. |
|
43 * @sa CxeStillImage |
|
44 * @sa CxeImageDataQueue |
|
45 * @sa CxeImageDataItem |
|
46 */ |
|
47 class CxeStillCaptureControl : public QObject |
|
48 { |
|
49 Q_OBJECT |
|
50 public: |
|
51 /** |
|
52 * Image capture mode. |
|
53 */ |
|
54 enum CaptureMode |
|
55 { |
|
56 //! Single image mode |
|
57 SingleImageCapture, |
|
58 |
|
59 //! Burst capture mode. One capture operation captures images until |
|
60 //! stopped or the maximum amount of images is reached. |
|
61 BurstCapture |
|
62 }; |
|
63 |
|
64 //! Still capture control states |
|
65 enum State { |
|
66 //! Not prepared |
|
67 Uninitialized = 0x01, |
|
68 |
|
69 //! Prepared and ready to capture images |
|
70 Ready = 0x02, |
|
71 |
|
72 //! Capture operation is in progress |
|
73 Capturing = 0x04 |
|
74 }; |
|
75 |
|
76 /** |
|
77 * Start capturing images. |
|
78 */ |
|
79 virtual void capture() = 0; |
|
80 |
|
81 /** |
|
82 * Current state. |
|
83 */ |
|
84 virtual State state() const = 0; |
|
85 |
|
86 /** |
|
87 * Get the number of images captured. The actual images can be accessed |
|
88 * using the [] operator. |
|
89 * |
|
90 * @return Number of CxeStillImage object available |
|
91 */ |
|
92 virtual int imageCount() const = 0; |
|
93 |
|
94 /** |
|
95 * Clear the image array, destroy all CxeStillImage objects, including |
|
96 * snapshot images. Items in the file save queue remain and are saved in |
|
97 * the background. |
|
98 */ |
|
99 virtual void reset() = 0; |
|
100 |
|
101 /** |
|
102 * Clear the image array, destroy all CxeStillImage objects, including |
|
103 * snapshot images. File save queue is cleared as well and all unsaved |
|
104 * images will be lost. |
|
105 */ |
|
106 virtual void cancelAll() = 0; |
|
107 |
|
108 /** |
|
109 * Set current image capture mode. |
|
110 */ |
|
111 virtual void setMode(CaptureMode mode) = 0; |
|
112 |
|
113 /** |
|
114 * Get current image capture mode. |
|
115 */ |
|
116 virtual CaptureMode mode() const = 0; |
|
117 |
|
118 /** |
|
119 * Access images that were captured during this capture sequence. |
|
120 * |
|
121 * @param index Image index. Must be 0 <= index < imageCount. |
|
122 * @return Reference to corresponding CxeStillImage |
|
123 */ |
|
124 virtual CxeStillImage &operator[]( int index ) = 0; |
|
125 |
|
126 /** |
|
127 * File save queue |
|
128 */ |
|
129 virtual CxeImageDataQueue& imageDataQueue() = 0; |
|
130 |
|
131 /* |
|
132 * supported list of image qualities, sorted in descending order based on image resolution |
|
133 * i.e. the list has the highest resolution first and so on |
|
134 * Internally, we check if we are using Primary/Secondary camera and return the list based on it |
|
135 */ |
|
136 virtual QList<CxeImageDetails> supportedImageQualities() = 0; |
|
137 |
|
138 /* |
|
139 * Returns the number of images left for the current image quality setting |
|
140 */ |
|
141 virtual int imagesLeft() = 0; |
|
142 |
|
143 public slots: |
|
144 virtual void init() = 0; |
|
145 virtual void deinit() = 0; |
|
146 |
|
147 signals: |
|
148 void stateChanged(CxeStillCaptureControl::State newState, CxeError::Id error); |
|
149 |
|
150 /** |
|
151 * A signal indicating a snapshot image is available. |
|
152 * |
|
153 * @param error Status code for the snapshot. |
|
154 * CxeError::None if snapshot successfully received. |
|
155 * @param snapshot The snapshot image. |
|
156 * @param id Id of the image this snapshot is for. |
|
157 */ |
|
158 void snapshotReady(CxeError::Id error, const QImage &snapshot, int id); |
|
159 void imageCaptured(CxeError::Id error, int id); |
|
160 |
|
161 /** |
|
162 * Amount of images that can be captured has changed. |
|
163 */ |
|
164 void availableImagesChanged(); |
|
165 |
|
166 protected: |
|
167 CxeStillCaptureControl() {} // protected empty contructor so that derived class construction works |
|
168 |
|
169 private: |
|
170 Q_DISABLE_COPY( CxeStillCaptureControl ) |
|
171 }; |
|
172 |
|
173 Q_DECLARE_METATYPE(CxeStillCaptureControl::State) |
|
174 |
|
175 |
|
176 #endif // CXESTILLCAPTURECONTROL_H |