|
1 /* |
|
2 * Copyright (c) 2007-2008 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: A class that represents a set of capture items |
|
15 * |
|
16 * Copyright © 2007-2008 Nokia. All rights reserved. |
|
17 * This material, including documentation and any related computer |
|
18 * programs, is protected by copyright controlled by Nokia. All |
|
19 * rights are reserved. Copying, including reproducing, storing, |
|
20 * adapting or translating, any or all of this material requires the |
|
21 * prior written consent of Nokia. This material also contains |
|
22 * confidential information which may not be disclosed to others |
|
23 * without the prior written consent of Nokia. |
|
24 |
|
25 * |
|
26 * |
|
27 */ |
|
28 |
|
29 |
|
30 #ifndef CAMBURSTCAPTUREARRAY_H |
|
31 #define CAMBURSTCAPTUREARRAY_H |
|
32 |
|
33 // INCLUDES |
|
34 |
|
35 #include <e32base.h> |
|
36 |
|
37 // CONSTANTS |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CFbsBitmap; |
|
41 class CCamImageSaveActive; |
|
42 |
|
43 /** |
|
44 * A capture burst array, maintains a set of CCamBurstCaptureItem objects |
|
45 */ |
|
46 class CCamBurstCaptureArray : public CBase |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * @since 2.8 |
|
53 * @param aImageSaveActive class that manages image saving, |
|
54 * informed if a save request was previously made |
|
55 * for a file now being marked for deletion. |
|
56 * @return pointer to the created CCamBurstCaptureArray object |
|
57 */ |
|
58 static CCamBurstCaptureArray* NewL( CCamImageSaveActive& aImageSaveActive ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 * @since 2.8 |
|
63 */ |
|
64 ~CCamBurstCaptureArray(); |
|
65 |
|
66 public: // New methods |
|
67 |
|
68 /** |
|
69 * Sets an item's full file path and image name |
|
70 * @since 2.8 |
|
71 * @param aFullFileName the full file path and image name for the item |
|
72 * @param aImageName the name of the image displayed in the UI |
|
73 * @param aIndex the index of the item to name. |
|
74 */ |
|
75 void SetNameL( const TDesC& aFullFileName, const TDesC& aImageName, |
|
76 TInt aIndex ); |
|
77 |
|
78 /** |
|
79 * Returns whether a particular file has already been saved. |
|
80 * @since 2.8 |
|
81 * @param aFilename the name of the file to check. |
|
82 * @return ETrue if the file has been saved. |
|
83 */ |
|
84 TBool AlreadySavedFile( const TDesC& aFilename ); |
|
85 |
|
86 /** |
|
87 * Returns whether a particular file is in the process of being saved. |
|
88 * @since 2.8 |
|
89 * @param aFilename the name of the file to check. |
|
90 * @return ETrue if the file is in the process of being saved. |
|
91 */ |
|
92 TBool CurrentlySavingFile( const TDesC& aFilename ); |
|
93 |
|
94 /** |
|
95 * Returns the number of items in the array |
|
96 * @since 2.8 |
|
97 * @return count of items in the array |
|
98 */ |
|
99 TInt Count() const; |
|
100 |
|
101 /** |
|
102 * Returns the number of un-deleted items in the array |
|
103 * @since 2.8 |
|
104 * @return count of items in the array that are not marked for deletion |
|
105 */ |
|
106 inline TInt ImagesRemaining() const; |
|
107 |
|
108 /** |
|
109 * Delete unwanted items from the array, releasing memory |
|
110 * @since 2.8 |
|
111 * @param aRequiredCount the number of items required |
|
112 */ |
|
113 void Reset( TInt aRequiredCount = 0 ); |
|
114 |
|
115 /** |
|
116 * Sets the item's full file path and image name |
|
117 * @since 2.8 |
|
118 * @param aFullFileName the full file path and image name for the item |
|
119 * @param aImageName the name of the image displayed in the UI |
|
120 */ |
|
121 void SetNextNameL( const TDesC& aFullFileName, const TDesC& aImageName ); |
|
122 |
|
123 /** |
|
124 * Stores the snapshot bitmap in the item |
|
125 * @since 2.8 |
|
126 * @param aSnapshot the snapshot image returned by the camera engine |
|
127 */ |
|
128 void SetNextSnapshotL( const CFbsBitmap& aSnapshot ); |
|
129 |
|
130 /** |
|
131 * Sets the item's deletion state |
|
132 * @since 2.8 |
|
133 * @param aItemIndex Index of the item |
|
134 * @param aDeleted ETrue if the item has been selected for deletion |
|
135 * @return system wide error code or KErrNone |
|
136 */ |
|
137 TInt SetDeleted( TInt aItemIndex, TBool aDeleted ); |
|
138 |
|
139 /** |
|
140 * Skips the next image if marked for deletion |
|
141 * @since 2.8 |
|
142 * @return Whether or not the image was skipped |
|
143 */ |
|
144 TBool IsNextImageDeleted(); |
|
145 |
|
146 /** |
|
147 * Returns a pointer to the next full file path and name in the array |
|
148 * since the last one requested |
|
149 * @since 2.8 |
|
150 * @return Pointer to the filename |
|
151 */ |
|
152 const TDesC& NextFileName(); |
|
153 |
|
154 /** |
|
155 * Returns the index of the next full file path and name in the array |
|
156 * since the last one requested by NextFileName() |
|
157 * This can be used to determine any unsaved images |
|
158 * @since 2.8 |
|
159 * @return Index of the next filename |
|
160 */ |
|
161 TInt NextFileIndex() const; |
|
162 |
|
163 /** |
|
164 * Returns a pointer to the full file path and name |
|
165 * @since 2.8 |
|
166 * @param aItemIndex Index of the item |
|
167 * @return Pointer to the filename |
|
168 */ |
|
169 const TDesC& FileName( TInt aItemIndex ) const; |
|
170 |
|
171 /** |
|
172 * Returns a pointer to the image name |
|
173 * @since 2.8 |
|
174 * @param aItemIndex Index of the item |
|
175 * @return Pointer to the image name |
|
176 */ |
|
177 const TDesC& ImageName( TInt aItemIndex ) const; |
|
178 |
|
179 /** |
|
180 * Returns a pointer to the snapshot image |
|
181 * @since 2.8 |
|
182 * @param aItemIndex Index of the item |
|
183 * @return the snapshot image |
|
184 */ |
|
185 const CFbsBitmap* Snapshot( TInt aItemIndex ) const; |
|
186 |
|
187 /** |
|
188 * Indicates whether the item has been selected for deletion |
|
189 * @since 2.8 |
|
190 * @param aItemIndex Index of the item |
|
191 * @return the item's deletion state |
|
192 */ |
|
193 TBool IsDeleted( TInt aItemIndex ) const; |
|
194 |
|
195 /** |
|
196 * Replaces the bitmap in the given index. |
|
197 * @since 3.0 |
|
198 * @param aBitmap The new bitmap to replace current |
|
199 * @param aItemIndex Index of the replaced item |
|
200 * @return Success of the replacement |
|
201 */ |
|
202 TBool ReplaceSnapshot( const CFbsBitmap* aBitmap, TInt aItemIndex ); |
|
203 |
|
204 private: |
|
205 |
|
206 /** |
|
207 * A capture burst item, holds the full file path and name, the snapshot image and |
|
208 * indication of whether or not the item has been selected for deletion |
|
209 */ |
|
210 class CCamBurstCaptureItem : public CBase |
|
211 { |
|
212 public: |
|
213 |
|
214 /** |
|
215 * Two-phased constructor. |
|
216 * @since 2.8 |
|
217 * |
|
218 * @return pointer to the created CCamBurstCaptureItem object |
|
219 */ |
|
220 static CCamBurstCaptureItem* NewLC(); |
|
221 |
|
222 /** |
|
223 * Destructor. |
|
224 * @since 2.8 |
|
225 */ |
|
226 ~CCamBurstCaptureItem(); |
|
227 |
|
228 public: // New methods |
|
229 |
|
230 /** |
|
231 * Sets the item's full file path and image name |
|
232 * @since 2.8 |
|
233 * @param aFullFileName the full file path and image name for the item |
|
234 * @param aImageName the name of theimage displayed in the UI |
|
235 */ |
|
236 void SetNameL( const TDesC& aFullFileName, const TDesC& aImageName ); |
|
237 |
|
238 /** |
|
239 * Stores the snapshot bitmap in the item |
|
240 * @since 2.8 |
|
241 * @param aSnapshot the snapshot image returned by the camera engine |
|
242 */ |
|
243 void SetSnapshotL( const CFbsBitmap& aSnapshot ); |
|
244 |
|
245 /** |
|
246 * Sets the item's deletion state |
|
247 * @since 2.8 |
|
248 * @param aDeleted ETrue if the item has been selected for deletion |
|
249 */ |
|
250 void SetDeleted( TBool aDeleted ); |
|
251 |
|
252 /** |
|
253 * Returns a pointer to the full file path and name |
|
254 * @since 2.8 |
|
255 * @return Pointer to the filename |
|
256 */ |
|
257 const TDesC& FileName() const; |
|
258 |
|
259 /** |
|
260 * Returns a pointer to the image name |
|
261 * @since 2.8 |
|
262 * @return Pointer to the image name |
|
263 */ |
|
264 const TDesC& ImageName() const; |
|
265 |
|
266 /** |
|
267 * Returns a reference to the snapshot image |
|
268 * @since 2.8 |
|
269 * @return the snapshot image |
|
270 */ |
|
271 const CFbsBitmap* Snapshot() const; |
|
272 |
|
273 /** |
|
274 * Indicates whether the item has been selected for deletion |
|
275 * @since 2.8 |
|
276 * @return the item's deletion state |
|
277 */ |
|
278 TBool IsDeleted() const; |
|
279 |
|
280 /** |
|
281 * Replaces the bitmap. |
|
282 * @since 3.0 |
|
283 * @param aBitmap The new bitmap to replace current |
|
284 * @return Success of the replacement |
|
285 */ |
|
286 TBool ReplaceSnapshot( const CFbsBitmap* aBitmap ); |
|
287 |
|
288 private: |
|
289 |
|
290 /** |
|
291 * C++ default constructor. |
|
292 * @since 2.8 |
|
293 */ |
|
294 CCamBurstCaptureItem(); |
|
295 |
|
296 /** |
|
297 * Second phase construction |
|
298 */ |
|
299 void ConstructL(); |
|
300 |
|
301 private: |
|
302 // The full path and filename for the image |
|
303 HBufC* iFileName; |
|
304 // The image name |
|
305 HBufC* iImageName; |
|
306 // The snapshot image |
|
307 CFbsBitmap* iSnapshot; |
|
308 // The item's deletion state |
|
309 TBool iIsDeleted; |
|
310 }; |
|
311 |
|
312 private: |
|
313 |
|
314 /** |
|
315 * C++ default constructor. |
|
316 * @since 2.8 |
|
317 * @param aImageSaveActive class that manages image saving, |
|
318 * informed if a save request was previously made |
|
319 * for a file now being marked for deletion. |
|
320 */ |
|
321 CCamBurstCaptureArray( CCamImageSaveActive& aImageSaveActive ); |
|
322 |
|
323 /** |
|
324 * Second phase construction |
|
325 */ |
|
326 void ConstructL(); |
|
327 |
|
328 /** |
|
329 * Create a new item in the array if necessary |
|
330 * @since 2.8 |
|
331 * @param aRequiredIndex the expected index for an item |
|
332 */ |
|
333 void CheckArraySizeL( TInt aRequiredIndex ); |
|
334 |
|
335 private: |
|
336 |
|
337 // Array of items each representing an image in a burst capture |
|
338 RPointerArray<CCamBurstCaptureItem> iBurstItems; |
|
339 // Active object that manages file saving and deletion |
|
340 CCamImageSaveActive& iImageSaveActive; |
|
341 // Index used to manage storage of file names and image names |
|
342 TInt iNextSetName; |
|
343 // Index used to manage retrieval of file names |
|
344 TInt iNextGetName; |
|
345 // Index used to manage storage of snapshot images |
|
346 TInt iNextSnapshot; |
|
347 // Counter for the number of undeleted items |
|
348 TInt iImagesRemaining; |
|
349 }; |
|
350 |
|
351 #include "CamBurstCaptureArray.inl" |
|
352 |
|
353 |
|
354 #endif // CAMBURSTCAPTUREARRAY_H |
|
355 |
|
356 // End of File |