1 /* |
|
2 * Copyright (c) 2007 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: Base class for all camera views* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef CAMVIEWBASE_H |
|
19 #define CAMVIEWBASE_H |
|
20 |
|
21 // =========================================================================== |
|
22 // INCLUDES |
|
23 |
|
24 #include "CamAppUiBase.h" |
|
25 #include "CamCommandHandlerAo.h" |
|
26 #include <aknview.h> |
|
27 |
|
28 // =========================================================================== |
|
29 // FORWARD DECLARATIONS |
|
30 class CCamAppController; |
|
31 class CCamContainerBase; |
|
32 class CCamStandbyContainer; |
|
33 class CCamWaitDialog; |
|
34 |
|
35 |
|
36 // =========================================================================== |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Base class for all camera views |
|
41 * |
|
42 * @since 2.8 |
|
43 */ |
|
44 class CCamViewBase : public CAknView |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 * @since 2.8 |
|
51 */ |
|
52 virtual ~CCamViewBase(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 virtual void HandleAppEvent( const TCamAppEvent& aEvent ); |
|
57 |
|
58 /** |
|
59 * Update the softkeys for the current situation. |
|
60 * @since 2.8 |
|
61 */ |
|
62 virtual void UpdateCbaL(); |
|
63 |
|
64 /** |
|
65 * Blank the softkeys on the cba |
|
66 * @since 3.0 |
|
67 */ |
|
68 virtual void BlankSoftkeysL(); |
|
69 |
|
70 /** |
|
71 * Switch from current mode to standby mode |
|
72 * @since 2.8 |
|
73 * @param aViewId the current view id |
|
74 * @param aError associated error code |
|
75 */ |
|
76 virtual void SwitchToStandbyModeL( TCamAppViewIds aViewId, TInt aError ); |
|
77 |
|
78 /** |
|
79 * Exit standby mode |
|
80 * @since 2.8 |
|
81 */ |
|
82 void ExitStandbyModeL(); |
|
83 |
|
84 /** |
|
85 * Exit all modes. |
|
86 * Has empty default implementation which can be overriden |
|
87 * if needed in inherited classes. Atleast user scene setup view does this. |
|
88 * Called e.g. when entering standby mode to be able to enter normal |
|
89 * VF mode again when exiting standby. |
|
90 */ |
|
91 virtual void ExitAllModesL(); |
|
92 |
|
93 /** |
|
94 * Handle change of focus to another application |
|
95 * This only handles another application coming to the foreground when |
|
96 * the camera application is already in the background behind an eikon |
|
97 * server window |
|
98 * @since 2.8 |
|
99 */ |
|
100 virtual void HandleFocusLossL(); |
|
101 |
|
102 /** |
|
103 * Handle change of mode |
|
104 * @since 3.0 |
|
105 */ |
|
106 virtual void PrepareForModeChange(); |
|
107 |
|
108 /** |
|
109 * Called to identify the help context for this view |
|
110 * @since 2.8 |
|
111 * @param aContext Help context object to populate with control context |
|
112 * information |
|
113 */ |
|
114 virtual void GetHelpContext(TCoeHelpContext& aContext) const; |
|
115 |
|
116 /** |
|
117 * Returns the currently used container for this view |
|
118 * @since 2.8 |
|
119 * @return The currently used container |
|
120 * information |
|
121 */ |
|
122 CCamContainerBase* Container(); |
|
123 |
|
124 /** |
|
125 * Sets the softkeys to the specified Resource ID |
|
126 * @since 3.0 |
|
127 * @param aResource ID of the softkey resource to use |
|
128 */ |
|
129 virtual void SetSoftKeysL(TInt aResource); |
|
130 |
|
131 /** |
|
132 * Blanks the softkeys for the Courtesy UI Off state. |
|
133 * @since 3.0 |
|
134 */ |
|
135 void SetCourtesySoftKeysL(); |
|
136 |
|
137 /** |
|
138 * Returns the softkeys to their previous state after UI has been turned back on |
|
139 * @since 3.0 |
|
140 */ |
|
141 void UnsetCourtesySoftKeysL(); |
|
142 |
|
143 /** |
|
144 * Returns whether the view is in standby mode |
|
145 * @return Whether the view is in standby mode |
|
146 */ |
|
147 TBool IsInStandbyMode(); |
|
148 |
|
149 /** |
|
150 * Requests that the camera application redraws the supplied active palette area |
|
151 * @since 3.0 |
|
152 * @param aArea the area to redraw |
|
153 */ |
|
154 void RedrawAPArea(const TRect& aArea); |
|
155 |
|
156 |
|
157 /** |
|
158 * Return a pointer to view specific CBA (or applications CBA if |
|
159 * there is no view specific CBA defined). |
|
160 * @since S60 v5.0 |
|
161 * @return Pointer to CEikButtonGroupContainer. Ownership not |
|
162 * transferred |
|
163 */ |
|
164 CEikButtonGroupContainer* ViewCba(); |
|
165 |
|
166 /** |
|
167 * Updates toolbar icons. |
|
168 * |
|
169 */ |
|
170 virtual void UpdateToolbarIconsL(); |
|
171 |
|
172 /** |
|
173 * Sets the standby to the current error if the current state is in standby; else does nothing |
|
174 * @since 5.1 |
|
175 * @aError System wide error code |
|
176 */ |
|
177 virtual void SetStandbyStatusL( TInt aError ); |
|
178 |
|
179 public: // Functions from base classes |
|
180 |
|
181 /** |
|
182 * From CAknView Handle commands |
|
183 * @since 2.8 |
|
184 * @param aCommand command to be handled |
|
185 */ |
|
186 void HandleCommandL( TInt aCommand ); |
|
187 |
|
188 /** |
|
189 * From CAknView Handles the foreground/background event |
|
190 * @since 2.8 |
|
191 * @param aForeground ETrue if this view is on foreground, else EFalse. |
|
192 */ |
|
193 void HandleForegroundEventL( TBool aForeground ); |
|
194 |
|
195 /** |
|
196 * Active object for handling toolbar commands |
|
197 * @since S60 v.5.0 |
|
198 */ |
|
199 void HandleCommandAoL( TInt aCommand ); |
|
200 |
|
201 protected: // Functions from base classes |
|
202 |
|
203 /** |
|
204 * From CAknView. |
|
205 * @since 2.8 |
|
206 * @param aPostvViewId the ID for previous view we are switching from |
|
207 * @param aCustomMessageId the Uid for message passed to this view |
|
208 * @param aCustomMessage descriptor containing data content for view specific message |
|
209 */ |
|
210 void DoActivateL( const TVwsViewId& aPostvViewId, TUid aCustomMessageId, |
|
211 const TDesC8& aCustomMessage ); |
|
212 |
|
213 /** |
|
214 * From CAknView. |
|
215 * @since 2.8 |
|
216 */ |
|
217 void DoDeactivate(); |
|
218 |
|
219 /** |
|
220 * Prepare deactivation of this view. |
|
221 * Method stores current visible containers to temporary containers. |
|
222 */ |
|
223 void PrepareDeactivate(); |
|
224 |
|
225 /** |
|
226 * Completes deactivation of this view. |
|
227 * Method method deletes stored temporary containers. |
|
228 */ |
|
229 void PostDeactivate(); |
|
230 |
|
231 protected: // New functions |
|
232 |
|
233 /** |
|
234 * C++ default constructor. |
|
235 * @since 2.8 |
|
236 * @param aController Reference to either the application controller base class or test base class |
|
237 */ |
|
238 CCamViewBase( CCamAppController& aController ); |
|
239 |
|
240 /** |
|
241 * Create the container associated with this view. |
|
242 * @since 2.8 |
|
243 */ |
|
244 virtual void CreateContainerL() = 0; |
|
245 |
|
246 /** |
|
247 * Set the view's title text |
|
248 * @since 2.8 |
|
249 */ |
|
250 virtual void SetTitlePaneTextL() = 0; |
|
251 |
|
252 /** |
|
253 * Show rename query and rename file. |
|
254 * Switch orientation if required. Calls DoQueryRenameL() |
|
255 * @since 2.8 |
|
256 * @param aMode The current mode. |
|
257 */ |
|
258 void QueryRenameL( TCamCameraMode aMode ); |
|
259 |
|
260 /** |
|
261 * Show rename query and rename file. |
|
262 * @since 2.8 |
|
263 * @param aMode The current mode. |
|
264 */ |
|
265 void DoQueryRenameL( TCamCameraMode aMode ); |
|
266 |
|
267 /** |
|
268 * Show an overwrite confirmation query. This is used |
|
269 * when trying to overwrite a file using rename. |
|
270 * @since 2.8 |
|
271 * @param aFilename The name of the file that trying to overwrite. |
|
272 * @return ETrue if the user has confirmed the overwrite. |
|
273 */ |
|
274 TBool ShowOverwriteConfirmationQueryL( |
|
275 const TDesC& aFilename ); |
|
276 |
|
277 /** |
|
278 * Show rename query. |
|
279 * @since 2.8 |
|
280 * @param aFilename The current name of the file that renaming. |
|
281 * @param aMode The current capture mode. |
|
282 * @return ETrue if the user has entered a name. Or EFalse, if |
|
283 * user has cancelled the rename. |
|
284 */ |
|
285 TBool ShowRenameQueryL( TDes& aFilename, TCamCameraMode aMode ); |
|
286 |
|
287 /** |
|
288 * Check if renaming to the given name is valid. |
|
289 * @since 2.8 |
|
290 * @param aFilename The new name to check. |
|
291 * @return ETrue if the name is valid. |
|
292 */ |
|
293 virtual TBool IsNewNameValidL( const TDesC& aFilename ); |
|
294 |
|
295 /** |
|
296 * Renames the current capture array file. |
|
297 * @since 2.8 |
|
298 * @param aNewName The new name for the current file. |
|
299 * @param aMode The current capture mode. |
|
300 * @return ETrue if the name has been renamed succesfully. |
|
301 */ |
|
302 TBool RenameCurrentFileL( const TDesC& aNewName, TCamCameraMode aMode ); |
|
303 |
|
304 /** |
|
305 * Returns whether the view is a precapture view or not |
|
306 * @since 3.0 |
|
307 * @returns ETrue if view is precapture |
|
308 */ |
|
309 virtual TBool IsPreCapture(); |
|
310 |
|
311 /** |
|
312 * Increment the camera user count. |
|
313 * This method ensures that view only increments the counter by one. |
|
314 */ |
|
315 void IncrementCameraUsers(); |
|
316 |
|
317 /** |
|
318 * Decrement the camera user count. |
|
319 * If count goes to zero, camera is released. |
|
320 * This method ensures, that decrement call is only forwarded to |
|
321 * controller, if this view has earlier incremented the count. |
|
322 */ |
|
323 void DecrementCameraUsers(); |
|
324 |
|
325 /** |
|
326 * Is this view using camera, i.e. has IncrementCameraUsers been called, |
|
327 * but DecrementCameraUsers not. |
|
328 */ |
|
329 TBool IsCameraUser() const; |
|
330 |
|
331 public: |
|
332 /** |
|
333 * Returns whether the view is a postcapture view or not |
|
334 * @since 3.0 |
|
335 * @returns ETrue if view is postcapture |
|
336 */ |
|
337 virtual TBool IsPostCapture(); |
|
338 private: |
|
339 |
|
340 /** |
|
341 * Returns whether the view is a burst capture postcapture view or not |
|
342 * @since 3.0 |
|
343 * @returns ETrue if view is burst post capture postcapture |
|
344 */ |
|
345 virtual TBool IsBurstPostCapture(); |
|
346 |
|
347 /** |
|
348 * Sets the iStandbyModeActive flag |
|
349 * @param aActive What to set iStandbyModeActive to |
|
350 */ |
|
351 void SetStandbyModeActive(TBool aActive); |
|
352 |
|
353 protected: // Data |
|
354 |
|
355 // Base class for Camera application controller |
|
356 CCamAppController& iController; |
|
357 |
|
358 // The container for the view's controls |
|
359 CCamContainerBase* iContainer; // owned |
|
360 |
|
361 // Specifies whether the application is embedded or not. |
|
362 TBool iEmbedded; |
|
363 |
|
364 // Resource Id for the view menu bar |
|
365 TInt iPreviousMenuResourceId; |
|
366 |
|
367 // set to ETrue when in standby mode |
|
368 TBool iStandbyModeActive; |
|
369 |
|
370 // error code associated with standby mode |
|
371 //TInt iStandbyError; |
|
372 |
|
373 // standby mode container |
|
374 CCamStandbyContainer* iStandbyContainer; |
|
375 |
|
376 //Used for viewswitching |
|
377 CCamContainerBase* iTempContainer; |
|
378 CCamStandbyContainer* iTempStandbyContainer; |
|
379 |
|
380 private: // data |
|
381 |
|
382 // whether or not the view registered an interest in resources |
|
383 // when it came to the foreground |
|
384 TBool iIncEngineCount; |
|
385 |
|
386 |
|
387 // Stores the current and previous resources used for setting the CBA |
|
388 // Allows one level of "undo", currently used by the courtesy UI. |
|
389 TInt iCurrentCbaResource; |
|
390 TInt iPreviousCbaResource; |
|
391 TBool iCourtesySoftkeys; |
|
392 |
|
393 // own. |
|
394 CCamCommandHandlerAo* iCommandHandlerAo; |
|
395 |
|
396 }; |
|
397 |
|
398 #endif // CAMVIEWBASE_H |
|
399 |
|
400 // =========================================================================== |
|
401 // End of File |
|