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: Base class for pre-capture views* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef CAMPRECAPTUREVIEWBASE_H |
|
19 #define CAMPRECAPTUREVIEWBASE_H |
|
20 |
|
21 #include <akntoolbarobserver.h> |
|
22 |
|
23 #include "CamCaptureSetupViewBase.h" |
|
24 |
|
25 #include "CamControllerObservers.h" |
|
26 #include "CamAppController.h" |
|
27 |
|
28 // FORWARD DECLARATION |
|
29 class CCamCaptureSetupMenu; |
|
30 class CCamStandbyContainer; |
|
31 class MAknsSkinInstance; |
|
32 class TAknsItemID; |
|
33 class CAknButton; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * Base class for precapture views |
|
39 * |
|
40 * @since 2.8 |
|
41 */ |
|
42 class CCamPreCaptureViewBase : public CCamCaptureSetupViewBase, |
|
43 public MCamControllerObserver, |
|
44 public MAknToolbarObserver |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 * @since 2.8 |
|
51 */ |
|
52 virtual ~CCamPreCaptureViewBase(); |
|
53 |
|
54 public: // Functions from base classes |
|
55 |
|
56 /** |
|
57 * From CAknView Handle commands |
|
58 * @since 2.8 |
|
59 * @param aCommand command to be handled |
|
60 */ |
|
61 void HandleCommandL( TInt aCommand ); |
|
62 |
|
63 /** |
|
64 * From CAknView Handles the foreground/background event |
|
65 * @since 2.8 |
|
66 * @param aForeground ETrue if this view is on foreground, else EFalse. |
|
67 */ |
|
68 void HandleForegroundEventL( TBool aForeground ); |
|
69 |
|
70 /** |
|
71 * From MCamControllerObserver |
|
72 * @since 2.8 |
|
73 * @param aEvent The enumerated code for the event received |
|
74 * @param aError The error code associated with the event |
|
75 */ |
|
76 void HandleControllerEventL( TCamControllerEvent aEvent, |
|
77 TInt aError ); |
|
78 |
|
79 /** |
|
80 * From CAknView. |
|
81 * @since 2.8 |
|
82 * @param aPreViewId the ID for previous view we are switching from |
|
83 * @param aCustomMessageId the Uid for message passed to this view |
|
84 * @param aCustomMessage descriptor containing data content for view specific message |
|
85 */ |
|
86 void DoActivateL( const TVwsViewId& aPreViewId, TUid aCustomMessageId, |
|
87 const TDesC8& aCustomMessage ); |
|
88 /** |
|
89 * From CAknView. |
|
90 * @since 2.8 |
|
91 */ |
|
92 void DoDeactivate(); |
|
93 |
|
94 /** |
|
95 * From CCamViewBase |
|
96 * Handle change of focus to another application |
|
97 * This only handles another application coming to the foreground when |
|
98 * the camera application is already in the background behind an eikon |
|
99 * server window |
|
100 * @since 2.8 |
|
101 */ |
|
102 void HandleFocusLossL(); |
|
103 |
|
104 /** |
|
105 * From CCamCaptureSetupViewBase |
|
106 * Revert to normal mode |
|
107 * @since 2.8 |
|
108 */ |
|
109 virtual void ExitAllModesL(); |
|
110 |
|
111 public: // New functions |
|
112 |
|
113 /** |
|
114 * From CCamCaptureSetupViewBase |
|
115 * Return the active setting mode |
|
116 * @since 2.8 |
|
117 * @return the active setting mode |
|
118 */ |
|
119 TCamSettingMode ActiveSettingMode(); |
|
120 |
|
121 /** |
|
122 * AppUi calls this to notify views of focusgained and focuslost |
|
123 * events. |
|
124 */ |
|
125 void HandleAppEvent( const TCamAppEvent& aEvent ); |
|
126 |
|
127 /** |
|
128 * Sets a flag to true to indicate that access point dialog is shown and |
|
129 * viewfinder needs to be restarted. |
|
130 */ |
|
131 void SetLocationTrailConnecting(); |
|
132 |
|
133 /** |
|
134 * AppUi calls this to indicate if postcapture view will be visible |
|
135 * in near future. |
|
136 */ |
|
137 void SetPostCaptureViewAsumption( TBool aAssumePostCaptureView ); |
|
138 |
|
139 /** |
|
140 * Try to start the capture with MSK command. |
|
141 * @since 9.1 |
|
142 * @return ETrue if started. |
|
143 */ |
|
144 virtual TBool StartMskCaptureL() = 0; |
|
145 |
|
146 protected: // Functions from base classes |
|
147 |
|
148 /** |
|
149 * From CCamPreCaptureViewBase |
|
150 * Set the menu bar resource. |
|
151 */ |
|
152 virtual void SetMenuBar() = 0; |
|
153 |
|
154 /** |
|
155 * From CCamCaptureSetupViewBase |
|
156 * Switches the current mode to capture setup and activates a |
|
157 * specific control. |
|
158 * @since 2.8 |
|
159 * @param aSetupCommand that specifies which setup control type to activate. |
|
160 */ |
|
161 void SwitchToCaptureSetupModeL( TInt aSetupCommand ); |
|
162 |
|
163 /** |
|
164 * From CCamCaptureSetupViewBase |
|
165 * Switches the current mode to scene setting and activates a |
|
166 * specific control. |
|
167 * @since 2.8 |
|
168 */ |
|
169 void SwitchToSceneSettingModeL(); |
|
170 |
|
171 /** |
|
172 * From CCamCaptureSetupViewBase |
|
173 * Exits capture setup mode and activates the capture setup menu control. |
|
174 * @since 2.8 |
|
175 */ |
|
176 void ExitCaptureSetupModeL(); |
|
177 |
|
178 /** |
|
179 * From CCamCaptureSetupViewBase |
|
180 * Exits scene setting mode and activates the capture setup menu control. |
|
181 * @since 2.8 |
|
182 */ |
|
183 void ExitSceneSettingModeL(); |
|
184 |
|
185 /** |
|
186 * From CCamCaptureSetupViewBase |
|
187 * Exits scene setting mode and activates the capture setup menu control. |
|
188 * @since 2.8 |
|
189 */ |
|
190 void ExitInfoListBoxL(); |
|
191 |
|
192 /** |
|
193 * Returns whether the view is a precapture view or not |
|
194 * @since 3.0 |
|
195 * @returns ETrue |
|
196 */ |
|
197 virtual TBool IsPreCapture(); |
|
198 |
|
199 /** |
|
200 * Update fixed toolbar icons according to current settings |
|
201 * @since S60 5.0 |
|
202 */ |
|
203 virtual void UpdateToolbarIconsL() = 0; |
|
204 /** |
|
205 * Redraws the toolbar and toolbarextension if visible |
|
206 * @since S60 5.1 |
|
207 */ |
|
208 virtual void RedrawToolBar(); |
|
209 |
|
210 /** |
|
211 * Returns the toolbar button by id from either the toolbar or toolbar extension |
|
212 * @param aCommandId CommandId correpsonding to the button |
|
213 * @returns the button or NULL |
|
214 * @since S60 5.1 |
|
215 */ |
|
216 CAknButton* ToolbarButtonById(const TCamCmd aCommandId) const; |
|
217 |
|
218 public: |
|
219 |
|
220 /** |
|
221 * Hides a toolbar/extension icon |
|
222 * @param aCommandId CommandId correpsonding to the button |
|
223 * @returns void |
|
224 * @since S60 5.1 |
|
225 */ |
|
226 virtual void HideButton(const TCamCmd aCommandId); |
|
227 |
|
228 protected: // New functions |
|
229 |
|
230 /** |
|
231 * C++ default constructor. |
|
232 * @param aController Reference to either the application controller |
|
233 * base class or test base class |
|
234 * @since 2.8 |
|
235 */ |
|
236 CCamPreCaptureViewBase( CCamAppController& aController ); |
|
237 |
|
238 /** |
|
239 * Symbian 2nd phase constructor. |
|
240 * @since 2.8 |
|
241 */ |
|
242 void ConstructL(); |
|
243 |
|
244 /** |
|
245 * Enter Viewfinder mode |
|
246 * @since 2.8 |
|
247 */ |
|
248 virtual void StartViewFinder() = 0; |
|
249 |
|
250 /** |
|
251 * Exit Viewfinder mode |
|
252 * @since 2.8 |
|
253 */ |
|
254 virtual void StopViewFinder() = 0; |
|
255 |
|
256 /** |
|
257 * Switch from current mode to standby mode |
|
258 * @since 2.8 |
|
259 * @param aViewId the current view id |
|
260 * @param aError associated error code |
|
261 */ |
|
262 void SwitchToStandbyModeL( TCamAppViewIds aViewId, TInt aError ); |
|
263 |
|
264 /** |
|
265 * Exit standby mode and return to previous capture mode |
|
266 * @since 2.8 |
|
267 */ |
|
268 void ExitStandbyModeL(); |
|
269 |
|
270 #if 0 |
|
271 /** |
|
272 * Check whether the ok options menu can be displayed |
|
273 * @since 2.8 |
|
274 * @return ETrue if the menu can be displayed, else EFalse |
|
275 */ |
|
276 TBool IsOkOptionsMenuAllowed(); |
|
277 #endif // 0 |
|
278 |
|
279 /** |
|
280 * Stop the viewfinder and inform the controller that the engine is |
|
281 * no longer required by this view |
|
282 * @since 2.8 |
|
283 */ |
|
284 void ReleaseResources(); |
|
285 |
|
286 /** |
|
287 * Switches the current mode to capture setup menu and activates |
|
288 * the capture setup menu control. |
|
289 * @since 2.8 |
|
290 */ |
|
291 void SwitchToCaptureSetupMenuModeL(); |
|
292 |
|
293 /** |
|
294 * Exits capture setup menu mode and activates the original precapture |
|
295 * view container that was active before entering this mode. |
|
296 * @since 2.8 |
|
297 */ |
|
298 void ExitCaptureSetupMenuModeL(); |
|
299 |
|
300 /** |
|
301 * Creates a capture setup menu. Derived classes should create |
|
302 * either a video or photo menu, depending on the class type. |
|
303 * @since 2.8 |
|
304 */ |
|
305 virtual void CreateCaptureSetupMenuL() = 0; |
|
306 |
|
307 /** |
|
308 * Removes the capture setup menu and original container from |
|
309 * the container stack. |
|
310 * @since 2.8 |
|
311 */ |
|
312 void RemoveCaptureSetupMenuContainers(); |
|
313 |
|
314 /** |
|
315 * Set the icon of a toolbar button |
|
316 * @since S60 5.0 |
|
317 * @param aButton The button whose icon is to be changed. |
|
318 * @param aIconFilename Full path to the MBM/MIF file |
|
319 * @param aIconId Icon ID in MBM/MIF file |
|
320 * @param aMaskId Mask ID in MBM/MIF file |
|
321 * @param aSkinInstance Current skin instance |
|
322 * @param aSkinItemId Skin ID for the button graphic |
|
323 * |
|
324 */ |
|
325 void SetIconL( |
|
326 CAknButton* aButton, |
|
327 const TDesC& aIconFilename, |
|
328 TInt aIconId, |
|
329 TInt aMaskId, |
|
330 MAknsSkinInstance* aSkinInstance, |
|
331 const TAknsItemID& aSkinItemId ); |
|
332 |
|
333 /** |
|
334 * Initialise the switch camera menu item, used from |
|
335 * DynInitMenuPaneL() |
|
336 * @since 3.0 |
|
337 * @param aMenuPane The menu pane to initialise |
|
338 */ |
|
339 void DynInitSwitchCameraMenuItemL( CEikMenuPane* aMenuPane ); |
|
340 |
|
341 // from base class MAknToolbarObserver |
|
342 |
|
343 void OfferToolbarEventL( TInt aCommand ); |
|
344 |
|
345 private: // new functions |
|
346 |
|
347 /** |
|
348 * Cleans up the capture setup menu if a leave occurs |
|
349 * while switching to capture setup menu mode |
|
350 * @param aAny pointer to the object to cleanup |
|
351 * @since 2.8 |
|
352 */ |
|
353 static void CleanupCaptureSetupMenu( TAny* aAny ); |
|
354 |
|
355 /** |
|
356 * Helper method to setup the Active Palette. |
|
357 * If needed, the AP is created. |
|
358 * For existing AP, the items are first cleared. |
|
359 * New items are set with resource from GetAPResourceId. |
|
360 */ |
|
361 void SetupActivePaletteL(); |
|
362 |
|
363 protected: // data |
|
364 |
|
365 // An extra container that the view uses when in capture setup menu mode. |
|
366 CCamCaptureSetupMenu* iCaptureSetupMenuContainer; |
|
367 |
|
368 // Used to determine when the view is in capture setup mode |
|
369 TBool iCaptureSetupMenuModeActive; |
|
370 |
|
371 // Used to determine which capture setup menu item to select |
|
372 // when a capture setup control is exited. |
|
373 TInt iCaptureSetupMenuLastItemIndex; |
|
374 |
|
375 |
|
376 // Indicates that the application has lost the foreground but has not |
|
377 // released the resources |
|
378 TBool iContinueInBackground; |
|
379 |
|
380 // Indicates if the view was told to initiate standby mode from |
|
381 // activation |
|
382 TBool iActivateToStandby; |
|
383 |
|
384 // Indicates if the view was told to exit to standby mode from |
|
385 // the current mode |
|
386 TBool iDeactivateToStandby; |
|
387 |
|
388 // Indicates if toolbar extension should be invisible when returning |
|
389 // precapture view |
|
390 TBool iToolbarExtensionInvisible; |
|
391 |
|
392 // Asumption that next view is postcaptureview. If true don't start |
|
393 // viewfinder if coming to foreground from background. |
|
394 TBool iAssumePostCaptureView; |
|
395 |
|
396 TBool iLocationTrailConnecting; |
|
397 |
|
398 }; |
|
399 |
|
400 #endif // CAMPRECAPTUREVIEWBASE_H |
|
401 |
|
402 // End of File |
|