|
1 /* |
|
2 * Copyright (c) 2007-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: Base class for pre capture views* |
|
15 */ |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <eikbtgpc.h> |
|
20 #include <eikmenub.h> |
|
21 #include <musresourceproperties.h> |
|
22 #include <cameraplatpskeys.h> |
|
23 #include <cameraapp.rsg> |
|
24 #include <vgacamsettings.rsg> |
|
25 #include <akntoolbar.h> |
|
26 #include <akntoolbarextension.h> |
|
27 #include <aknbutton.h> |
|
28 #include <eiksoftkeypostingtransparency.h> |
|
29 #include <AknsUtils.h> |
|
30 #include <gulicon.h> |
|
31 |
|
32 #include "Cam.hrh" |
|
33 #include "CamAppUi.h" |
|
34 #include "CamUtility.h" |
|
35 #include "CamAppController.h" |
|
36 #include "CamPreCaptureContainerBase.h" |
|
37 #include "CamLogger.h" |
|
38 #include "CamPanic.h" |
|
39 #include "CamCaptureSetupMenu.h" |
|
40 #include "CamStandbyContainer.h" |
|
41 #include "CamSelfTimer.h" |
|
42 #include "CamTimer.h" |
|
43 #include "camactivepalettehandler.h" |
|
44 #include "CamPreCaptureViewBase.h" |
|
45 #include "CameraUiConfigManager.h" |
|
46 #include "OstTraceDefinitions.h" |
|
47 #ifdef OST_TRACE_COMPILER_IN_USE |
|
48 #include "CamPreCaptureViewBaseTraces.h" |
|
49 #endif |
|
50 |
|
51 |
|
52 // =========================================================================== |
|
53 // Constants |
|
54 |
|
55 |
|
56 |
|
57 // ========================= MEMBER FUNCTIONS ================================ |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CCamPreCaptureViewBase destructor |
|
61 // |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CCamPreCaptureViewBase::~CCamPreCaptureViewBase() |
|
65 { |
|
66 PRINT( _L("Camera => ~CCamPreCaptureViewBase") ); |
|
67 PRINT( _L("Camera <= ~CCamPreCaptureViewBase") ); |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CCamPreCaptureViewBase::HandleCommandL |
|
72 // Handle commands |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void CCamPreCaptureViewBase::HandleCommandL( TInt aCommand ) |
|
76 { |
|
77 PRINT( _L("Camera => CCamPreCaptureViewBase::HandleCommandL") ); |
|
78 |
|
79 switch ( aCommand ) |
|
80 { |
|
81 case ECamCmdShootSetup: |
|
82 { |
|
83 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
84 TBool selfTimerEnabled = appUi->SelfTimerEnabled(); |
|
85 |
|
86 if ( selfTimerEnabled ) |
|
87 { |
|
88 CCamSelfTimer* selftimer = appUi->SelfTimer(); |
|
89 |
|
90 // If self-timer is enabled, we need to check that it is in |
|
91 // self-timer standby, ie Enabled but not Active (ie not |
|
92 // counting down) |
|
93 if ( selftimer && !selftimer->IsActive() ) |
|
94 { |
|
95 // In self-timer standby, pressing "select" button starts |
|
96 // self-timer count down. Pass this event on to AppUi. |
|
97 appUi->HandleCommandL( ECamCmdSelfTimerActivate ); |
|
98 } |
|
99 } |
|
100 else |
|
101 { |
|
102 // we are not in self -timer mode and check we are |
|
103 // not already in capture setup mode |
|
104 if ( !iCaptureSetupMenuModeActive ) |
|
105 { |
|
106 // Ensure first item is selected in CSM. |
|
107 iCaptureSetupMenuLastItemIndex = 0; |
|
108 SwitchToCaptureSetupMenuModeL(); |
|
109 } |
|
110 |
|
111 } |
|
112 } |
|
113 break; |
|
114 |
|
115 // If an item in the capture setup menu has been selected. |
|
116 case EAknSoftkeySelect: |
|
117 { |
|
118 if ( ActiveSettingMode() == ECamSettingModeCaptureMenu ) |
|
119 { |
|
120 iCaptureSetupMenuContainer->HandleCommandL( aCommand ); |
|
121 } |
|
122 else |
|
123 { |
|
124 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
125 } |
|
126 } |
|
127 break; |
|
128 |
|
129 // If capture setup menu is active and user presses softkey back, |
|
130 // deactivate the menu. This is EEikBidCancel which has the same |
|
131 // enumeration value as EAknSoftkeyCancel. |
|
132 case EAknSoftkeyCancel: |
|
133 { |
|
134 if ( ActiveSettingMode() == ECamSettingModeCaptureMenu ) |
|
135 { |
|
136 ExitCaptureSetupMenuModeL(); |
|
137 } |
|
138 else if ( iController.SequenceCaptureInProgress() ) |
|
139 // Check if currently capturing a burst, if so, cancel it |
|
140 { |
|
141 // If already received all the snapshots |
|
142 if ( iController.AllSnapshotsReceived() ) |
|
143 { |
|
144 // stop burst immediately |
|
145 iController.StopSequenceCaptureL(); |
|
146 } |
|
147 else |
|
148 { |
|
149 // capture the min images (2), before stopping the burst |
|
150 iController.SetKeyUp( ETrue ); |
|
151 iController.SoftStopBurstL( ETrue ); |
|
152 } |
|
153 // Update CBA for setup pane usage |
|
154 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK ); |
|
155 } |
|
156 else |
|
157 { |
|
158 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
159 } |
|
160 } |
|
161 break; |
|
162 case EAknSoftkeyOptions: |
|
163 { |
|
164 // do nothing, the command is handled by the framework |
|
165 } |
|
166 break; |
|
167 |
|
168 // Note: CaptureSetupMenu mode also uses a 'Back' softkey but this has |
|
169 // the command value EEikBidCancel |
|
170 case EAknSoftkeyBack: |
|
171 { |
|
172 // exit to embedded app if we're embedded and in plain pre-capture |
|
173 if ( iEmbedded |
|
174 && ActiveSettingMode() != ECamSettingModeScene |
|
175 && ActiveSettingMode() != ECamSettingModeInfoListBox ) |
|
176 { |
|
177 CCamCaptureSetupViewBase::HandleCommandL( ECamCmdInternalExit ); |
|
178 } |
|
179 else |
|
180 { |
|
181 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
182 } |
|
183 |
|
184 } |
|
185 break; |
|
186 |
|
187 case EAknSoftkeyOk: |
|
188 { |
|
189 // Else pass on to lower levels |
|
190 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
191 } |
|
192 break; |
|
193 |
|
194 case ECamCmdToggleCourtesyUI: |
|
195 { |
|
196 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
197 |
|
198 if ( appUi ) |
|
199 { |
|
200 appUi->SetAlwaysDrawPreCaptureCourtesyUI( !appUi->AlwaysDrawPreCaptureCourtesyUI() ); |
|
201 } |
|
202 } |
|
203 break; |
|
204 case ECamCmdPopUpMenuZoom: |
|
205 { |
|
206 iContainer->ShowZoomPaneWithTimer(); |
|
207 } |
|
208 break; |
|
209 case ECamCmdCaptureSetupFlashStill: |
|
210 { |
|
211 iToolbarExtensionInvisible = ETrue; |
|
212 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
213 } |
|
214 break; |
|
215 case ECamCmdInternalExit: |
|
216 { |
|
217 const TCamCaptureOperation operation( |
|
218 iController.CurrentOperation() ); |
|
219 |
|
220 if ( ECamPaused == operation ) |
|
221 { |
|
222 iController.StopVideoRecording(); |
|
223 iController.SetCaptureKeyPressedWhileImageSaving( ETrue ); |
|
224 } |
|
225 StopViewFinder(); |
|
226 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
227 if ( iController.IsTouchScreenSupported() ) |
|
228 { |
|
229 CAknToolbar* fixedToolbar = Toolbar(); |
|
230 if ( fixedToolbar ) |
|
231 { |
|
232 CAknToolbarExtension* extension = |
|
233 fixedToolbar->ToolbarExtension(); |
|
234 if ( extension ) |
|
235 { |
|
236 // Reset toolbar extension button and view to closed state |
|
237 extension->SetShown( EFalse ); |
|
238 extension->SetCurrentState( 0, EFalse ); |
|
239 } |
|
240 } |
|
241 } |
|
242 } |
|
243 break; |
|
244 default: |
|
245 { |
|
246 CCamCaptureSetupViewBase::HandleCommandL( aCommand ); |
|
247 } |
|
248 } |
|
249 PRINT( _L("Camera <= CCamPreCaptureViewBase::HandleCommandL") ); |
|
250 } |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CCamPreCaptureViewBase::HandleForegroundEventL |
|
254 // Handle a move to the foreground |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CCamPreCaptureViewBase::HandleForegroundEventL( TBool aForeground ) |
|
258 { |
|
259 PRINT1( _L( "Camera => CCamPreCaptureViewBase::HandleForegroundEventL %d" ), aForeground ); |
|
260 |
|
261 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
262 __ASSERT_DEBUG(appUi, CamPanic(ECamPanicNullPointer)); |
|
263 |
|
264 // ----------------------------------------------------- |
|
265 // coming to the foreground |
|
266 if ( aForeground ) |
|
267 { |
|
268 // Ignore foregrounding if view switch to postcapture anyway in progress. |
|
269 if( appUi->TargetViewState() == ECamViewStatePostCapture |
|
270 || appUi->TargetViewState() == ECamViewStateBurstThumbnail ) { |
|
271 PRINT( _L( "Camera <= CCamPreCaptureViewBase::HandleForegroundEventL, ignored as going to postcapture") ); |
|
272 return; |
|
273 } |
|
274 |
|
275 |
|
276 if ( !( iController.UiConfigManagerPtr() && |
|
277 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) ) |
|
278 { |
|
279 if ( !iController.IsTouchScreenSupported() ) |
|
280 { |
|
281 if ( !appUi->ActivePalette() ) |
|
282 { |
|
283 SetupActivePaletteL(); |
|
284 } |
|
285 else |
|
286 { |
|
287 appUi->APHandler()->UpdateActivePaletteL(); |
|
288 } |
|
289 } |
|
290 } |
|
291 UpdateCbaL(); |
|
292 |
|
293 // restart idle timer in any case |
|
294 iController.StartIdleTimer(); |
|
295 |
|
296 // If capture setup menu is active then ensure background is faded. |
|
297 if ( iCaptureSetupMenuContainer ) |
|
298 { |
|
299 iCaptureSetupMenuContainer->FadeBehind( ETrue ); |
|
300 } |
|
301 |
|
302 // coming to the foreground from an eikon server window |
|
303 if ( iContinueInBackground ) |
|
304 { |
|
305 iContinueInBackground = EFalse; |
|
306 |
|
307 if ( !iController.IsViewFinding() && !iSceneSettingModeActive ) |
|
308 { |
|
309 iController.StartViewFinder(); |
|
310 } |
|
311 else if( iLocationTrailConnecting ) |
|
312 { |
|
313 iLocationTrailConnecting = EFalse; |
|
314 iController.StopViewFinder(); |
|
315 iController.StartViewFinder(); |
|
316 } |
|
317 CCamCaptureSetupViewBase::HandleForegroundEventL( aForeground ); |
|
318 |
|
319 UpdateCbaL(); |
|
320 if ( iController.CameraSwitchQueued() ) |
|
321 { |
|
322 appUi->HandleCommandL( ECamCmdSwitchCamera ); |
|
323 } |
|
324 PRINT( _L( "Camera <= CCamPreCaptureViewBase::HandleForegroundEventL - continuing in background" ) ); |
|
325 return; |
|
326 } |
|
327 |
|
328 // This only happens when the app is first launched |
|
329 if ( !appUi->IsConstructionComplete() && |
|
330 !iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported()) |
|
331 { |
|
332 iActivateToStandby = ETrue; |
|
333 if ( !iStandbyModeActive ) |
|
334 { |
|
335 //iStandbyError = KErrNone; |
|
336 appUi->SetStandbyStatus( KErrNone ); |
|
337 PRINT( _L( "Camera <> CCamPreCaptureViewBase::HandleForegroundEventL: sending ECamCmdGoToStandby" ) ); |
|
338 HandleCommandL( ECamCmdGoToStandby ); |
|
339 SetTitlePaneTextL(); |
|
340 } |
|
341 } |
|
342 |
|
343 // Register that we want to use the engine |
|
344 IncrementCameraUsers(); |
|
345 |
|
346 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() ) |
|
347 { |
|
348 if ( iController.CameraSwitchQueued() ) |
|
349 { |
|
350 appUi->HandleCommandL( ECamCmdSwitchCamera ); |
|
351 } |
|
352 else if ( appUi->TargetViewState() != ECamViewStatePostCapture ) |
|
353 { |
|
354 TCamCameraMode mode = iController.CurrentMode(); |
|
355 if ( mode == ECamControllerVideo ) |
|
356 { |
|
357 iController.EnterViewfinderMode( ECamControllerVideo ); |
|
358 } |
|
359 else if( mode == ECamControllerImage && !iSceneSettingModeActive ) |
|
360 { |
|
361 iController.EnterViewfinderMode( ECamControllerImage ); |
|
362 } |
|
363 } |
|
364 UpdateCbaL(); |
|
365 } |
|
366 else |
|
367 { |
|
368 // Lens cover is not supported |
|
369 if ( iController.CameraSwitchQueued() ) |
|
370 { |
|
371 appUi->HandleCommandL( ECamCmdSwitchCamera ); |
|
372 } |
|
373 } |
|
374 |
|
375 |
|
376 // Start the viewfinder unless the view is activating into standby mode |
|
377 // in other modes than scene setting mode (there is no VF and this causes problems with DSA VF) |
|
378 if ( ( !iStandbyModeActive || !iActivateToStandby ) && !iSceneSettingModeActive ) |
|
379 { |
|
380 // If in embedded mode and image has been captured but view is not yet in |
|
381 // postcapture view VF should not be started. |
|
382 if( !iAssumePostCaptureView ) |
|
383 { |
|
384 PRINT( _L("Camera <> CCamPreCaptureViewBase::HandleForegroundEventL start VF")) |
|
385 StartViewFinder(); |
|
386 } |
|
387 } |
|
388 |
|
389 |
|
390 // <CAMERAAPP_CAPI_V2_MIGRATION/> |
|
391 // if ( iController.EngineState() == ECamEngineStillCapturePrepared || |
|
392 // iController.EngineState() == ECamEngineVideoCapturePrepared ) |
|
393 // if ( ( ECamImageOn|ECamVideoOn )& ( iController.CameraState() ) ) |
|
394 TCamCameraState state = iController.CameraState(); |
|
395 if( ECamCameraPreparedImage == state || |
|
396 ECamCameraPreparedVideo == state ) |
|
397 { |
|
398 // Now that the view is initialised, we may need to put up the |
|
399 // mmc removal note. Perform this is required. |
|
400 appUi->ShowMMCRemovalNoteIfRequiredL(); |
|
401 |
|
402 if ( appUi && !iSceneSettingModeActive && |
|
403 !( iController.UiConfigManagerPtr() && |
|
404 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) ) |
|
405 { |
|
406 appUi->RaisePreCaptureCourtesyUI(ETrue); |
|
407 } |
|
408 } |
|
409 } |
|
410 // ----------------------------------------------------- |
|
411 // Going to the background |
|
412 else |
|
413 { |
|
414 PRINT( _L( "Camera <> CCamPreCaptureViewBase::HandleForegroundEventL: to background" ) ); |
|
415 // Not behind an eikon/avkon server window |
|
416 TBool totalBackground = ETrue; |
|
417 if ( iController.IsAppUiAvailable() ) |
|
418 { |
|
419 totalBackground = appUi->AppInBackground( EFalse ); |
|
420 } |
|
421 // Either in foreground (moving to another view of our's) |
|
422 // or if in background, then not just behind a notifier dialog. |
|
423 if ( totalBackground ) |
|
424 { |
|
425 ReleaseResources(); |
|
426 // hide the AP to avoid blinking when coming back from bg |
|
427 if ( iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) |
|
428 { |
|
429 appUi->SetActivePaletteVisibility( EFalse ); |
|
430 } |
|
431 } |
|
432 // Behind a server window |
|
433 else |
|
434 { |
|
435 iContinueInBackground = ETrue; |
|
436 } |
|
437 |
|
438 // reset post capture assumption flag since post capture is not |
|
439 // used when video is stopped for usb |
|
440 if ( iController.IsCaptureStoppedForUsb() ) |
|
441 { |
|
442 iAssumePostCaptureView = EFalse; |
|
443 } |
|
444 } |
|
445 // ----------------------------------------------------- |
|
446 |
|
447 if ( !iStandbyModeActive ) |
|
448 { |
|
449 // Inform the container of foreground state change |
|
450 PRINT( _L( "Camera <> CCamPreCaptureViewBase::HandleForegroundEventL: inform container.." ) ); |
|
451 iContainer->HandleForegroundEventL( aForeground ); |
|
452 } |
|
453 else |
|
454 { |
|
455 // if in videocall, don't exit standby |
|
456 if ( iController.InVideocallOrRinging() ) |
|
457 { |
|
458 iActivateToStandby = EFalse; |
|
459 } |
|
460 else |
|
461 { |
|
462 // If the view has been set to standby at activation then |
|
463 // the first foreground event should not be used to exit standby |
|
464 if ( !iActivateToStandby ) |
|
465 { |
|
466 // inform standby container |
|
467 PRINT( _L( "Camera <> CCamPreCaptureViewBase::HandleForegroundEventL: inform standby container.." ) ); |
|
468 iStandbyContainer->HandleForegroundEventL( aForeground ); |
|
469 } |
|
470 else |
|
471 { |
|
472 iActivateToStandby = EFalse; |
|
473 } |
|
474 } |
|
475 } |
|
476 CCamCaptureSetupViewBase::HandleForegroundEventL( aForeground ); |
|
477 PRINT( _L( "Camera <= CCamPreCaptureViewBase::HandleForegroundEventL" ) ); |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // CCamPreCaptureViewBase::SetLocationTrailConnecting |
|
482 // Set iLocationTrailConnecting flag. |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 void CCamPreCaptureViewBase::SetLocationTrailConnecting() |
|
486 { |
|
487 iLocationTrailConnecting = ETrue; |
|
488 } |
|
489 |
|
490 // ----------------------------------------------------------------------------- |
|
491 // CCamPreCaptureViewBase::SetPostCaptureViewAsumption |
|
492 // Set iAssumePostCaptureView flag. |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CCamPreCaptureViewBase::SetPostCaptureViewAsumption( TBool aAssumePostCaptureView ) |
|
496 { |
|
497 iAssumePostCaptureView = aAssumePostCaptureView; |
|
498 } |
|
499 |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
|
502 // CCamPreCaptureViewBase::HandleControllerEventL |
|
503 // Handle controller events |
|
504 // ----------------------------------------------------------------------------- |
|
505 // |
|
506 void CCamPreCaptureViewBase::HandleControllerEventL( TCamControllerEvent aEvent, |
|
507 TInt /*aError*/ ) |
|
508 { |
|
509 PRINT( _L( "Camera => CCamPreCaptureViewBase::HandleControllerEventL" ) ); |
|
510 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
511 |
|
512 switch( aEvent ) |
|
513 { |
|
514 // --------------------------------------------------- |
|
515 case ECamEventEngineStateChanged: |
|
516 { |
|
517 // Do not do softkey update if we are already exiting |
|
518 // (AppUi is not available) |
|
519 if( iController.IsAppUiAvailable() ) |
|
520 { |
|
521 PRINT( _L( "Camera <> case ECamEventEngineStateChanged" ) ); |
|
522 // <CAMERAAPP_CAPI_V2_MIGRATION/> |
|
523 // if ( iController.EngineState() == ECamEngineStillCapturePrepared || |
|
524 // iController.EngineState() == ECamEngineVideoCapturePrepared ) |
|
525 if ( ECamCameraPreparedVideo == iController.CameraState() || |
|
526 ECamCameraPreparedImage == iController.CameraState() ) |
|
527 { |
|
528 // Now that the view is initialised, we may need to put up the |
|
529 // mmc removal note. Perform this is required. |
|
530 PRINT( _L( "Camera <> show mmc note if needed" ) ); |
|
531 appUi->ShowMMCRemovalNoteIfRequiredL(); |
|
532 |
|
533 // Do not update (show) precapture view toolbar if capturing is almost |
|
534 // finished, otherwise there is flickering and finally inactive toolbar |
|
535 // when returning to prepactureview after image deletion. |
|
536 // This will happen only if camera is started directly to portrait |
|
537 // secondary camera i.e. Lens cover feature is supported |
|
538 TBool noToolbar = (ECamCompleting == iController.CurrentOperation() ) && appUi->IsSecondCameraEnabled(); |
|
539 |
|
540 if ( ECamCameraPreparedImage == iController.CameraState() && |
|
541 !appUi->IsBurstEnabled() && !noToolbar ) |
|
542 { |
|
543 // Also fixed toolbar might need to be enabled. |
|
544 appUi->SetToolbarVisibility(); |
|
545 } |
|
546 } |
|
547 //Do not update CBA if we are capturing or paused to prevent blinking |
|
548 //during video capture saving and completing |
|
549 if ( iController.CurrentVideoOperation() != ECamCapturing |
|
550 && iController.CurrentVideoOperation() != ECamPaused ) |
|
551 { |
|
552 PRINT( _L( "Camera <> Update CBA" ) ); |
|
553 UpdateCbaL(); |
|
554 } |
|
555 } |
|
556 break; |
|
557 } |
|
558 |
|
559 case ECamEventSliderClosed: |
|
560 { |
|
561 // if embedded and the slider is closed, |
|
562 // the menu items may change, close the menu |
|
563 if( iEmbedded ) |
|
564 { |
|
565 PRINT( _L("Camera <> CCamPreCaptureViewBase: calling StopDisplayingMenuBar") ); |
|
566 StopDisplayingMenuBar(); |
|
567 } |
|
568 break; |
|
569 } |
|
570 default: |
|
571 { |
|
572 // Other events => no action. |
|
573 break; |
|
574 } |
|
575 } // switch |
|
576 PRINT( _L( "Camera <= CCamPreCaptureViewBase::HandleControllerEventL" ) ); |
|
577 } |
|
578 |
|
579 // --------------------------------------------------------------------------- |
|
580 // CCamPreCaptureViewBase::DoActivateL |
|
581 // Activate this view |
|
582 // --------------------------------------------------------------------------- |
|
583 // |
|
584 void CCamPreCaptureViewBase::DoActivateL( const TVwsViewId& aPrevViewId, |
|
585 TUid aCustomMessageId, |
|
586 const TDesC8& aCustomMessage ) |
|
587 { |
|
588 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMPRECAPTUREVIEWBASE_DOACTIVATEL, "e_CCamPreCaptureViewBase_DoActivateL 1" ); |
|
589 PRINT( _L( "Camera => CCamPreCaptureViewBase::DoActivateL" ) ); |
|
590 iAssumePostCaptureView = EFalse; |
|
591 |
|
592 ShowToolbarOnViewActivation( EFalse ); |
|
593 /*if ( iController.UiConfigManagerPtr() && |
|
594 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
595 { |
|
596 if( ECamLocationOn == iController.IntegerSettingValue( ECamSettingItemRecLocation ) ) |
|
597 { |
|
598 if( ECamActiveCameraPrimary == iController.ActiveCamera() && ECamStandby != iController.CurrentOperation() ) |
|
599 { |
|
600 PRINT( _L("Camera: CCamPreCaptureViewBase::DoActivateL - primary camera, start location/gps") ) |
|
601 iController.StartLocationTrailL(); |
|
602 } |
|
603 else // Secondary camera |
|
604 { |
|
605 PRINT( _L("Camera: CCamPreCaptureViewBase::DoActivateL - secondary camera, stop location trail") ) |
|
606 iController.StopLocationTrail(); |
|
607 } |
|
608 } |
|
609 }*/ |
|
610 |
|
611 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
612 __ASSERT_DEBUG(appUi, CamPanic(ECamPanicNullPointer)); |
|
613 if(!appUi->DrawPreCaptureCourtesyUI() && !iController.IsTouchScreenSupported()) |
|
614 { |
|
615 if ( !appUi->IsSecondCameraEnabled() ) |
|
616 { |
|
617 SetCourtesySoftKeysL(); |
|
618 } |
|
619 appUi->SetActivePaletteVisibility( EFalse ); |
|
620 } |
|
621 else if (appUi->DrawPreCaptureCourtesyUI()) |
|
622 { |
|
623 Cba()->MakeVisible( ETrue ); |
|
624 } |
|
625 |
|
626 if ( appUi->SettingsLaunchedFromCamera() ) |
|
627 { |
|
628 if ( TUid::Uid( ECamCmdInternalExit ) == aCustomMessageId ) |
|
629 { |
|
630 appUi->SettingsPluginExitedL( ECameraInternalExit ); |
|
631 } |
|
632 else if ( TUid::Uid ( EAknSoftkeyBack ) == aCustomMessageId ) |
|
633 { |
|
634 appUi->SettingsPluginExitedL( ECameraPluginExit ); |
|
635 } |
|
636 else |
|
637 { |
|
638 // do nothing |
|
639 } |
|
640 } |
|
641 |
|
642 CCamCaptureSetupViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
643 |
|
644 if ( appUi->IsSecondCameraEnabled() && !appUi->IsQwerty2ndCamera() ) |
|
645 { |
|
646 StatusPane()->MakeVisible( ETrue ); |
|
647 } |
|
648 else |
|
649 { |
|
650 StatusPane()->MakeVisible( EFalse ); |
|
651 } |
|
652 if ( iController.IsTouchScreenSupported() ) |
|
653 { |
|
654 CAknToolbar* fixedToolbar = Toolbar(); |
|
655 if ( fixedToolbar ) |
|
656 { |
|
657 // If video call is active, toolbar is set to dimmed, that user cannot use it |
|
658 TInt callType( EPSCTsyCallTypeUninitialized ); |
|
659 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType ); |
|
660 if ( callType == EPSCTsyCallTypeH324Multimedia) |
|
661 { |
|
662 fixedToolbar->SetDimmed( ETrue ); |
|
663 } |
|
664 else |
|
665 { |
|
666 fixedToolbar->SetDimmed( EFalse ); |
|
667 } |
|
668 fixedToolbar->SetToolbarObserver( this ); |
|
669 appUi->SetToolbarVisibility( ); |
|
670 |
|
671 // Make sure toolbar extension button has no background |
|
672 CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension(); |
|
673 if ( extension ) |
|
674 { |
|
675 extension->SetButtonFlags( |
|
676 extension->ButtonFlags() | KAknButtonNoFrame ); |
|
677 extension->DrawDeferred(); |
|
678 } |
|
679 } |
|
680 } |
|
681 |
|
682 appUi->PushNaviPaneCounterL(); |
|
683 |
|
684 // Pass on the ID of the previous view to the container |
|
685 TCamAppViewIds viewId = static_cast<TCamAppViewIds>( aPrevViewId.iViewUid.iUid ); |
|
686 iContainer->SetPreviousViewId( viewId ); |
|
687 |
|
688 iController.AddControllerObserverL( this ); |
|
689 |
|
690 TBool transparentCba = EFalse; |
|
691 |
|
692 UpdateCbaL(); |
|
693 |
|
694 switch( aCustomMessageId.iUid ) |
|
695 { |
|
696 // ------------------------------- |
|
697 // Standby with or without error |
|
698 case ECamViewMessageStandby: |
|
699 PRINT( _L( "Camera <> CCamPreCaptureViewBase::DoActivateL: custom message ECamViewMessageStandby" ) ); |
|
700 //iStandbyError = KErrNone; |
|
701 //appUi->SetStandbyStatus( KErrNone ); |
|
702 SetSceneSettingMode( EFalse ); |
|
703 iActivateToStandby = ETrue; |
|
704 HandleCommandL( ECamCmdGoToStandby ); |
|
705 return; |
|
706 // break; |
|
707 // ------------------------------- |
|
708 // Scene setting mode |
|
709 case ECamViewMessageSceneSettingList: |
|
710 PRINT( _L( "Camera <> CCamPreCaptureViewBase::DoActivateL: custom message ECamViewMessageSceneSettingList" ) ); |
|
711 SwitchToSceneSettingModeL(); |
|
712 break; |
|
713 // ------------------------------- |
|
714 default: |
|
715 // Other precapture modes have transparent CBA buttons |
|
716 // except secondary camera |
|
717 if ( !appUi->IsSecondCameraEnabled() || appUi->IsQwerty2ndCamera() ) |
|
718 { |
|
719 transparentCba = ETrue; |
|
720 } |
|
721 // don't start VF if faster startup is used when cameraswitch is queued, |
|
722 // need to switch to maincamera first |
|
723 if ( !( iController.UiConfigManagerPtr() && |
|
724 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() && |
|
725 iController.CameraSwitchQueued() ) ) |
|
726 { |
|
727 StartViewFinder(); |
|
728 } |
|
729 |
|
730 break; |
|
731 // ------------------------------- |
|
732 } |
|
733 |
|
734 // Here we check if the previous view is ViaPlayer play mode |
|
735 if ( !iSceneSettingModeActive && |
|
736 ( aPrevViewId.iViewUid.iUid != ECamViewIdViaPlayerPlayBack ) && |
|
737 !( iController.UiConfigManagerPtr() && |
|
738 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) ) |
|
739 { |
|
740 appUi->RaisePreCaptureCourtesyUI(ETrue); |
|
741 } |
|
742 |
|
743 // Reset iContinueInBackground flag, which is set when app temporarily |
|
744 // goes behind a system window and there's no need to free resources. |
|
745 // Resetting this flag only in ReleaseResources causes problems (at least) |
|
746 // if power key is pressed during burst capture. |
|
747 iContinueInBackground = EFalse; |
|
748 |
|
749 // Reset iDeactivateToStandby flag, which is used when the PreCapture view |
|
750 // goes to the Standby mode, at which point the UI should not reactivate the |
|
751 // viewfinder. |
|
752 iDeactivateToStandby = EFalse; |
|
753 |
|
754 |
|
755 EikSoftkeyPostingTransparency::MakeTransparent( |
|
756 *Cba(), transparentCba ); |
|
757 // Make sure appuis CBA is not visible |
|
758 CEikButtonGroupContainer* cba = AppUi()->Cba(); |
|
759 if( cba ) |
|
760 { |
|
761 cba->MakeVisible( EFalse ); |
|
762 } |
|
763 |
|
764 PRINT( _L( "Camera <= CCamPreCaptureViewBase::DoActivateL" ) ); |
|
765 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMPRECAPTUREVIEWBASE_DOACTIVATEL, "e_CCamPreCaptureViewBase_DoActivateL 0" ); |
|
766 } |
|
767 |
|
768 // --------------------------------------------------------------------------- |
|
769 // CCamPreCaptureViewBase::DoDeactivate |
|
770 // Deactivate this view |
|
771 // --------------------------------------------------------------------------- |
|
772 // |
|
773 void CCamPreCaptureViewBase::DoDeactivate() |
|
774 { |
|
775 PRINT( _L( "Camera => CCamPreCaptureViewBase::DoDeactivate" ) ); |
|
776 CCamCaptureSetupViewBase::DoDeactivate(); |
|
777 |
|
778 iController.RemoveControllerObserver( this ); |
|
779 |
|
780 if ( iController.IsTouchScreenSupported() ) |
|
781 { |
|
782 CAknToolbar* fixedToolbar = Toolbar(); |
|
783 if ( fixedToolbar ) |
|
784 { |
|
785 CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension(); |
|
786 if ( extension ) |
|
787 { |
|
788 // Reset toolbar extension button and view to closed state |
|
789 extension->SetShown( EFalse ); |
|
790 extension->SetCurrentState( 0, EFalse ); |
|
791 } |
|
792 } |
|
793 } |
|
794 ReleaseResources(); |
|
795 |
|
796 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() && |
|
797 iController.ActiveCamera() == ECamActiveCameraSecondary ) |
|
798 { |
|
799 if ( iController.CameraSwitchQueued() ) |
|
800 { |
|
801 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
802 // If camera switch fails, main camera is used instead |
|
803 TRAP_IGNORE( appUi->HandleCommandL( ECamCmdSwitchCamera ) ); |
|
804 } |
|
805 } |
|
806 |
|
807 PRINT( _L( "Camera <= CCamPreCaptureViewBase::DoDeactivate" ) ); |
|
808 } |
|
809 |
|
810 // ----------------------------------------------------------------------------- |
|
811 // CCamPreCaptureViewBase::HandleFocusLossL |
|
812 // Handle change of focus |
|
813 // ----------------------------------------------------------------------------- |
|
814 // |
|
815 void CCamPreCaptureViewBase::HandleFocusLossL() |
|
816 { |
|
817 PRINT( _L( "Camera => CCamPreCaptureViewBase::HandleFocusLossL" ) ); |
|
818 // if the application was already in the background, but behind an |
|
819 // eikon server window, then handle backgrounding properly now. |
|
820 // Otherwise the backgrounding will be handled in the normal |
|
821 // HandleForeground() method. |
|
822 if ( iContinueInBackground ) |
|
823 { |
|
824 ReleaseResources(); |
|
825 // Inform the container of foreground state change |
|
826 iContainer->HandleForegroundEventL( EFalse ); |
|
827 } |
|
828 CCamCaptureSetupViewBase::HandleFocusLossL(); |
|
829 |
|
830 // dismiss menu bar if open |
|
831 StopDisplayingMenuBar(); |
|
832 PRINT( _L( "Camera <= CCamPreCaptureViewBase::HandleFocusLossL" ) ); |
|
833 } |
|
834 |
|
835 // --------------------------------------------------------------------------- |
|
836 // CCamPreCaptureViewBase::SwitchToCaptureSetupModeL |
|
837 // Switches the current mode to capture setup and activates a |
|
838 // specific control.. |
|
839 // --------------------------------------------------------------------------- |
|
840 // |
|
841 void CCamPreCaptureViewBase::SwitchToCaptureSetupModeL( TInt aSetupCommand ) |
|
842 { |
|
843 |
|
844 PRINT( _L("Camera => CCamPreCaptureViewBase::SwitchToCaptureSetupModeL") ); |
|
845 |
|
846 // Remove the view's main container, and add the capture setup |
|
847 // control associated with the input command to the container stack. |
|
848 CCamCaptureSetupViewBase::SwitchToCaptureSetupModeL( aSetupCommand ); |
|
849 |
|
850 // only remove the capture setup menu container after |
|
851 // the switch completes successfully |
|
852 RemoveCaptureSetupMenuContainers(); |
|
853 |
|
854 SetCaptureSetupModeActive(ETrue); |
|
855 |
|
856 PRINT( _L("Camera <= CCamPreCaptureViewBase::SwitchToCaptureSetupModeL") ); |
|
857 } |
|
858 |
|
859 // --------------------------------------------------------------------------- |
|
860 // CCamPreCaptureViewBase::SwitchToSceneSettingModeL |
|
861 // Switches the current mode to scene setting and activates a |
|
862 // specific control. |
|
863 // --------------------------------------------------------------------------- |
|
864 // |
|
865 void CCamPreCaptureViewBase::SwitchToSceneSettingModeL() |
|
866 { |
|
867 // Remove the view's main container, and add the capture setup |
|
868 // control associated with the input command to the container stack. |
|
869 CCamCaptureSetupViewBase::SwitchToSceneSettingModeL(); |
|
870 |
|
871 // only remove the capture setup menu container after |
|
872 // the switch completes successfully |
|
873 RemoveCaptureSetupMenuContainers(); |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------------------------- |
|
877 // CCamPreCaptureViewBase::ExitCaptureSetupModeL |
|
878 // Exits capture setup mode and activates the capture setup menu control. |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 void CCamPreCaptureViewBase::ExitCaptureSetupModeL() |
|
882 { |
|
883 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitCaptureSetupModeL") ) |
|
884 |
|
885 CCamCaptureSetupViewBase::ExitCaptureSetupModeL(); |
|
886 |
|
887 iController.SetViewfinderWindowHandle( &iContainer->Window() ); |
|
888 |
|
889 if( !iController.IsViewFinding() && !iController.InVideocallOrRinging() ) |
|
890 { |
|
891 TCamCameraMode mode = iController.CurrentMode(); |
|
892 PRINT1( _L("Camera => CCamPreCaptureViewBase::ExitCaptureSetupModeL - CurrentMode %d"), mode ); |
|
893 if (mode == ECamControllerVideo ) |
|
894 { |
|
895 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitCaptureSetupModeL - ECamControllerVideo") ); |
|
896 iController.EnterViewfinderMode( ECamControllerVideo ); |
|
897 } |
|
898 else |
|
899 { |
|
900 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitCaptureSetupModeL - ECamControllerImage") ); |
|
901 iController.EnterViewfinderMode( ECamControllerImage ); |
|
902 } |
|
903 } |
|
904 |
|
905 // make sure app is not left in an invalid state if a leave |
|
906 // occurs after exiting the capture setup |
|
907 iCaptureSetupMenuModeActive = EFalse; |
|
908 static_cast<CCamAppUiBase*>( AppUi() )->PushNaviPaneCounterL(); |
|
909 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
910 if( appUi->ActiveCamera() == ECamActiveCameraSecondary ) |
|
911 { |
|
912 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitCaptureSetupModeL ###") ) |
|
913 SwitchToCaptureSetupMenuModeL(); |
|
914 } |
|
915 |
|
916 PRINT( _L("Camera <= CCamPreCaptureViewBase::ExitCaptureSetupModeL") ) |
|
917 } |
|
918 |
|
919 // --------------------------------------------------------------------------- |
|
920 // CCamPreCaptureViewBase::ExitSceneSettingModeL |
|
921 // Exits scene setting mode and activates the capture setup menu control. |
|
922 // --------------------------------------------------------------------------- |
|
923 // |
|
924 void CCamPreCaptureViewBase::ExitSceneSettingModeL() |
|
925 { |
|
926 CCamCaptureSetupViewBase::ExitSceneSettingModeL(); |
|
927 // make sure app is not left in an invalid state if a leave |
|
928 // occurs after exiting the scene setting mode |
|
929 iCaptureSetupMenuModeActive = EFalse; |
|
930 static_cast<CCamAppUiBase*>( AppUi() )->PushNaviPaneCounterL(); |
|
931 |
|
932 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
933 if ( appUi->ActiveCamera() == ECamActiveCameraPrimary ) |
|
934 { |
|
935 if ( iDeactivateToStandby || iController.InVideocallOrRinging() ) |
|
936 { |
|
937 // don't restart VF if we are going to standby mode |
|
938 } |
|
939 else |
|
940 { |
|
941 StartViewFinder(); |
|
942 } |
|
943 } |
|
944 else |
|
945 { |
|
946 SwitchToCaptureSetupMenuModeL(); |
|
947 } |
|
948 } |
|
949 |
|
950 // --------------------------------------------------------------------------- |
|
951 // CCamPreCaptureViewBase::ExitInfoListBoxL |
|
952 // Exits InfoListBox |
|
953 // --------------------------------------------------------------------------- |
|
954 // |
|
955 void CCamPreCaptureViewBase::ExitInfoListBoxL() |
|
956 { |
|
957 CCamCaptureSetupViewBase::ExitInfoListBoxL(); |
|
958 // make sure app is not left in an invalid state if a leave |
|
959 // occurs after exiting the scene setting mode |
|
960 iCaptureSetupMenuModeActive = EFalse; |
|
961 static_cast<CCamAppUiBase*>( AppUi() )->PushNaviPaneCounterL(); |
|
962 |
|
963 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
964 if ( appUi->ActiveCamera() == ECamActiveCameraPrimary ) |
|
965 { |
|
966 StartViewFinder(); |
|
967 } |
|
968 else |
|
969 { |
|
970 SwitchToCaptureSetupMenuModeL(); |
|
971 } |
|
972 } |
|
973 |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // CCamPreCaptureViewBase::ExitAllModesL |
|
977 // Revert to normal mode |
|
978 // ----------------------------------------------------------------------------- |
|
979 // |
|
980 void |
|
981 CCamPreCaptureViewBase::ExitAllModesL() |
|
982 { |
|
983 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitAllModesL" ) ); |
|
984 iController.DeepSleepTimerCancel(); |
|
985 TCamSettingMode currentMode = ActiveSettingMode(); |
|
986 |
|
987 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
988 |
|
989 switch ( currentMode ) |
|
990 { |
|
991 case ECamSettingModeCaptureMenu: |
|
992 { |
|
993 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitAllModesL cap setup menu" )) |
|
994 ExitCaptureSetupMenuModeL(); |
|
995 break; |
|
996 } |
|
997 case ECamSettingModeCapture: |
|
998 { |
|
999 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitAllModesL capture" )) |
|
1000 |
|
1001 ExitCaptureSetupModeL(); |
|
1002 if( appUi->ActiveCamera() == ECamActiveCameraSecondary ) |
|
1003 { |
|
1004 PRINT( _L("Camera <> CamPreCaptureViewBase::ExitAllModesL ##" )) |
|
1005 ExitCaptureSetupMenuModeL(); |
|
1006 } |
|
1007 break; |
|
1008 } |
|
1009 case ECamSettingModeScene: |
|
1010 { |
|
1011 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitAllModesL scene" )) |
|
1012 ExitSceneSettingModeL(); |
|
1013 if( appUi->ActiveCamera() == ECamActiveCameraSecondary ) |
|
1014 { |
|
1015 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitAllModesL ##" )) |
|
1016 ExitCaptureSetupMenuModeL(); |
|
1017 } |
|
1018 if(Id() == TUid::Uid(ECamViewIdVideoPreCapture)) |
|
1019 { |
|
1020 iToolbarExtensionInvisible = ETrue; |
|
1021 } |
|
1022 break; |
|
1023 } |
|
1024 case ECamSettingModeInfoListBox: |
|
1025 { |
|
1026 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitAllModesL generic" )) |
|
1027 ExitInfoListBoxL(); |
|
1028 if( appUi->ActiveCamera() == ECamActiveCameraSecondary ) |
|
1029 { |
|
1030 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitAllModesL ##" )) |
|
1031 ExitCaptureSetupMenuModeL(); |
|
1032 } |
|
1033 break; |
|
1034 } |
|
1035 default: |
|
1036 { |
|
1037 iToolbarExtensionInvisible = ETrue; |
|
1038 } |
|
1039 break; |
|
1040 } |
|
1041 |
|
1042 if ( iController.InVideocallOrRinging() ) |
|
1043 { |
|
1044 return; |
|
1045 } |
|
1046 |
|
1047 appUi->HandleCommandL(ECamCmdSwitchToPrecapture); |
|
1048 |
|
1049 if ( !( iController.UiConfigManagerPtr() && |
|
1050 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) ) |
|
1051 { |
|
1052 TCamOrientation orientation = appUi->CamOrientation(); |
|
1053 if ( orientation == ECamOrientationCamcorder || orientation == ECamOrientationCamcorderLeft ) |
|
1054 { |
|
1055 // force update of active palette |
|
1056 appUi->APHandler()->UpdateActivePaletteL(); |
|
1057 } |
|
1058 |
|
1059 if ( appUi && !iSceneSettingModeActive ) |
|
1060 { |
|
1061 appUi->RaisePreCaptureCourtesyUI(ETrue); |
|
1062 } |
|
1063 } |
|
1064 |
|
1065 if ( iController.IsTouchScreenSupported() ) |
|
1066 { |
|
1067 CAknToolbar* fixedToolbar = Toolbar(); |
|
1068 CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension(); |
|
1069 |
|
1070 //Only active view will set toolbar extension visibility. |
|
1071 |
|
1072 if(this->IsForeground()) |
|
1073 { |
|
1074 if ( extension && iToolbarExtensionInvisible == EFalse ) |
|
1075 { |
|
1076 extension->SetShown( ETrue ); |
|
1077 } |
|
1078 else if( extension ) |
|
1079 { |
|
1080 extension->SetShown( EFalse ); |
|
1081 } |
|
1082 } |
|
1083 |
|
1084 iToolbarExtensionInvisible = EFalse; |
|
1085 } |
|
1086 |
|
1087 PRINT( _L("Camera <= CCamPreCaptureViewBase::ExitAllModesL" ) ); |
|
1088 } |
|
1089 |
|
1090 |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // CCamPreCaptureViewBase::ActiveSettingMode |
|
1093 // Returns the active setting mode |
|
1094 // --------------------------------------------------------------------------- |
|
1095 // |
|
1096 CCamPreCaptureViewBase::TCamSettingMode |
|
1097 CCamPreCaptureViewBase::ActiveSettingMode() |
|
1098 { |
|
1099 if ( iCaptureSetupModeActive ) |
|
1100 { |
|
1101 return ECamSettingModeCapture; |
|
1102 } |
|
1103 else if ( iSceneSettingModeActive ) |
|
1104 { |
|
1105 return ECamSettingModeScene; |
|
1106 } |
|
1107 else if ( iCaptureSetupMenuModeActive ) |
|
1108 { |
|
1109 return ECamSettingModeCaptureMenu; |
|
1110 } |
|
1111 else if ( iInfoListBoxActive ) |
|
1112 { |
|
1113 return ECamSettingModeInfoListBox; |
|
1114 } |
|
1115 else |
|
1116 { |
|
1117 return ECamSettingModeNone; |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 // --------------------------------------------------------------------------- |
|
1122 // CCamPreCaptureViewBase::CCamPreCaptureViewBase |
|
1123 // C++ constructor |
|
1124 // --------------------------------------------------------------------------- |
|
1125 // |
|
1126 CCamPreCaptureViewBase::CCamPreCaptureViewBase( CCamAppController& aController ) |
|
1127 : CCamCaptureSetupViewBase( aController ) |
|
1128 { |
|
1129 iCaptureSetupMenuModeActive = EFalse; |
|
1130 iAssumePostCaptureView = EFalse; |
|
1131 } |
|
1132 |
|
1133 // --------------------------------------------------------------------------- |
|
1134 // CCamPreCaptureViewBase::ConstructL |
|
1135 // Symbian OS 2nd phase constructor |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // |
|
1138 void CCamPreCaptureViewBase::ConstructL() |
|
1139 { |
|
1140 PRINT( _L("Camera => CCamPreCaptureViewBase::ConstructL") ) |
|
1141 /* Use AppUi to get this info. |
|
1142 // Get the id of Eikon Server window group |
|
1143 iEikonServerWindowGroupId = |
|
1144 iCoeEnv->WsSession().FindWindowGroupIdentifier( 0, KEikonServer ); |
|
1145 |
|
1146 iBTServerWindowGroupId = |
|
1147 static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->BTServerId(); |
|
1148 */ |
|
1149 UpdateToolbarIconsL(); |
|
1150 PRINT( _L("Camera <= CCamPreCaptureViewBase::ConstructL") ) |
|
1151 } |
|
1152 |
|
1153 // --------------------------------------------------------------------------- |
|
1154 // CCamPreCaptureViewBase::CleanupCaptureSetupMenu |
|
1155 // Cleanup the capture menu control if a leave occurs |
|
1156 // --------------------------------------------------------------------------- |
|
1157 // |
|
1158 void CCamPreCaptureViewBase::CleanupCaptureSetupMenu( TAny* aAny ) |
|
1159 { |
|
1160 CCamPreCaptureViewBase* view = static_cast<CCamPreCaptureViewBase*>( aAny ); |
|
1161 if ( view->iCaptureSetupMenuContainer ) |
|
1162 { |
|
1163 view->AppUi()->RemoveFromStack( view->iCaptureSetupMenuContainer ); |
|
1164 delete view->iCaptureSetupMenuContainer; |
|
1165 view->iCaptureSetupMenuContainer = NULL; |
|
1166 } |
|
1167 // reset the active mode |
|
1168 view->iCaptureSetupMenuModeActive = EFalse; |
|
1169 } |
|
1170 |
|
1171 // --------------------------------------------------------------------------- |
|
1172 // CCamPreCaptureViewBase::SwitchToCaptureSetupMenuModeL |
|
1173 // Switches the current mode to capture setup menu and activates |
|
1174 // the capture setup menu control |
|
1175 // --------------------------------------------------------------------------- |
|
1176 // |
|
1177 void CCamPreCaptureViewBase::SwitchToCaptureSetupMenuModeL() |
|
1178 { |
|
1179 PRINT( _L("Camera => CCamPreCaptureViewBase::SwitchToCaptureSetupMenuModeL")) |
|
1180 __ASSERT_DEBUG( !iCaptureSetupMenuContainer, CamPanic( ECamPanicResourceLeak ) ); |
|
1181 |
|
1182 // Create the relevant capture setup menu, e.g. video or photo... |
|
1183 CreateCaptureSetupMenuL(); |
|
1184 |
|
1185 // Cleanup the view correctly if a leave occurs |
|
1186 CleanupStack::PushL( TCleanupItem( CleanupCaptureSetupMenu, this ) ); |
|
1187 |
|
1188 PRINT( _L("Camera => CCamPreCaptureViewBase::SwitchToCaptureSetupMenuModeL start vf")) |
|
1189 StartViewFinder(); |
|
1190 iCaptureSetupMenuContainer->SetMopParent( this ); |
|
1191 // Activate the menu control and mode. |
|
1192 AppUi()->AddToStackL( *this, iCaptureSetupMenuContainer ); |
|
1193 iCaptureSetupMenuContainer->ActivateL(); |
|
1194 // UpdateCbaL need this boolean to be set in |
|
1195 // order for the correct CBA to be returned |
|
1196 iCaptureSetupMenuModeActive = ETrue; |
|
1197 UpdateCbaL(); |
|
1198 CleanupStack::Pop(); // CleanupCaptureSetupMenu |
|
1199 |
|
1200 // Fade the container that is behind. |
|
1201 iCaptureSetupMenuContainer->FadeBehind( ETrue ); |
|
1202 } |
|
1203 |
|
1204 // --------------------------------------------------------------------------- |
|
1205 // CCamPreCaptureViewBase::ExitCaptureSetupMenuModeL |
|
1206 // Exits capture setup menu mode and activates the original precapture |
|
1207 // view container that was active before entering this mode. |
|
1208 // --------------------------------------------------------------------------- |
|
1209 // |
|
1210 void CCamPreCaptureViewBase::ExitCaptureSetupMenuModeL() |
|
1211 { |
|
1212 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitCaptureSetupMenuModeL() ") ); |
|
1213 |
|
1214 if ( !iCaptureSetupMenuModeActive ) |
|
1215 { |
|
1216 return; |
|
1217 } |
|
1218 iCaptureSetupMenuModeActive = EFalse; |
|
1219 iContainer->MakeVisible( ETrue ); |
|
1220 |
|
1221 iCaptureSetupMenuContainer->FadeBehind( EFalse ); |
|
1222 AppUi()->RemoveFromStack( iCaptureSetupMenuContainer ); |
|
1223 delete iCaptureSetupMenuContainer; |
|
1224 iCaptureSetupMenuContainer = NULL; |
|
1225 UpdateCbaL(); |
|
1226 SetTitlePaneTextL(); |
|
1227 |
|
1228 PRINT( _L("Camera <= CCamPreCaptureViewBase::ExitCaptureSetupMenuModeL() ") ); |
|
1229 } |
|
1230 |
|
1231 // --------------------------------------------------------------------------- |
|
1232 // CCamPreCaptureViewBase::SwitchToStandbyModeL |
|
1233 // Exits pre capture mode and activates the standby container |
|
1234 // --------------------------------------------------------------------------- |
|
1235 // |
|
1236 void CCamPreCaptureViewBase::SwitchToStandbyModeL( TCamAppViewIds aViewId, TInt aError ) |
|
1237 { |
|
1238 iAssumePostCaptureView = EFalse; |
|
1239 iDeactivateToStandby = ETrue; // avoid viewfinder startup |
|
1240 iContinueInBackground = EFalse; |
|
1241 |
|
1242 switch ( ActiveSettingMode() ) |
|
1243 { |
|
1244 case ECamSettingModeCaptureMenu: |
|
1245 { |
|
1246 ExitCaptureSetupMenuModeL(); |
|
1247 } |
|
1248 break; |
|
1249 case ECamSettingModeScene: |
|
1250 { |
|
1251 ExitSceneSettingModeL(); |
|
1252 ExitCaptureSetupMenuModeL(); |
|
1253 } |
|
1254 break; |
|
1255 case ECamSettingModeCapture: |
|
1256 { |
|
1257 ExitCaptureSetupModeL(); |
|
1258 ExitCaptureSetupMenuModeL(); |
|
1259 } |
|
1260 break; |
|
1261 case ECamSettingModeInfoListBox: |
|
1262 { |
|
1263 ExitInfoListBoxL(); |
|
1264 ExitCaptureSetupMenuModeL(); |
|
1265 } |
|
1266 break; |
|
1267 default: |
|
1268 break; |
|
1269 } |
|
1270 |
|
1271 |
|
1272 // Hide the active palette |
|
1273 static_cast<CCamAppUi*>( iEikonEnv->AppUi() ) |
|
1274 ->SetActivePaletteVisibility( EFalse ); |
|
1275 |
|
1276 // stop viewfinding |
|
1277 StopViewFinder(); |
|
1278 |
|
1279 CCamViewBase::SwitchToStandbyModeL( aViewId, aError ); |
|
1280 |
|
1281 iDeactivateToStandby = EFalse; |
|
1282 } |
|
1283 |
|
1284 // --------------------------------------------------------------------------- |
|
1285 // CCamPreCaptureViewBase::ExitStandbyModeL |
|
1286 // Exits standby mode and activates the previous pre-capture container |
|
1287 // --------------------------------------------------------------------------- |
|
1288 // |
|
1289 void CCamPreCaptureViewBase::ExitStandbyModeL() |
|
1290 { |
|
1291 PRINT( _L("Camera => CCamPreCaptureViewBase::ExitStandbyModeL" ) ) |
|
1292 // start view finding |
|
1293 iAssumePostCaptureView = EFalse; |
|
1294 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
1295 if( appUi->AppInBackground(ETrue )) |
|
1296 { |
|
1297 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitStandbyModeL: global note in foreground." ) ) |
|
1298 return; |
|
1299 } |
|
1300 if( iController.UiConfigManagerPtr() && |
|
1301 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() && |
|
1302 iController.CurrentMode() != ECamControllerIdle ) |
|
1303 { |
|
1304 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitStandbyModeL: not in standby, returning without exit" ) ) |
|
1305 return; |
|
1306 } |
|
1307 |
|
1308 if( !appUi->DrawPreCaptureCourtesyUI() && |
|
1309 !iController.IsTouchScreenSupported() && |
|
1310 !appUi->IsSecondCameraEnabled() ) |
|
1311 { |
|
1312 SetCourtesySoftKeysL(); |
|
1313 } |
|
1314 |
|
1315 // In case coming back after dismissing videocall, need |
|
1316 // to register as using engine |
|
1317 if( !appUi->IsInPretendExit() ) |
|
1318 { |
|
1319 IncrementCameraUsers(); |
|
1320 } |
|
1321 |
|
1322 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitStandbyModeL: start vf" ) ) |
|
1323 StartViewFinder(); |
|
1324 |
|
1325 //static_cast<CCamAppUi*>( iEikonEnv->AppUi() ) |
|
1326 // ->APHandler()->UpdateActivePaletteL(); |
|
1327 TBool uiOverride = iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported(); |
|
1328 if ( !uiOverride ) |
|
1329 { |
|
1330 SetupActivePaletteL(); |
|
1331 } |
|
1332 |
|
1333 // Dimming is set if video call is active, remove dimming if video call is not active any more |
|
1334 TInt callType( EPSCTsyCallTypeUninitialized ); |
|
1335 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType ); |
|
1336 if ( callType != EPSCTsyCallTypeH324Multimedia |
|
1337 && iController.IsTouchScreenSupported() ) |
|
1338 { |
|
1339 CAknToolbar* toolbar = Toolbar(); |
|
1340 if (toolbar) |
|
1341 { |
|
1342 toolbar->SetDimmed( EFalse ); |
|
1343 } |
|
1344 } |
|
1345 CCamViewBase::ExitStandbyModeL(); |
|
1346 |
|
1347 // Need to update appui viewstate |
|
1348 PRINT( _L("Camera <> CCamPreCaptureViewBase::ExitStandbyModeL: emit ECamCmdSwitchToPrecapture" ) ) |
|
1349 appUi->HandleCommandL( ECamCmdSwitchToPrecapture ); |
|
1350 |
|
1351 if ( uiOverride ) |
|
1352 { |
|
1353 appUi->SetActivePaletteVisibility( EFalse ); |
|
1354 } |
|
1355 else |
|
1356 { |
|
1357 appUi->RaisePreCaptureCourtesyUI(ETrue); |
|
1358 } |
|
1359 |
|
1360 if ( iController.UiConfigManagerPtr() && |
|
1361 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
1362 { |
|
1363 if( ECamLocationOn == iController.IntegerSettingValue( ECamSettingItemRecLocation ) ) |
|
1364 { |
|
1365 if( ECamActiveCameraPrimary == iController.ActiveCamera() ) |
|
1366 { |
|
1367 PRINT( _L("Camera: CCamPreCaptureViewBase::ExitStandbyModeL - primary camera, start location/gps") ) |
|
1368 iController.StartLocationTrailL(); |
|
1369 } |
|
1370 } |
|
1371 } |
|
1372 PRINT( _L("Camera <= CCamPreCaptureViewBase::ExitStandbyModeL" ) ) |
|
1373 } |
|
1374 |
|
1375 // --------------------------------------------------------------------------- |
|
1376 // CCamPreCaptureViewBase::IsOkOptionsMenuAllowed |
|
1377 // Checks whether or not the ok aoptions menu should be displayed |
|
1378 // --------------------------------------------------------------------------- |
|
1379 // |
|
1380 #if 0 |
|
1381 TBool CCamPreCaptureViewBase::IsOkOptionsMenuAllowed() |
|
1382 { |
|
1383 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
1384 // Check if we are in selftimer mode, scene setting mode, |
|
1385 // capture setup menu mode or if a capture mode preparation is |
|
1386 // taking place. If so, do NOT show the menu |
|
1387 if ( ( appUi && !appUi->SelfTimerEnabled() ) && |
|
1388 !iController.CaptureModeTransitionInProgress() && |
|
1389 ActiveSettingMode() == ECamSettingModeNone && !appUi->IsEmbedded() ) |
|
1390 { |
|
1391 return ETrue; |
|
1392 } |
|
1393 else |
|
1394 { |
|
1395 return EFalse; |
|
1396 } |
|
1397 } |
|
1398 #endif // 0 |
|
1399 |
|
1400 // --------------------------------------------------------------------------- |
|
1401 // CCamPreCaptureViewBase::RemoveCaptureSetupMenuContainers |
|
1402 // Removes the capture setup menu and original container from |
|
1403 // the container stack |
|
1404 // --------------------------------------------------------------------------- |
|
1405 // |
|
1406 void CCamPreCaptureViewBase::RemoveCaptureSetupMenuContainers() |
|
1407 { |
|
1408 // Store the current item index value for the menu, so that it can |
|
1409 // be reused when the CSM container is reactivated from leaving |
|
1410 // a capture setup control. |
|
1411 if ( iCaptureSetupMenuContainer ) |
|
1412 { |
|
1413 iCaptureSetupMenuLastItemIndex = |
|
1414 iCaptureSetupMenuContainer->CurrentItemIndex(); |
|
1415 iCaptureSetupMenuContainer->FadeBehind( EFalse ); |
|
1416 |
|
1417 // Remove the Capture Setup Menu from the container stack. |
|
1418 AppUi()->RemoveFromStack( iCaptureSetupMenuContainer ); |
|
1419 } |
|
1420 delete iCaptureSetupMenuContainer; |
|
1421 iCaptureSetupMenuContainer = NULL; |
|
1422 } |
|
1423 |
|
1424 // --------------------------------------------------------------------------- |
|
1425 // CCamPreCaptureViewBase::DynInitSwitchCameraMenuItemL |
|
1426 // Set up the text for switch camera in the options menu |
|
1427 // --------------------------------------------------------------------------- |
|
1428 // |
|
1429 void CCamPreCaptureViewBase::DynInitSwitchCameraMenuItemL( CEikMenuPane* aMenuPane ) |
|
1430 { |
|
1431 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
1432 // Check if only 1 camera available |
|
1433 if ( !iController.UiConfigManagerPtr()->IsSecondaryCameraSupported() ) |
|
1434 { |
|
1435 aMenuPane->SetItemDimmed( ECamCmdSwitchCamera, ETrue ); |
|
1436 } |
|
1437 else |
|
1438 { |
|
1439 // if secondary camera is enabled |
|
1440 if ( appUi->IsSecondCameraEnabled() ) |
|
1441 { |
|
1442 if( iController.UiConfigManagerPtr()->IsLensCoverSupported() ) |
|
1443 { |
|
1444 TInt slideState = iController.CameraSlideState(); |
|
1445 if ( slideState == CameraPlatPSKeys::EClosed ) |
|
1446 { |
|
1447 aMenuPane->SetItemDimmed( ECamCmdSwitchCamera, ETrue ); |
|
1448 } |
|
1449 else |
|
1450 { |
|
1451 aMenuPane->SetItemTextL( ECamCmdSwitchCamera, |
|
1452 R_CAM_PRE_CAPTURE_MENU_PRIMARY_CAMERA ); |
|
1453 } |
|
1454 } |
|
1455 else |
|
1456 { |
|
1457 aMenuPane->SetItemTextL( ECamCmdSwitchCamera, |
|
1458 R_CAM_PRE_CAPTURE_MENU_PRIMARY_CAMERA ); |
|
1459 } |
|
1460 } |
|
1461 } |
|
1462 } |
|
1463 |
|
1464 |
|
1465 // --------------------------------------------------------------------------- |
|
1466 // CCamPreCaptureViewBase::ReleaseResources |
|
1467 // Stop the viewfinder and inform the controller that this view has finished |
|
1468 // with the engine |
|
1469 // --------------------------------------------------------------------------- |
|
1470 // |
|
1471 void CCamPreCaptureViewBase::ReleaseResources() |
|
1472 { |
|
1473 PRINT( _L("Camera => CCamPreCaptureViewBase::ReleaseResources") ); |
|
1474 iContinueInBackground = EFalse; |
|
1475 StopViewFinder(); |
|
1476 |
|
1477 // Make sure that video recording is stopped (if ongoing). |
|
1478 iController.StopVideoRecording(); |
|
1479 |
|
1480 // if the application is not closing then self-timer mode must be disabled. |
|
1481 // otherwise it will be deleted as part of the application shut down process |
|
1482 if ( !iController.IsInShutdownMode() ) |
|
1483 { |
|
1484 // Do not do softkey update if we are already exiting |
|
1485 // (AppUi is not available) |
|
1486 if( iController.IsAppUiAvailable() ) |
|
1487 { |
|
1488 // Ensure AppUi has had self-timer mode disabled |
|
1489 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
1490 if ( appUi ) |
|
1491 { |
|
1492 TRAP_IGNORE( appUi->SelfTimerEnableL( ECamSelfTimerDisabled ) ); |
|
1493 } |
|
1494 } |
|
1495 } |
|
1496 // Register that we no longer need the engine |
|
1497 // Checks if we incremented the count. |
|
1498 DecrementCameraUsers(); |
|
1499 PRINT( _L("Camera <= CCamPreCaptureViewBase::ReleaseResources") ); |
|
1500 } |
|
1501 |
|
1502 // --------------------------------------------------------------------------- |
|
1503 // CCamPreCaptureViewBase::IsPreCapture |
|
1504 // Returns whether the view is a precapture view |
|
1505 // --------------------------------------------------------------------------- |
|
1506 // |
|
1507 TBool CCamPreCaptureViewBase::IsPreCapture() |
|
1508 { |
|
1509 return ETrue; |
|
1510 } |
|
1511 |
|
1512 // --------------------------------------------------------------------------- |
|
1513 // CCamPreCaptureViewBase::OfferToolbarEventL |
|
1514 // Handle fixed toolbar and toolbar extension events |
|
1515 // --------------------------------------------------------------------------- |
|
1516 // |
|
1517 void CCamPreCaptureViewBase::OfferToolbarEventL( TInt aCommand ) |
|
1518 { |
|
1519 iController.StartIdleTimer(); |
|
1520 HandleCommandAoL( aCommand ); |
|
1521 |
|
1522 if ( aCommand == ECamCmdSceneSettingList || |
|
1523 aCommand == ECamCmdCaptureSetupFlashStill || |
|
1524 aCommand == ECamCmdCaptureSetupSelfTimer || |
|
1525 aCommand == ECamCmdCaptureSetupSceneStill || |
|
1526 aCommand == ECamCmdCaptureSetupSceneVideo || |
|
1527 aCommand == ECamCmdCaptureSetupColourFilterStill || |
|
1528 aCommand == ECamCmdCaptureSetupColourFilterVideo || |
|
1529 aCommand == ECamCmdCaptureSetupWhiteBalanceStill || |
|
1530 aCommand == ECamCmdCaptureSetupWhiteBalanceVideo || |
|
1531 aCommand == ECamCmdCaptureSetupExposureStill || |
|
1532 aCommand == ECamCmdCaptureSetupLightSensitivityStill || |
|
1533 aCommand == ECamCmdCaptureSetupContrastStill || |
|
1534 aCommand == ECamCmdCaptureSetupImageSharpnessStill ) |
|
1535 { |
|
1536 // These commands imply a container switch. |
|
1537 // iItemAccessedViaAP must be set so that softkeys work correctly. |
|
1538 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
1539 appUi->APHandler()->iItemAccessedViaAP = ETrue; |
|
1540 iController.DeepSleepTimerStart(); |
|
1541 } |
|
1542 } |
|
1543 |
|
1544 |
|
1545 // --------------------------------------------------------------------------- |
|
1546 // CCamPreCaptureViewBase::SetIconL |
|
1547 // --------------------------------------------------------------------------- |
|
1548 // |
|
1549 void CCamPreCaptureViewBase::SetIconL( |
|
1550 CAknButton* aButton, |
|
1551 const TDesC& aIconFilename, |
|
1552 TInt aIconId, |
|
1553 TInt aMaskId, |
|
1554 MAknsSkinInstance* aSkinInstance, |
|
1555 const TAknsItemID& aSkinItemId ) |
|
1556 { |
|
1557 CGulIcon* icon = AknsUtils::CreateGulIconL( |
|
1558 aSkinInstance, |
|
1559 aSkinItemId, |
|
1560 aIconFilename, |
|
1561 aIconId, |
|
1562 aMaskId ); |
|
1563 icon->SetBitmapsOwnedExternally( EFalse ); // CGulIcon owns bitmaps |
|
1564 CAknButtonState* state = aButton->State( 0 ); |
|
1565 if ( state ) |
|
1566 { |
|
1567 state->SetIcon( icon ); |
|
1568 icon = NULL; |
|
1569 } |
|
1570 else |
|
1571 { |
|
1572 delete icon; |
|
1573 icon = NULL; |
|
1574 } |
|
1575 |
|
1576 } |
|
1577 |
|
1578 // --------------------------------------------------------------------------- |
|
1579 // CCamPreCaptureViewBase::HandleAppEvent <<virtual>> |
|
1580 // |
|
1581 // --------------------------------------------------------------------------- |
|
1582 // |
|
1583 void |
|
1584 CCamPreCaptureViewBase::HandleAppEvent( const TCamAppEvent& aEvent ) |
|
1585 { |
|
1586 PRINT1( _L("Camera => CCamPreCaptureViewBase::HandleAppEvent, event:%d"), aEvent ); |
|
1587 CCamViewBase::HandleAppEvent( aEvent ); |
|
1588 |
|
1589 if ( aEvent == ECamAppEventFocusGained && iController.InVideocallOrRinging() ) |
|
1590 { |
|
1591 TRAP_IGNORE( BlankSoftkeysL() ); |
|
1592 if ( iController.IsTouchScreenSupported() ) |
|
1593 { |
|
1594 CAknToolbar* toolbar = Toolbar(); |
|
1595 if ( toolbar ) |
|
1596 { |
|
1597 toolbar->SetToolbarVisibility( EFalse ); |
|
1598 } |
|
1599 } |
|
1600 } |
|
1601 |
|
1602 if ( aEvent == ECamAppEventFocusGained ) |
|
1603 { |
|
1604 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() && |
|
1605 iController.CameraSwitchQueued() ) // fake exit done |
|
1606 { |
|
1607 iController.CheckSlideStatus(); // Do we still need to change cam? |
|
1608 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
1609 // How about portrait/landscape 2nd camera? |
|
1610 if ( !iController.CameraSwitchQueued() && |
|
1611 appUi->IsSecondCameraEnabled() ) |
|
1612 { |
|
1613 TBool landscape2ndCam = appUi->IsQwerty2ndCamera( ETrue ); |
|
1614 if( appUi->CamOrientation() != ECamOrientationPortrait ) |
|
1615 { |
|
1616 if ( !landscape2ndCam ) |
|
1617 { |
|
1618 PRINT( _L("Camera => CCamPreCaptureViewBase::HandleAppEvent, change to portrait 2nd cam.")); |
|
1619 iController.SetCameraSwitchRequired( |
|
1620 ESwitchSecondaryOrientation ); |
|
1621 } |
|
1622 } |
|
1623 else |
|
1624 { |
|
1625 if ( landscape2ndCam ) |
|
1626 { |
|
1627 PRINT( _L("Camera => CCamPreCaptureViewBase::HandleAppEvent, change to landscape 2nd cam.")); |
|
1628 iController.SetCameraSwitchRequired( |
|
1629 ESwitchSecondaryOrientation ); |
|
1630 } |
|
1631 } |
|
1632 } |
|
1633 } |
|
1634 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() && |
|
1635 iController.ActiveCamera() == ECamActiveCameraPrimary ) |
|
1636 { |
|
1637 if ( iController.CameraSwitchQueued() ) |
|
1638 { |
|
1639 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
1640 // If camera switch fails, main camera is used instead |
|
1641 TRAP_IGNORE( appUi->HandleCommandL( ECamCmdSwitchCamera ) ); |
|
1642 } |
|
1643 } |
|
1644 } |
|
1645 |
|
1646 PRINT( _L("Camera <= CCamPreCaptureViewBase::HandleAppEvent") ); |
|
1647 } |
|
1648 |
|
1649 // --------------------------------------------------------------------------- |
|
1650 // SetupActivePaletteL |
|
1651 // |
|
1652 // Helper method to set up the Active Palette. |
|
1653 // If needed, a new instance of AP is created. |
|
1654 // Otherwise the existing AP items are cleared. |
|
1655 // New AP items are setup with resource from GetAPResourceId. |
|
1656 // --------------------------------------------------------------------------- |
|
1657 // |
|
1658 void CCamPreCaptureViewBase::SetupActivePaletteL() |
|
1659 { |
|
1660 if( iContainer && !iController.IsTouchScreenSupported() ) |
|
1661 { |
|
1662 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
1663 TCamOrientation orientation = appUi->CamOrientation(); |
|
1664 |
|
1665 if( ECamOrientationCamcorder == orientation |
|
1666 || ECamOrientationCamcorderLeft == orientation |
|
1667 || ECamOrientationPortrait == orientation ) |
|
1668 { |
|
1669 // Creates Active Palette, sets items and sets view. |
|
1670 // Only AP2 supported. |
|
1671 static_cast<CCamPreCaptureContainerBase*>( iContainer ) |
|
1672 ->SetupActivePaletteL( this ); |
|
1673 } |
|
1674 else |
|
1675 { |
|
1676 // No AP |
|
1677 } |
|
1678 } |
|
1679 } |
|
1680 |
|
1681 // --------------------------------------------------------------------------- |
|
1682 // CCamPreCaptureViewBase::ToolbarButtonById |
|
1683 // |
|
1684 // --------------------------------------------------------------------------- |
|
1685 // |
|
1686 CAknButton* CCamPreCaptureViewBase::ToolbarButtonById(const TCamCmd aCommandId) const |
|
1687 { |
|
1688 CAknButton* button = NULL; |
|
1689 if(iController.IsTouchScreenSupported()) |
|
1690 { |
|
1691 CAknToolbar* toolbar = Toolbar(); |
|
1692 if(toolbar) |
|
1693 { |
|
1694 button = static_cast<CAknButton*> |
|
1695 (toolbar->ControlOrNull(aCommandId)); |
|
1696 if(NULL == button) |
|
1697 { |
|
1698 CAknToolbarExtension* extension = toolbar->ToolbarExtension(); |
|
1699 if(extension) |
|
1700 { |
|
1701 button = static_cast<CAknButton*> |
|
1702 (extension->ControlOrNull(aCommandId)); |
|
1703 } |
|
1704 } |
|
1705 } |
|
1706 } |
|
1707 return button; |
|
1708 } |
|
1709 |
|
1710 // --------------------------------------------------------------------------- |
|
1711 // CCamPreCaptureViewBase::HideButton |
|
1712 // |
|
1713 // --------------------------------------------------------------------------- |
|
1714 // |
|
1715 void CCamPreCaptureViewBase::HideButton(const TCamCmd aCommandId) |
|
1716 { |
|
1717 if(iController.IsTouchScreenSupported()) |
|
1718 { |
|
1719 CAknToolbar* toolbar = Toolbar(); |
|
1720 if(toolbar) |
|
1721 { |
|
1722 if(toolbar->ControlOrNull(aCommandId)) |
|
1723 { |
|
1724 toolbar->HideItem(aCommandId,ETrue,ETrue); |
|
1725 } |
|
1726 else if( toolbar->ToolbarExtension() && |
|
1727 toolbar->ToolbarExtension()->ControlOrNull(aCommandId)) |
|
1728 { |
|
1729 TRAP_IGNORE(toolbar->ToolbarExtension()->HideItemL(aCommandId,ETrue)); |
|
1730 } |
|
1731 else |
|
1732 { |
|
1733 //Do Nothing |
|
1734 } |
|
1735 } |
|
1736 } |
|
1737 } |
|
1738 |
|
1739 // --------------------------------------------------------------------------- |
|
1740 // CCamPreCaptureViewBase::RedrawToolBar |
|
1741 // |
|
1742 // --------------------------------------------------------------------------- |
|
1743 // |
|
1744 void CCamPreCaptureViewBase::RedrawToolBar() |
|
1745 { |
|
1746 CEikonEnv::Static()->WsSession().ClearAllRedrawStores(); |
|
1747 } |
|
1748 // End of File |