|
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: App UI class for cameraapp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // This needs to be included first, because other include files |
|
20 // may be variated using these flags. |
|
21 #include <avkon.hrh> |
|
22 #include <barsread.h> // TResourceReader |
|
23 #include <StringLoader.h> |
|
24 #include <sysutil.h> |
|
25 #include <eikenv.h> |
|
26 #include <hlplch.h> |
|
27 #include <apgwgnam.h> |
|
28 #include <apgcli.h> |
|
29 #include <DocumentHandler.h> |
|
30 #include <apmstd.h> |
|
31 #include <textresolver.h> |
|
32 #include <aknnotewrappers.h> |
|
33 #include <akntitle.h> // CAknTitlePane |
|
34 #include <aknclearer.h> |
|
35 #include <aknnavide.h> |
|
36 #include <AknWaitDialog.h> |
|
37 #include <aknstaticnotedialog.h> |
|
38 #include <AknCapServerDefs.h> |
|
39 #include <akntoolbar.h> |
|
40 #include <aknstyluspopupmenu.h> |
|
41 #include <aknlayoutscalable_apps.cdl.h> |
|
42 #include <akntoolbarextension.h> |
|
43 #include <eiksoftkeypostingtransparency.h> |
|
44 #include <centralrepository.h> |
|
45 #include <AknSgcc.h> |
|
46 #include <cameraapp.rsg> |
|
47 #include <vgacamsettings.rsg> |
|
48 #include <activepalette2ui.h> |
|
49 #include <AknGlobalNote.h> |
|
50 #include <hal.h> |
|
51 #include <hal_data.h> |
|
52 #include <oommonitorsession.h> |
|
53 #include <driveinfo.h> |
|
54 #include <pathinfo.h> |
|
55 |
|
56 #ifndef __WINSCW__ |
|
57 //#include <SFIUtilsAppInterface.h> |
|
58 #endif |
|
59 |
|
60 #include <musresourceproperties.h> |
|
61 #include <cameraplatpskeys.h> |
|
62 |
|
63 #include <AknCommonDialogsDynMem.h> |
|
64 #include <CAknMemorySelectionDialogMultiDrive.h> |
|
65 |
|
66 #include "CameraappPrivateCRKeys.h" |
|
67 #include "CamAppUi.h" |
|
68 #include "CamUtility.h" |
|
69 #include "CamAppController.h" |
|
70 #include "CamControllerObservers.h" |
|
71 #include "CamTimer.h" |
|
72 #include "CamLogger.h" |
|
73 #include "CamStillPreCaptureView.h" |
|
74 #include "CamStillPostCaptureView.h" |
|
75 #include "CamVideoPreCaptureView.h" |
|
76 #include "CamVideoPostCaptureView.h" |
|
77 #include "CamBurstThumbnailView.h" |
|
78 #include "CamSelfTimer.h" |
|
79 #include "CamPanic.h" |
|
80 #include "CamBurstModeObserver.h" |
|
81 #include "CamStillUserSceneSetupView.h" |
|
82 #include "CamNaviCounterControl.h" |
|
83 #include "CamNaviCounterModel.h" |
|
84 #include "CamNaviProgressBarControl.h" |
|
85 #include "Cam.hrh" |
|
86 #include "CamSettings.hrh" |
|
87 #include "CamProductSpecificSettings.hrh" |
|
88 #include "CamAppUiBase.h" |
|
89 #include "CamWaitDialog.h" |
|
90 #include "CamSidePane.h" |
|
91 #include "CamZoomPane.h" |
|
92 #include "CamAppUid.h" |
|
93 #include <csxhelp/lcam.hlp.hrh> |
|
94 #include "CameraVariant.hrh" |
|
95 #include "OstTraceDefinitions.h" |
|
96 #ifdef OST_TRACE_COMPILER_IN_USE |
|
97 #include "CamAppUiTraces.h" |
|
98 #endif |
|
99 #include "camactivepalettehandler.h" |
|
100 #include "CamContainerBase.h" |
|
101 #include "camuidconstants.h" |
|
102 #include "CamGSInterface.h" |
|
103 #include "CamFileCheckAo.h" |
|
104 #include "CamLocalViewIds.h" |
|
105 #include "CameraUiConfigManager.h" |
|
106 |
|
107 #include "MCamAddToAlbumObserver.h" |
|
108 #include "CamCollectionManagerAo.h" |
|
109 #include "glxgallery.hrh" |
|
110 #include "glxcollectionplugincamera.hrh" |
|
111 #include "s32mem.h" |
|
112 |
|
113 |
|
114 #include "camflashstatus.h" |
|
115 #include "CamMemoryMonitor.h" |
|
116 |
|
117 |
|
118 |
|
119 // =========================================================================== |
|
120 // Constants |
|
121 |
|
122 // Sequence mode related constants that define the amount of pictures taken |
|
123 // with sequence mode. |
|
124 const TInt KShortBurstCount = 18; // number of images captured during burst |
|
125 |
|
126 // When asked if current memory is full in video mode |
|
127 // there needs to be at least following amount of recording |
|
128 // time left or memory is said to be full. |
|
129 const TTimeIntervalMicroSeconds KMemoryFullVideoRemaining = 1000*1000; |
|
130 |
|
131 // This is used to find the window group id for Eikon Server. |
|
132 // The Eikon Server window group id is later used to ignore all window server |
|
133 // events saying Eikon Server has gained focus. |
|
134 _LIT( KEikonServer, "EikonServer" ); |
|
135 |
|
136 //const TCamMediaStorage KCamInternalStorage = ECamMediaStoragePhone; |
|
137 |
|
138 const TUint KCameraEventInterest = ( ECamCameraEventClassBasicControl |
|
139 | ECamCameraEventClassImage |
|
140 | ECamCameraEventClassVideo |
|
141 | ECamCameraEventClassVfControl |
|
142 | ECamCameraEventClassSsControl |
|
143 | ECamCameraEventClassSettings ); |
|
144 |
|
145 |
|
146 |
|
147 // =========================================================================== |
|
148 // Member functions |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CCamAppUi::~CCamAppUi |
|
152 // Destructor |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 CCamAppUi::~CCamAppUi() |
|
156 { |
|
157 PRINT( _L("Camera => ~CCamAppUi" )) |
|
158 if ( iMemoryMonitor ) |
|
159 { |
|
160 iMemoryMonitor->StopMonitoring(); |
|
161 delete iMemoryMonitor; |
|
162 iMemoryMonitor = 0; |
|
163 } |
|
164 |
|
165 iController.SetAppUiAvailable( EFalse ); |
|
166 |
|
167 iResourceLoaders.Close(); |
|
168 |
|
169 #ifdef CAMERAAPP_DELAYED_POSTCAPTURE_CREATION |
|
170 if( iPostCapIdle ) |
|
171 { |
|
172 iPostCapIdle->Cancel(); |
|
173 delete iPostCapIdle; |
|
174 } |
|
175 #endif |
|
176 |
|
177 if ( iFileCheckAo ) |
|
178 { |
|
179 iFileCheckAo->Cancel(); |
|
180 delete iFileCheckAo; |
|
181 } |
|
182 |
|
183 if ( iController.UiConfigManagerPtr()->IsOrientationSensorSupported() && |
|
184 iSensorIdle ) |
|
185 { |
|
186 CancelSensorIdle(); |
|
187 delete iSensorIdle; |
|
188 } |
|
189 |
|
190 #if !defined(__WINSCW__) |
|
191 // relinquish capture keys |
|
192 UnRegisterCaptureKeys(); |
|
193 #endif |
|
194 |
|
195 SaveCaptureMode(); |
|
196 SaveCourtesyUiState(); |
|
197 |
|
198 delete iDecoratedNaviPaneCounter; |
|
199 delete iDecoratedNaviPaneProgressBar; |
|
200 #if defined( CAMERAAPP_CAPI_V2_DVF ) |
|
201 if ( iSelfTimer ) |
|
202 { |
|
203 iSelfTimer->RemoveObserver( this ); |
|
204 } |
|
205 #endif // CAMERAAPP_CAPI_V2_DVF |
|
206 delete iSelfTimer; |
|
207 delete iParentAppName; |
|
208 delete iTextResolver; |
|
209 |
|
210 iController.RemoveControllerObserver( this ); |
|
211 |
|
212 // Burst mode observers are not owned, delete only the pointers to them. |
|
213 iBurstModeObservers.Close(); |
|
214 |
|
215 if ( iWaitTimer && iWaitTimer->IsActive() ) |
|
216 { |
|
217 iWaitTimer->Cancel(); |
|
218 } |
|
219 delete iWaitTimer; |
|
220 delete iDocHandler; |
|
221 delete iCamSidePane; |
|
222 delete iCamZoomPane; |
|
223 |
|
224 delete iRepository; |
|
225 |
|
226 /*#ifndef __WINSCW__ |
|
227 delete iSFIUtils; |
|
228 #endif*/ |
|
229 |
|
230 delete iNaviCounterControl; |
|
231 delete iNaviProgressBarControl; |
|
232 delete iNaviCounterModel; |
|
233 delete iNaviProgressBarModel; |
|
234 delete iActivePaletteHandler; |
|
235 iActivePaletteHandler = NULL; |
|
236 |
|
237 if( iCourtesyTimer ) |
|
238 { |
|
239 iCourtesyTimer->Cancel(); |
|
240 } |
|
241 delete iCourtesyTimer; |
|
242 delete iScreenClearer; |
|
243 delete iVolumeKeyObserver; |
|
244 |
|
245 delete iCollectionManager; |
|
246 iCollectionManager = NULL; |
|
247 |
|
248 PRINT( _L("Camera <= ~CCamAppUi" )) |
|
249 } |
|
250 |
|
251 // ----------------------------------------------------------------------------- |
|
252 // CCamAppUi::ConstructL |
|
253 // Symbian 2nd phase constructor can leave. |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 void CCamAppUi::ConstructL() |
|
257 { |
|
258 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP2_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 1" ); |
|
259 PRINT( _L("Camera => CCamAppUi::ConstructL") ) |
|
260 iRotatedKeyEvent = ETrue; |
|
261 iReturnedFromPlugin = EFalse; |
|
262 iController.SetAppUiAvailable( ETrue ); |
|
263 |
|
264 iLockedQwertyState = E2ndCamUnknown; |
|
265 iMemoryMonitor = CCamMemoryMonitor::NewL( this, &iController ); |
|
266 |
|
267 TInt memError = |
|
268 iMemoryMonitor->CheckAndRequestMemoryL( iController.UiConfigManagerPtr()->CriticalLevelRamMemory(), |
|
269 iController.UiConfigManagerPtr()->RequiredRamMemory(), |
|
270 ETrue ); |
|
271 |
|
272 |
|
273 TInt freeMemory = 0; |
|
274 HAL::Get( HALData::EMemoryRAMFree, freeMemory ); |
|
275 if ( memError && freeMemory < iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained() ) |
|
276 { |
|
277 User::Leave( memError ); |
|
278 } |
|
279 iUiConstructionComplete = EFalse; |
|
280 iDSASupported = iController.UiConfigManagerPtr()->IsDSAViewFinderSupported(); |
|
281 |
|
282 TBool uiOrientationOverride = iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported(); |
|
283 |
|
284 // The embedded views are set after ConstructL completes |
|
285 // but the value is only of interest if the app is embedded |
|
286 iEmbeddedViewSet = !IsEmbedded(); |
|
287 PRINT1( _L("Camera => CCamAppUi::ConstructL iEmbeddedViewSet:%d"), iEmbeddedViewSet ); |
|
288 |
|
289 // In embedded case requesting new file without defined resolution |
|
290 // the 0*0 is interpreted as the default mms size resolution |
|
291 iRequestedNewFileResolution.SetSize( 0, 0 ); |
|
292 |
|
293 // Camera window group id |
|
294 iMyWgId = iCoeEnv->RootWin().Identifier(); |
|
295 |
|
296 // Get the id of Eikon Server window group |
|
297 iEikonServerWindowGroupId = iCoeEnv->WsSession().FindWindowGroupIdentifier( |
|
298 0, |
|
299 KEikonServer ); |
|
300 |
|
301 CApaWindowGroupName::FindByAppUid( |
|
302 KBtNotifierServerUid, |
|
303 iCoeEnv->WsSession(), |
|
304 iBTServerWindowGroupId); |
|
305 |
|
306 CApaWindowGroupName::FindByAppUid( |
|
307 KPhoneAppUid, |
|
308 iCoeEnv->WsSession(), |
|
309 iPhoneAppWindowGroupId); |
|
310 |
|
311 PRINT( _L("Camera <> create new repository") ); |
|
312 TInt crValue = 0; |
|
313 if( !iRepository ) |
|
314 { |
|
315 iRepository = CRepository::NewL( KCRUidCameraappSettings ); |
|
316 } |
|
317 |
|
318 // get softkey position |
|
319 CamUtility::GetPsiInt( ECamPsiSoftKeyPosition, iSoftkeyPosition ); |
|
320 |
|
321 iCamOrientation = ReadCurrentDeviceOrientation(); |
|
322 PRINT1( _L("Camera <> CurrentDeviceOrientation (%d)"), iCamOrientation ) |
|
323 PERF_EVENT_START_L2( EPerfEventAvkonUIConstruction ); |
|
324 TInt orientation; |
|
325 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() ) |
|
326 { |
|
327 PRINT( _L("Camera <> using slider position to set orientation") ); |
|
328 // Use the current slider position for the required orientation |
|
329 TInt sliderPosition; |
|
330 TInt err = RProperty::Get( |
|
331 CameraPlatPSKeys::KPSCameraPlatUid, |
|
332 CameraPlatPSKeys::KLensCoverStatus, |
|
333 sliderPosition ); |
|
334 |
|
335 // ToDo this could be removed after PCFW has released new implementation (wk25/2009) |
|
336 if( err == KErrNotFound ) |
|
337 { |
|
338 PRINT( _L("Camera <> using slider position to set orientation") ); |
|
339 err = RProperty::Get( |
|
340 NMusResourceApi::KCategoryUid, |
|
341 NMusResourceApi::KCameraAvailability, |
|
342 sliderPosition ); |
|
343 } |
|
344 PRINT2( _L("Camera <> slider position = %d, error = %d"), |
|
345 sliderPosition, err ); |
|
346 |
|
347 // If there is an error then assume the slider is closed (as long as there is |
|
348 // more than one camera) |
|
349 if ( err ) |
|
350 { |
|
351 PRINT1( _L("Camera <> Slider status err%d - Check status later"),err ) |
|
352 iController.SetCameraSwitchRequired( ESwitchToUnknown ); |
|
353 } |
|
354 if ( ( ( CCamAppController::CamerasAvailable() > 1 && |
|
355 sliderPosition == CameraPlatPSKeys::EClosed ) || |
|
356 err != KErrNone ) && !IsQwerty2ndCamera( ETrue ) ) |
|
357 { |
|
358 PRINT( _L("Camera <> setting orientation for secondary camera") ) |
|
359 CamUtility::GetPsiInt( ECamPsiSecondaryCameraOrientation, orientation ); |
|
360 } |
|
361 else |
|
362 { |
|
363 PRINT( _L("Camera <> setting orientation for primary camera") ) |
|
364 CamUtility::GetPsiInt( ECamPsiPrimaryCameraOrientation, orientation ); |
|
365 } |
|
366 } |
|
367 else |
|
368 { |
|
369 // Without lens cover support, always start to primary camera |
|
370 CamUtility::GetPsiInt( ECamPsiPrimaryCameraOrientation, orientation ); |
|
371 } |
|
372 |
|
373 // Finish engine construction |
|
374 if( uiOrientationOverride ) |
|
375 { |
|
376 iController.CompleteConstructionL(); |
|
377 } |
|
378 |
|
379 if ( orientation == ( TInt ) EAppUiOrientationLandscape ) |
|
380 { |
|
381 PRINT( _L("Camera <> orientation is landscape ") ) |
|
382 iCamOrientation = (ECamHandLeft == iSoftkeyPosition ) |
|
383 ? ECamOrientationCamcorderLeft |
|
384 : ECamOrientationCamcorder; |
|
385 if( uiOrientationOverride ) |
|
386 { |
|
387 //set orientation to CCamera |
|
388 iController.SetCameraOrientationModeL( CFbsBitGc::EGraphicsOrientationRotated90 ); |
|
389 // and complete the cameracontroller construction |
|
390 iController.CompleteCameraConstructionL(); |
|
391 } |
|
392 PRINT( _L("Camera <> Calling BaseConstructL") ) |
|
393 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 1" ); //CCORAPP_APP_BASE_CONSTRUCT_START |
|
394 BaseConstructL( EAppOrientationLandscape | EAknEnableSkin | EAknEnableMSK | |
|
395 ENonStandardResourceFile | EAknSingleClickCompatible ); |
|
396 OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 0" ); //CCORAPP_APP_BASE_CONSTRUCT_END |
|
397 PRINT( _L("Camera <> BaseConstructL Complete") ) |
|
398 } |
|
399 else |
|
400 { |
|
401 PRINT( _L("Camera <> orientation is portrait") ) |
|
402 iCamOrientation = ECamOrientationPortrait; |
|
403 if( uiOrientationOverride ) |
|
404 { |
|
405 //set orientation to CCamera |
|
406 iController.SetCameraOrientationModeL( CFbsBitGc::EGraphicsOrientationRotated270 ); |
|
407 // and complete the cameracontroller construction |
|
408 iController.CompleteCameraConstructionL(); |
|
409 } |
|
410 PRINT( _L("Camera <> Calling BaseConstructL") ) |
|
411 OstTrace0( CAMERAAPP_PERFORMANCE, DUP4_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 1" ); |
|
412 BaseConstructL( EAppOrientationPortrait | EAknEnableSkin | EAknEnableMSK | |
|
413 ENonStandardResourceFile ); |
|
414 OstTrace0( CAMERAAPP_PERFORMANCE, DUP5_CCAMAPPUI_CONSTRUCTL, "e_CAM_APP_BASE_CONSTRUCT 0" ); |
|
415 PRINT( _L("Camera <> BaseConstructL Complete") ) |
|
416 } |
|
417 |
|
418 PERF_EVENT_END_L2( EPerfEventAvkonUIConstruction ); |
|
419 |
|
420 #if !defined (__WINSCW__) |
|
421 #if !( defined(__WINS__) || defined(__WINSCW__) ) |
|
422 // Ensure that the macro switch keys are always captured by this |
|
423 // application. |
|
424 if ( !AppInBackground( EFalse ) ) //camera is constructed in background |
|
425 { |
|
426 RegisterCaptureKeysL(); |
|
427 } |
|
428 #endif // !defined(__WINS__) || defined(__WINSCW__) |
|
429 #endif |
|
430 |
|
431 if( !uiOrientationOverride ) |
|
432 { |
|
433 // Load the settings model static settings |
|
434 PRINT( _L("Camera <> call CCamAppController::LoadStaticSettingsL..") ) |
|
435 iController.LoadStaticSettingsL( IsEmbedded() ); |
|
436 |
|
437 // Check the screen size if it matches the orientation we expect. |
|
438 // If not, delay the initialization until HandleScreenDeviceChangedL is called. |
|
439 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP6_CCAMAPPUI_CONSTRUCTL, "e_ReadUiOrientationFromWindowServer 1" ); |
|
440 TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels(); |
|
441 PRINT2( _L("<> CCamAppUi::ConstructL() iCoeEnv->ScreenDevice()->SizeInPixels(): w=%d h=%d"), screenSize.iWidth, screenSize.iHeight ); |
|
442 TBool expectLandscape = (iCamOrientation != ECamOrientationPortrait); |
|
443 TBool isLandscape = (screenSize.iWidth > screenSize.iHeight); |
|
444 if( isLandscape != expectLandscape || AppInBackground( EFalse ) ) //screen is not ready or camera app is in background |
|
445 { |
|
446 iEngineConstructionDelayed = ETrue; |
|
447 } |
|
448 |
|
449 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP7_CCAMAPPUI_CONSTRUCTL, "e_ReadUiOrientationFromWindowServer 0" ); |
|
450 |
|
451 // initialise the self timer mode |
|
452 iInSelfTimerMode = ECamSelfTimerDisabled; |
|
453 |
|
454 if ( !iEngineConstructionDelayed ) |
|
455 { |
|
456 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP8_CCAMAPPUI_CONSTRUCTL, "e_EngineConstructionDelayed 1" ); |
|
457 iController.CompleteConstructionL(); |
|
458 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP9_CCAMAPPUI_CONSTRUCTL, "e_EngineConstructionDelayed 0" ); |
|
459 |
|
460 } |
|
461 } |
|
462 else |
|
463 { |
|
464 iEngineConstructionDelayed = EFalse; |
|
465 iInSelfTimerMode = ECamSelfTimerDisabled; |
|
466 } |
|
467 |
|
468 |
|
469 iEmbeddedObserver = NULL; |
|
470 |
|
471 iController.AddControllerObserverL( this ); |
|
472 iController.AddCameraObserverL( this, KCameraEventInterest ); |
|
473 |
|
474 if( !uiOrientationOverride ) |
|
475 { |
|
476 /*#ifndef __WINSCW__ |
|
477 // Initialize SFIUtils |
|
478 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP10_CCAMAPPUI_CONSTRUCTL, "e_InitSendFileInCall 1" ); |
|
479 PRINT(_L("iSFIUtils = CSFIUtilsAppInterface::NewL -->")); |
|
480 TRAPD(errSFI,iSFIUtils = CSFIUtilsAppInterface::NewL()); |
|
481 PRINT1(_L("iSFIUtils = CSFIUtilsAppInterface::NewL <-- errSFI=%d"),errSFI); |
|
482 User::LeaveIfError(errSFI); |
|
483 iSendFileInCall = EFalse; |
|
484 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP11_CCAMAPPUI_CONSTRUCTL, "e_InitSendFileInCall 0" ); |
|
485 PRINT( _L("iSendFileInCall = EFalse") ); |
|
486 #endif*/ |
|
487 |
|
488 // Create text resolver for error note text |
|
489 iTextResolver = CTextResolver::NewL(); |
|
490 |
|
491 ConstructPreCaptureViewsL(); |
|
492 |
|
493 iSelfTimer = CCamSelfTimer::NewL( iController ); |
|
494 #if defined( CAMERAAPP_CAPI_V2_DVF ) |
|
495 iSelfTimer->AddObserverL( this ); |
|
496 #endif // CAMERAAPP_CAPI_V2_DVF |
|
497 |
|
498 PRINT( _L("Camera <> creating navicounter model") ); |
|
499 iNaviCounterModel = CCamNaviCounterModel::NewL( iController ); |
|
500 PRINT( _L("Camera <> append navicounter to resourceloaders") ); |
|
501 User::LeaveIfError( iResourceLoaders.Append(iNaviCounterModel) ); |
|
502 |
|
503 PRINT( _L("Camera <> creating progress bar model") ); |
|
504 iNaviProgressBarModel = CCamNaviProgressBarModel::NewL( iController ); |
|
505 PRINT( _L("Camera <> append progressbar to resourceloaders") ); |
|
506 User::LeaveIfError(iResourceLoaders.Append(iNaviProgressBarModel)); |
|
507 |
|
508 ConstructNaviPaneL(); |
|
509 } |
|
510 |
|
511 |
|
512 iRepository->Get( KCamCrAlwaysDrawCourtesyUi, crValue ); |
|
513 iAlwaysDrawPreCaptureCourtesyUI = (crValue == KCamCrAlwaysDrawCourtesyUiIsOn); |
|
514 |
|
515 iCoeEnv->RootWin().EnableScreenChangeEvents(); |
|
516 |
|
517 |
|
518 if( uiOrientationOverride ) |
|
519 { |
|
520 // always start in still mode |
|
521 iMode = ECamControllerImage; |
|
522 iTargetMode = ECamControllerImage; |
|
523 } |
|
524 else |
|
525 { |
|
526 // If the view launch needs to wait until the engine |
|
527 // is constructed or the embedded launch view is set, the starting |
|
528 // state will be standby |
|
529 if ( !IsConstructionComplete() ) |
|
530 { |
|
531 iViewState = ECamViewStateStandby; |
|
532 } |
|
533 |
|
534 // Get start up mode from settings. |
|
535 // If the application is embedded the new view will be set |
|
536 // when HandleNewFileL is called by the framework |
|
537 PRINT( _L("Camera <> CCamAppUi::ConstructL set default view") ); |
|
538 if ( StartupMode() == ECamStillCapture ) |
|
539 { |
|
540 iMode = ECamControllerImage; |
|
541 iTargetMode = ECamControllerImage; |
|
542 SetDefaultViewL( *iStillCaptureView ); |
|
543 } |
|
544 else |
|
545 { |
|
546 iMode = ECamControllerVideo; |
|
547 iTargetMode = ECamControllerVideo; |
|
548 SetDefaultViewL( *iVideoCaptureView ); |
|
549 } |
|
550 |
|
551 |
|
552 if( !iEngineConstructionDelayed ) |
|
553 { |
|
554 // pre-construct side-pane & zoom pane |
|
555 // get whether we overlay sidepane over view-finder |
|
556 TBool overlayViewFinder; |
|
557 User::LeaveIfError( CamUtility::GetPsiInt( ECamPsiOverLaySidePane, overlayViewFinder ) ); |
|
558 PRINT( _L("Camera <> CCamAppUi::ConstructL create sidepane") ); |
|
559 iCamSidePane = CCamSidePane::NewL( iController, overlayViewFinder ); |
|
560 User::LeaveIfError(iResourceLoaders.Append(iCamSidePane)); |
|
561 |
|
562 PRINT( _L("Camera <> CCamAppUi::ConstructL create zoom pane") ); |
|
563 iCamZoomPane = CCamZoomPane::NewL( iController, overlayViewFinder ); |
|
564 User::LeaveIfError(iResourceLoaders.Append(iCamZoomPane)); |
|
565 } |
|
566 } |
|
567 // create the timer used for callbacks |
|
568 iWaitTimer = CPeriodic::NewL( CActive::EPriorityHigh ); |
|
569 |
|
570 |
|
571 // initialise the view construction states |
|
572 iPostCaptureViewsConstructed = EFalse; |
|
573 iUserSceneSetupViewConstructed = EFalse; |
|
574 iCustomiseToolbarViewConstructed = EFalse; |
|
575 |
|
576 if( !uiOrientationOverride ) |
|
577 { |
|
578 PRINT( _L("Camera => CCamAppUi::ConstructL create doc handler") ); |
|
579 iDocHandler = CDocumentHandler::NewL( CEikonEnv::Static()->Process() ); |
|
580 iController.CheckMemoryToUseL(); |
|
581 |
|
582 // create navi-pane and navi-porgress bar for use in camcorder mode |
|
583 PRINT( _L("Camera => CCamAppUi::ConstructL create navicounter control") ); |
|
584 iNaviCounterControl = CCamNaviCounterControl::NewL( *iNaviCounterModel ); |
|
585 iNaviCounterControl->SetExtentToWholeScreen(); |
|
586 |
|
587 PRINT( _L("Camera => CCamAppUi::ConstructL create progress bar control") ); |
|
588 iNaviProgressBarControl = CCamNaviProgressBarControl::NewL( *iNaviProgressBarModel ); |
|
589 |
|
590 // get max num of images for burst capture |
|
591 CamUtility::GetPsiInt( ECamPsiMaxBurstCapture, iMaxBurstCaptureNum ); |
|
592 |
|
593 PRINT( _L("Camera => CCamAppUi::ConstructL create AP handler") ); |
|
594 iActivePaletteHandler = CCamActivePaletteHandler::NewL( iController, EFalse ); |
|
595 } |
|
596 |
|
597 iDrawPreCaptureCourtesyUI = ETrue; |
|
598 iDrawPostCaptureCourtesyUI = ETrue; |
|
599 iAlwaysDrawPostCaptureCourtesyUI = ETrue; |
|
600 iLeftSoftKeyPressed = EFalse; |
|
601 if( !uiOrientationOverride ) |
|
602 { |
|
603 // get coutesy UI timeout |
|
604 TInt timeoutValue; |
|
605 CamUtility::GetPsiInt( ECamPsiCourtesyUiTimeoutValue, timeoutValue ); |
|
606 |
|
607 iCourtesyTimer = CCamTimer::NewL( timeoutValue * 1000000, |
|
608 TCallBack( CCamAppUi::CourtesyTimeout, this ) ); |
|
609 |
|
610 PRINT( _L("Camera => CCamAppUi::ConstructL update navi models") ); |
|
611 UpdateNaviModelsL(); |
|
612 PRINT( _L("Camera => CCamAppUi::ConstructL navi counter reload resources") ); |
|
613 iNaviCounterModel->ReloadResourceDataL(); |
|
614 PRINT( _L("Camera => CCamAppUi::ConstructL navi progress bar reload resources") ); |
|
615 iNaviProgressBarModel->ReloadResourceDataL(); |
|
616 } |
|
617 |
|
618 iZoomPaneShown = EFalse; |
|
619 iFirstBoot = ETrue; // Show zoom |
|
620 iProcessingScreenRedraw = EFalse; |
|
621 iSendAsInProgress = EFalse; |
|
622 |
|
623 if( !uiOrientationOverride ) |
|
624 { |
|
625 iFileCheckAo = CCamFileCheckAo::NewL( iController, *this ); |
|
626 iCollectionManager = new (ELeave) CCamCollectionManagerAO( *this ); |
|
627 } |
|
628 |
|
629 iCheckOperationInProgress = EFalse; |
|
630 iLostFocusToNewWindow = EFalse; |
|
631 iFirstVFStart = ETrue; |
|
632 |
|
633 iInternalStorage = iController.ExistMassStorage()?ECamMediaStorageMassStorage:ECamMediaStoragePhone; |
|
634 |
|
635 if ( !uiOrientationOverride ) |
|
636 { |
|
637 iUiConstructionComplete = ETrue; |
|
638 } |
|
639 iMemoryMonitor->StartMonitoring( iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained(), |
|
640 iController.UiConfigManagerPtr()->RequiredRamMemoryFocusGained() ); |
|
641 PRINT( _L("Camera <= CCamAppUi::ConstructL") ) |
|
642 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" ); |
|
643 } |
|
644 |
|
645 |
|
646 |
|
647 // ----------------------------------------------------------------------------- |
|
648 // IsInternalView |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 TBool CCamAppUi::IsInternalView( TCamViewState aViewState ) const |
|
652 { |
|
653 PRINT1( _L("Camera => CCamAppUi::IsInternalView [%s]"), KCamViewStateNames[aViewState] ); |
|
654 |
|
655 TBool internal( EFalse ); |
|
656 |
|
657 if ( aViewState < ECamViewStateRangeInternalMax |
|
658 && aViewState > ECamViewStateRangeInternalMin ) |
|
659 { |
|
660 internal = ETrue; |
|
661 } |
|
662 else if( aViewState < ECamViewStateRangeExternalMax |
|
663 && aViewState > ECamViewStateRangeExternalMin ) |
|
664 { |
|
665 internal = EFalse; |
|
666 } |
|
667 else |
|
668 { |
|
669 CamPanic( ECamPanicInvalidView ); |
|
670 } |
|
671 |
|
672 PRINT1( _L("Camera <= CCamAppUi::IsInternalView, return %d"), internal ); |
|
673 return internal; |
|
674 } |
|
675 |
|
676 |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CCamAppUi::IsConstructionComplete |
|
680 // Returns whether or not all construction has completed |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 TBool CCamAppUi::IsConstructionComplete() const |
|
684 { |
|
685 TBool complete = ETrue; |
|
686 complete = !iEngineConstructionDelayed; |
|
687 return complete && iEmbeddedViewSet; |
|
688 } |
|
689 |
|
690 |
|
691 // ----------------------------------------------------------------------------- |
|
692 // CCamAppUi::NaviCounter |
|
693 // Returns the pointer to the NaviCounter control |
|
694 // ----------------------------------------------------------------------------- |
|
695 // |
|
696 CCamNaviCounterControl* CCamAppUi::NaviCounterControl() |
|
697 { |
|
698 return iNaviCounterControl; |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CCamAppUi::NaviProgressBar |
|
703 // Returns the pointer to the NaviProgress control |
|
704 // ----------------------------------------------------------------------------- |
|
705 // |
|
706 CCamNaviProgressBarControl* CCamAppUi::NaviProgressBarControl() |
|
707 { |
|
708 return iNaviProgressBarControl; |
|
709 } |
|
710 |
|
711 // ----------------------------------------------------------------------------- |
|
712 // CCamAppUi::NaviCounterModel |
|
713 // Returns the pointer to the NaviCounter model |
|
714 // ----------------------------------------------------------------------------- |
|
715 // |
|
716 CCamNaviCounterModel* CCamAppUi::NaviCounterModel() |
|
717 { |
|
718 return iNaviCounterModel; |
|
719 } |
|
720 |
|
721 |
|
722 // ----------------------------------------------------------------------------- |
|
723 // CCamAppUi::CCamAppUi |
|
724 // C++ default constructor can NOT contain any code, that |
|
725 // might leave. |
|
726 // ----------------------------------------------------------------------------- |
|
727 // |
|
728 CCamAppUi::CCamAppUi( CCamAppController& aController ) |
|
729 : iController( aController ), |
|
730 iViewState( ECamViewStatePreCapture ), |
|
731 iTargetViewState( ECamViewStatePreCapture ), |
|
732 iPreventActivePaletteDisplay( EFalse ), |
|
733 iInternalStorage(ECamMediaStorageNone) |
|
734 { |
|
735 } |
|
736 |
|
737 // ---------------------------------------------------- |
|
738 // CCamAppUi::SetTitleL |
|
739 // Set title pane text from a resource. |
|
740 // ---------------------------------------------------- |
|
741 // |
|
742 void CCamAppUi::SetTitleL( TInt aResourceId ) |
|
743 { |
|
744 // Set title |
|
745 CAknTitlePane* title = static_cast<CAknTitlePane*>( |
|
746 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
747 TResourceReader reader; |
|
748 iCoeEnv->CreateResourceReaderLC( reader, aResourceId ); |
|
749 title->SetFromResourceL( reader ); |
|
750 CleanupStack::PopAndDestroy(); // resource reader |
|
751 } |
|
752 |
|
753 // ---------------------------------------------------- |
|
754 // CCamAppUi::SetTitleL |
|
755 // Set title pane text from a descriptor. |
|
756 // ---------------------------------------------------- |
|
757 // |
|
758 void CCamAppUi::SetTitleL( const TDesC& aText ) |
|
759 { |
|
760 CAknTitlePane* title = static_cast<CAknTitlePane*>( |
|
761 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
762 title->SetTextL( aText ); |
|
763 } |
|
764 |
|
765 |
|
766 |
|
767 // ---------------------------------------------------- |
|
768 // CCamAppUi::PushNaviPaneCounterL |
|
769 // Push navi pane counter on to navi pane stack. |
|
770 // ---------------------------------------------------- |
|
771 // |
|
772 void |
|
773 CCamAppUi::PushNaviPaneCounterL() |
|
774 { |
|
775 iNaviCounterModel->SetCaptureModeL( iMode, iImageMode ); |
|
776 iDecoratedNaviPaneCounter->MakeScrollButtonVisible( EFalse ); |
|
777 NaviPaneL()->PushL( *iDecoratedNaviPaneCounter ); |
|
778 } |
|
779 |
|
780 // ---------------------------------------------------- |
|
781 // CCamAppUi::PushNaviPaneProgressBarL |
|
782 // Push navi pane progress bar on to navi pane stack. |
|
783 // ---------------------------------------------------- |
|
784 // |
|
785 void CCamAppUi::PushNaviPaneProgressBarL() |
|
786 { |
|
787 iDecoratedNaviPaneProgressBar->MakeScrollButtonVisible( EFalse ); |
|
788 NaviPaneL()->PushL( *iDecoratedNaviPaneProgressBar ); |
|
789 } |
|
790 |
|
791 // ---------------------------------------------------- |
|
792 // CCamAppUi::PushDefaultNaviPaneL |
|
793 // Push default navi pane on to navi pane stack. |
|
794 // ---------------------------------------------------- |
|
795 // |
|
796 void CCamAppUi::PushDefaultNaviPaneL() |
|
797 { |
|
798 NaviPaneL()->PushDefaultL(); |
|
799 } |
|
800 |
|
801 |
|
802 // ---------------------------------------------------- |
|
803 // CCamAppUi::DisplayDeleteNoteL |
|
804 // Call DisplayDeleteNoteL on the current view |
|
805 // ---------------------------------------------------- |
|
806 // |
|
807 TBool CCamAppUi::DisplayDeleteNoteL() |
|
808 { |
|
809 TBool deleted = |
|
810 static_cast<CCamPostCaptureViewBase*>( iView )->DisplayDeleteNoteL(); |
|
811 |
|
812 // If the image/video has been deleted, switch view |
|
813 if ( deleted ) |
|
814 { |
|
815 |
|
816 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() && IsEmbedded() ) |
|
817 { |
|
818 // if in embedded mode, then check the status of the slide |
|
819 // and set a pending camera switch if the slide has been |
|
820 // opened/closed after starting the capture |
|
821 iController.CheckSlideStatus(); |
|
822 } |
|
823 |
|
824 // if this is burst mode and there are still images left, |
|
825 // return to thumbnail view |
|
826 if ( ECamImageCaptureBurst == iController.CurrentImageModeSetup() |
|
827 && 0 < iController.CurrentItemCount() ) |
|
828 { |
|
829 iTargetViewState = ECamViewStateBurstThumbnail; |
|
830 } |
|
831 // otherwise switch to pre-capture view |
|
832 else |
|
833 { |
|
834 iTargetViewState = ECamViewStatePreCapture; |
|
835 } |
|
836 TrySwitchViewL(); |
|
837 } |
|
838 else |
|
839 { |
|
840 } |
|
841 return deleted; |
|
842 } |
|
843 |
|
844 // ---------------------------------------------------- |
|
845 // CCamAppUi::SelfTimerEnableL |
|
846 // Enable or disable SelfTimer functionality |
|
847 // ---------------------------------------------------- |
|
848 // |
|
849 void CCamAppUi::SelfTimerEnableL( TCamSelfTimerFunctions aState ) |
|
850 { |
|
851 // If the requested state is the current state, do nothing. |
|
852 if ( iInSelfTimerMode == aState ) |
|
853 { |
|
854 return; |
|
855 } |
|
856 |
|
857 __ASSERT_DEBUG( iSelfTimer, CamPanic( ECamPanicNullPointer ) ); |
|
858 |
|
859 // Update the member variable |
|
860 iInSelfTimerMode = aState; |
|
861 |
|
862 if ( aState != ECamSelfTimerDisabled ) |
|
863 { |
|
864 // Set up for current timer mode |
|
865 iSelfTimer->SetModeL( iMode, iImageMode, iInSelfTimerMode ); |
|
866 UpdateCba(); |
|
867 } |
|
868 else |
|
869 { |
|
870 // stop the timer and remove the indicator from the side pane |
|
871 iSelfTimer->Cancel(); |
|
872 |
|
873 // In capture setup mode, toolbar and indicators are not visible |
|
874 // They will be updated when returning to precap, similarily to |
|
875 // when setting the self timer mode above |
|
876 if( iPreCaptureMode != ECamPreCapCaptureSetup ) |
|
877 { |
|
878 // Re-show the active palette |
|
879 iActivePaletteHandler->UpdateActivePaletteL(); |
|
880 iPreventActivePaletteDisplay = EFalse; |
|
881 SetActivePaletteVisibility( ETrue ); |
|
882 |
|
883 if ( iController.IsTouchScreenSupported() ) |
|
884 { |
|
885 CAknToolbar* toolbar = CurrentFixedToolbar(); |
|
886 if (toolbar) |
|
887 { |
|
888 toolbar->SetToolbarVisibility( ETrue ); |
|
889 } |
|
890 } |
|
891 // Cancel any active focusing operation |
|
892 // this won't cancel if capture has already been requested |
|
893 iController.CancelFocusAndCapture(); |
|
894 |
|
895 iStillCaptureView->UpdateToolbarIconsL(); |
|
896 |
|
897 // Raise precapture UI and restart courtesy UI timer, |
|
898 // if hide icons is enabled. |
|
899 RaisePreCaptureCourtesyUI(EFalse); |
|
900 } |
|
901 |
|
902 UpdateCba(); |
|
903 } |
|
904 } |
|
905 |
|
906 // ----------------------------------------------------------------------------- |
|
907 // CCamAppUi::SelfTimerEnabled |
|
908 // Returns current self-timer state |
|
909 // ----------------------------------------------------------------------------- |
|
910 // |
|
911 TBool CCamAppUi::SelfTimerEnabled() const |
|
912 { |
|
913 return ( iInSelfTimerMode != ECamSelfTimerDisabled ); |
|
914 } |
|
915 |
|
916 // ----------------------------------------------------------------------------- |
|
917 // CCamAppUi::SelfTimer |
|
918 // Returns pointer to self-timer object |
|
919 // ----------------------------------------------------------------------------- |
|
920 // |
|
921 CCamSelfTimer* CCamAppUi::SelfTimer() |
|
922 { |
|
923 return iSelfTimer; |
|
924 } |
|
925 |
|
926 // ----------------------------------------------------------------------------- |
|
927 // CCamAppUi::AddBurstModeObserverL |
|
928 // Register an observer for burst mode changes |
|
929 // ----------------------------------------------------------------------------- |
|
930 // |
|
931 void |
|
932 CCamAppUi::AddBurstModeObserverL( MCamBurstModeObserver* aBurstModeObserver ) |
|
933 { |
|
934 // Check for non-null and only add once. |
|
935 if( aBurstModeObserver && |
|
936 KErrNotFound == iBurstModeObservers.Find( aBurstModeObserver ) ) |
|
937 { |
|
938 iBurstModeObservers.AppendL( aBurstModeObserver ); |
|
939 } |
|
940 } |
|
941 |
|
942 // ----------------------------------------------------------------------------- |
|
943 // CCamAppUi::RemoveBurstModeObserver |
|
944 // Remove the burst mode observer |
|
945 // ----------------------------------------------------------------------------- |
|
946 // |
|
947 void |
|
948 CCamAppUi::RemoveBurstModeObserver( const MCamBurstModeObserver* aBurstModeObserver ) |
|
949 { |
|
950 if( aBurstModeObserver ) |
|
951 { |
|
952 TInt index = iBurstModeObservers.Find( aBurstModeObserver ); |
|
953 if( KErrNotFound != index ) |
|
954 { |
|
955 iBurstModeObservers.Remove( index ); |
|
956 } |
|
957 } |
|
958 } |
|
959 |
|
960 // ----------------------------------------------------------------------------- |
|
961 // CCamAppUi::IsBurstEnabled |
|
962 // Return burst mode enabled state |
|
963 // ----------------------------------------------------------------------------- |
|
964 // |
|
965 TBool CCamAppUi::IsBurstEnabled() const |
|
966 { |
|
967 PRINT_FRQ( _L("Camera => CCamAppUi::IsBurstEnabled" ) ) |
|
968 TBool ret = EFalse; |
|
969 if ( ECamImageCaptureBurst == iImageMode |
|
970 || ECamImageCaptureTimeLapse == iImageMode ) |
|
971 { |
|
972 ret = ETrue; |
|
973 } |
|
974 |
|
975 PRINT_FRQ( _L("Camera <= CCamAppUi::IsBurstEnabled" ) ) |
|
976 return ret; |
|
977 } |
|
978 |
|
979 // ----------------------------------------------------------------------------- |
|
980 // CCamAppUi::CurrentBurstMode |
|
981 // Return burst mode enabled type |
|
982 // ----------------------------------------------------------------------------- |
|
983 // |
|
984 TCamImageCaptureMode CCamAppUi::CurrentBurstMode() const |
|
985 { |
|
986 PRINT_FRQ( _L("Camera => CCamAppUi::CurrentBurstMode" ) ) |
|
987 TCamImageCaptureMode mode( ECamImageCaptureNone ); |
|
988 |
|
989 if ( ECamImageCaptureBurst == iImageMode |
|
990 || ECamImageCaptureTimeLapse == iImageMode ) |
|
991 { |
|
992 mode = iImageMode; |
|
993 } |
|
994 |
|
995 PRINT_FRQ( _L("Camera <= CCamAppUi::CurrentBurstMode" ) ) |
|
996 return mode; |
|
997 } |
|
998 |
|
999 |
|
1000 // ----------------------------------------------------------------------------- |
|
1001 // CCamAppUi::IsSecondCameraEnabled |
|
1002 // Returns whether or the secondary camera has been activated |
|
1003 // Will return ETrue when when the second camera is active |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 // |
|
1006 TBool CCamAppUi::IsSecondCameraEnabled() const |
|
1007 { |
|
1008 PRINT_FRQ( _L("Camera =><= CCamAppUi::IsSecondCameraEnabled" )) |
|
1009 return iController.ActiveCamera() == ECamActiveCameraSecondary; |
|
1010 } |
|
1011 |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // CCamAppUi::IsQwerty2ndCamera |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // |
|
1016 TBool CCamAppUi::IsQwerty2ndCamera( TBool aLock ) |
|
1017 { |
|
1018 TBool ret = EFalse; |
|
1019 if ( aLock ) |
|
1020 { |
|
1021 iLockedQwertyState = E2ndCamUnknown; |
|
1022 } |
|
1023 |
|
1024 switch( iLockedQwertyState ) |
|
1025 { |
|
1026 case E2ndCamPortraitForced: |
|
1027 { |
|
1028 ret = EFalse; |
|
1029 break; |
|
1030 } |
|
1031 case E2ndCamLandscapeForced: |
|
1032 { |
|
1033 ret = ETrue; |
|
1034 break; |
|
1035 } |
|
1036 case E2ndCamUnknown: |
|
1037 { |
|
1038 // Get variant setting i.e. initialize |
|
1039 TInt value = 0; |
|
1040 if ( iController.UiConfigManagerPtr() ) |
|
1041 { |
|
1042 value = iController.UiConfigManagerPtr()->IsQwerty2ndCamera(); |
|
1043 |
|
1044 iLockedQwertyState = static_cast<T2ndCamOrientation>(value); |
|
1045 if ( iLockedQwertyState == E2ndCamAuto ) |
|
1046 { |
|
1047 ret = CamUtility::IsQwertyOpen(); |
|
1048 } |
|
1049 else |
|
1050 { |
|
1051 ret = iLockedQwertyState == E2ndCamLandscapeForced; |
|
1052 } |
|
1053 } |
|
1054 break; |
|
1055 } |
|
1056 case E2ndCamAuto: |
|
1057 { |
|
1058 ret = CamUtility::IsQwertyOpen(); |
|
1059 break; |
|
1060 } |
|
1061 default: |
|
1062 break; |
|
1063 } |
|
1064 |
|
1065 if ( aLock ) |
|
1066 { |
|
1067 iLockedQwertyState = ret?E2ndCamLandscapeForced:E2ndCamPortraitForced; |
|
1068 } |
|
1069 |
|
1070 return ret; |
|
1071 } |
|
1072 |
|
1073 // ----------------------------------------------------------------------------- |
|
1074 // CCamAppUi::IsWaitDialog |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // |
|
1077 TBool CCamAppUi::IsWaitDialog() const |
|
1078 { |
|
1079 return iWaitDialog != NULL; |
|
1080 } |
|
1081 |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // CCamAppUi::ActiveCamera |
|
1084 // Returns the active camera |
|
1085 // ----------------------------------------------------------------------------- |
|
1086 // |
|
1087 TCamActiveCamera CCamAppUi::ActiveCamera() const |
|
1088 { |
|
1089 return iController.ActiveCamera(); |
|
1090 } |
|
1091 |
|
1092 // ----------------------------------------------------------------------------- |
|
1093 // CCamAppUi::HandleCommandL |
|
1094 // Handle user menu selections |
|
1095 // ----------------------------------------------------------------------------- |
|
1096 // |
|
1097 void CCamAppUi::HandleCommandL( TInt aCommand ) |
|
1098 { |
|
1099 PRINT1( _L("Camera => CCamAppUi::HandleCommandL (%d)"), aCommand ) |
|
1100 switch( aCommand ) |
|
1101 { |
|
1102 // ----------------------------------------------------- |
|
1103 case ECamCmdRaiseCourtesyUI: |
|
1104 { |
|
1105 if ( ECamViewStatePreCapture == iViewState ) |
|
1106 { |
|
1107 RaisePreCaptureCourtesyUI(EFalse); |
|
1108 } |
|
1109 else if ( ECamViewStatePostCapture == iViewState ) |
|
1110 { |
|
1111 // iLeftSoftKeyPressed resembles the Left SoftKey(LSK) |
|
1112 // press when AP tool bar is hidden |
|
1113 |
|
1114 if ( iLeftSoftKeyPressed ) |
|
1115 { |
|
1116 // LSK is pressed, we raise the AP tool bar |
|
1117 RaisePostCaptureCourtesyUI(); |
|
1118 } |
|
1119 else |
|
1120 { |
|
1121 // RSK is pressed, we return back to PreCaptureView |
|
1122 HandleCommandL( EAknSoftkeyBack ); |
|
1123 } |
|
1124 |
|
1125 } |
|
1126 else |
|
1127 { |
|
1128 } |
|
1129 } |
|
1130 break; |
|
1131 |
|
1132 // ----------------------------------------------------- |
|
1133 case ECamCmdSceneSettingList: |
|
1134 { |
|
1135 iTargetViewState = ECamViewStateSceneSettingList; |
|
1136 TrySwitchViewL(); |
|
1137 } |
|
1138 break; |
|
1139 // ----------------------------------------------------- |
|
1140 case ECamCmdGoToStandby: |
|
1141 { |
|
1142 CAknTitlePane* title = static_cast<CAknTitlePane*> |
|
1143 ( StatusPane()->ControlL( TUid::Uid ( EEikStatusPaneUidTitle ) ) ); |
|
1144 |
|
1145 title->SetTextL( _L("") ); |
|
1146 title->MakeVisible( ETrue ); |
|
1147 title->DrawNow(); |
|
1148 SetActivePaletteVisibility( EFalse ); |
|
1149 |
|
1150 if ( iView |
|
1151 && ( iStillCaptureView == iView || iVideoCaptureView == iView ) ) |
|
1152 { |
|
1153 iProcessingScreenRedraw = ETrue; |
|
1154 static_cast<CCamPreCaptureViewBase*>( iView )->Container()->DrawNow(); |
|
1155 iProcessingScreenRedraw = EFalse; |
|
1156 } |
|
1157 |
|
1158 PRINT1( _L("CCamAppUi::HandleCommandL standby %d"), iViewState ); |
|
1159 iTargetViewState = ECamViewStateStandby; |
|
1160 TrySwitchViewL(); |
|
1161 } |
|
1162 break; |
|
1163 // ----------------------------------------------------- |
|
1164 case ECamCmdSwitchToPrecapture: |
|
1165 { |
|
1166 iTargetViewState = ECamViewStatePreCapture; |
|
1167 TrySwitchViewL(); |
|
1168 } |
|
1169 break; |
|
1170 // ----------------------------------------------------- |
|
1171 case ECamCmdNewPhoto: |
|
1172 { |
|
1173 if ( !iController.IsViewFinding() && iController.EngineRequestsPending() ) |
|
1174 { |
|
1175 return; |
|
1176 } |
|
1177 // check if currently preparing return |
|
1178 if ( iController.CaptureModeTransitionInProgress() ) |
|
1179 { |
|
1180 return; |
|
1181 } |
|
1182 #ifdef CAMERAAPP_PERFORMANCE_MEASUREMENT |
|
1183 PERF_EVENT_START_L1( EPerfEventSwitchToStillMode ); |
|
1184 iController.SetPerformanceState( EPerfWaitingForStillMode ); |
|
1185 #endif |
|
1186 |
|
1187 if ( iMode == ECamControllerVideo ) |
|
1188 { |
|
1189 ZoomPane()->ResetZoomTo1x(); |
|
1190 } |
|
1191 |
|
1192 // Hide the active palette before switching so that |
|
1193 // it is not visible until the preview is visible. |
|
1194 |
|
1195 SetActivePaletteVisibility( EFalse ); |
|
1196 if( iController.UiConfigManagerPtr() && |
|
1197 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() && |
|
1198 iVideoCaptureView->Container() ) |
|
1199 { |
|
1200 PRINT( _L("Camera <> CCamAppUi::HandleCommandL calling Draw") ); |
|
1201 iVideoCaptureView->Container()->DrawNow(); |
|
1202 } |
|
1203 // Switch to still pre capture view |
|
1204 iTargetViewState = ECamViewStatePreCapture; |
|
1205 // if coming from video mode then set single capture mode |
|
1206 // otherwise stay with the current capture mode |
|
1207 if ( iMode == ECamControllerVideo ) |
|
1208 { |
|
1209 iTargetMode = ECamControllerImage; |
|
1210 } |
|
1211 TrySwitchViewL(); |
|
1212 |
|
1213 |
|
1214 } |
|
1215 break; |
|
1216 case EEikCmdExit: // fallthrough |
|
1217 case EAknSoftkeyExit: |
|
1218 { |
|
1219 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_HANDLECOMMANDL, "e_ExternalExit 1" ); |
|
1220 PRINT( _L("Camera CCamAppUi external exit call") ); |
|
1221 if ( iEikonEnv->StartedAsServerApp() ) |
|
1222 { |
|
1223 if ( iEmbeddedObserver ) |
|
1224 { |
|
1225 iEmbeddedObserver->AbortL(); |
|
1226 } |
|
1227 CloseAppL(); |
|
1228 } |
|
1229 else |
|
1230 /*#ifndef __WINS__ |
|
1231 { |
|
1232 if( iSendFileInCall ) |
|
1233 { |
|
1234 // bring phone app to fore ground |
|
1235 BringPhoneAppToForeGroundL(); |
|
1236 } |
|
1237 else |
|
1238 { |
|
1239 // hide task icon immediately so it doesn't show during |
|
1240 // closing which might take a while |
|
1241 HideTaskL( ETrue ); |
|
1242 CloseAppL(); |
|
1243 } |
|
1244 } |
|
1245 #else*/ |
|
1246 { |
|
1247 HideTaskL( ETrue ); |
|
1248 CloseAppL(); |
|
1249 } |
|
1250 //#endif |
|
1251 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP5_CCAMAPPUI_HANDLECOMMANDL, "e_ExternalExit 0" ); |
|
1252 } |
|
1253 break; |
|
1254 // ----------------------------------------------------- |
|
1255 case ECamCmdInternalExit: |
|
1256 { |
|
1257 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_HANDLECOMMANDL, "e_ECamCmdInternalExit 1" ); |
|
1258 PRINT( _L("Camera <> CCamAppUi::HandleCommandL case ECamCmdInternalExit") ); |
|
1259 #ifdef CAMERAAPP_PERF_LOG_MEMORY |
|
1260 // Manually save the current memory log data. This is needed |
|
1261 // in case the application just goes to background, in which |
|
1262 // case the log data is not saved automatically. |
|
1263 CCamPerformanceLogger::SaveAndReset(); |
|
1264 #endif |
|
1265 |
|
1266 #ifdef CAMERAAPP_PERF_LOG_TRACES |
|
1267 // Shutdown end event cannot be logged to memory logger |
|
1268 // So also log start event only to traces |
|
1269 if( !iController.AlwaysOnSupported() ) |
|
1270 { |
|
1271 PERF_EVENT_START_TRACE( EPerfEventApplicationShutdown ); |
|
1272 } |
|
1273 #endif |
|
1274 PRINT( _L("Camera CCamAppUi::ECamCmdInternalExit") ); |
|
1275 InternalExitL(); |
|
1276 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMAPPUI_HANDLECOMMANDL, "e_ECamCmdInternalExit 0" ); |
|
1277 } |
|
1278 break; |
|
1279 // ----------------------------------------------------- |
|
1280 case ECamCmdSlideClosedExit: |
|
1281 { |
|
1282 // The controller tells the AppUi that the app needs to |
|
1283 // do an internal exit because the slider has closed. |
|
1284 // However the view needs to do some processing of this command |
|
1285 // e.g. to ensure that the application leaves standby mode. |
|
1286 // Pass the cammand on to the view. It will come back to |
|
1287 // the AppUi as ECamCmdInternalExit |
|
1288 OstTrace0( TRACE_PERFORMANCE_DETAIL, DUP2_CCAMAPPUI_HANDLECOMMANDL, "e_ECamCmdSlideClosedExit 1" ); |
|
1289 |
|
1290 iLensCoverExit = ETrue; |
|
1291 PRINT( _L("Camera CCamAppUi::ECamCmdSlideClosedExit") ); |
|
1292 if ( iView ) |
|
1293 { |
|
1294 PRINT( _L("Camera CCamAppUi passing ECamCmdSlideClosedExit to iView") ); |
|
1295 iView->HandleCommandL( ECamCmdInternalExit ); |
|
1296 } |
|
1297 else |
|
1298 { |
|
1299 PRINT( _L("Camera CCamAppUi handlingECamCmdSlideClosedExit") ); |
|
1300 HandleCommandL( ECamCmdInternalExit ); |
|
1301 } |
|
1302 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP4_CCAMAPPUI_HANDLECOMMANDL, "e_ECamCmdSlideClosedExit 0" ); |
|
1303 } |
|
1304 break; |
|
1305 // ----------------------------------------------------- |
|
1306 case EAknSoftkeyBack: |
|
1307 { |
|
1308 PRINT( _L("Camera <> CCamAppUi::HandleCommandL case EAknSoftkeyBack") ); |
|
1309 // If in burst mode |
|
1310 if ( iImageMode == ECamImageCaptureBurst ) |
|
1311 { |
|
1312 // If in burst post-capture view, "back" is to the thumbnail grid |
|
1313 if ( iViewState == ECamViewStatePostCapture ) |
|
1314 { |
|
1315 iTargetViewState = ECamViewStateBurstThumbnail ; |
|
1316 } |
|
1317 else // From any other burst view... |
|
1318 { |
|
1319 iTargetViewState = ECamViewStatePreCapture; |
|
1320 } |
|
1321 } |
|
1322 // Switch to pre capture view |
|
1323 else |
|
1324 { |
|
1325 iTargetViewState = ECamViewStatePreCapture; |
|
1326 } |
|
1327 TrySwitchViewL(); |
|
1328 } |
|
1329 break; |
|
1330 // ----------------------------------------------------- |
|
1331 case ECamCmdDelete: |
|
1332 { |
|
1333 // Request that the view displays the delete confirmation note |
|
1334 if(!iController.IsProcessingCapture()) |
|
1335 { |
|
1336 DisplayDeleteNoteL(); |
|
1337 } |
|
1338 else |
|
1339 { |
|
1340 //Do Nothing |
|
1341 } |
|
1342 } |
|
1343 break; |
|
1344 // ----------------------------------------------------- |
|
1345 case ECamCmdNewVideo: |
|
1346 { |
|
1347 // check if currently preparing return |
|
1348 if ( iController.CaptureModeTransitionInProgress() ) |
|
1349 { |
|
1350 return; |
|
1351 } |
|
1352 #ifdef CAMERAAPP_PERFORMANCE_MEASUREMENT |
|
1353 PERF_EVENT_START_L1( EPerfEventSwitchToVideoMode ); |
|
1354 iController.SetPerformanceState( EPerfWaitingForVideoMode ); |
|
1355 #endif |
|
1356 |
|
1357 if ( iMode == ECamControllerImage ) |
|
1358 { |
|
1359 ZoomPane()->ResetZoomTo1x(); |
|
1360 } |
|
1361 |
|
1362 // Hide the active palette before any attempt to switch off burst mode |
|
1363 // otherwise the view switch to video fails when we call GetFocusWindowGroup to |
|
1364 // see which application has the foreground. Use SetSuppressUIRiseOnViewfinderStart |
|
1365 // otherwise the AP is raised automatically when the viewfinder starts. |
|
1366 |
|
1367 SetActivePaletteVisibility( EFalse ); |
|
1368 SetSuppressUIRiseOnViewfinderStart( ETrue ); |
|
1369 // Switch burst mode off before changing to video |
|
1370 if ( IsBurstEnabled() ) |
|
1371 { |
|
1372 SwitchStillCaptureModeL( ECamImageCaptureSingle, EFalse ); |
|
1373 PRINT( _L("Camera => CCamAppUi::HandleCommandL ECamCmdNewVideo completed switch to single")); |
|
1374 } |
|
1375 |
|
1376 // Switch to video pre capture view |
|
1377 iTargetViewState = ECamViewStatePreCapture; |
|
1378 iTargetMode = ECamControllerVideo; |
|
1379 SetSuppressUIRiseOnViewfinderStart( EFalse ); |
|
1380 PRINT( _L("Camera => CCamAppUi::HandleCommandL Try switch to video mode")); |
|
1381 TrySwitchViewL(); |
|
1382 } |
|
1383 break; |
|
1384 // ----------------------------------------------------- |
|
1385 case ECamCmdSelfTimer1: // 10-sec self-timer |
|
1386 { |
|
1387 SelfTimerEnableL( ECamSelfTimerMode1 ); |
|
1388 } |
|
1389 break; |
|
1390 // ----------------------------------------------------- |
|
1391 case ECamCmdSelfTimer2: // 2-sec self-timer |
|
1392 { |
|
1393 SelfTimerEnableL( ECamSelfTimerMode2 ); |
|
1394 } |
|
1395 break; |
|
1396 // ----------------------------------------------------- |
|
1397 case ECamCmdSelfTimer3: // (not supported) |
|
1398 { |
|
1399 SelfTimerEnableL( ECamSelfTimerMode3 ); |
|
1400 } |
|
1401 break; |
|
1402 // ----------------------------------------------------- |
|
1403 case ECamCmdSelfTimerActivate: |
|
1404 { |
|
1405 // Self timed capture happens either from shutter press or |
|
1406 // self timer activate event from softkey press. Shutter |
|
1407 // press case is handled in CCamStillPreCaptureContainer. |
|
1408 if( iController.UiConfigManagerPtr()->IsXenonFlashSupported() && |
|
1409 !iController.CheckFlash() ) |
|
1410 { |
|
1411 // Flash is not ready for taking a picture |
|
1412 return; |
|
1413 } |
|
1414 |
|
1415 // In touch UI we will get two ECamCmdSelfTimerActivate commands |
|
1416 // immediately then the user touches the left softkey to activate |
|
1417 // self-timer. We need to ignore the second one to enable the counter |
|
1418 // to count down properly. |
|
1419 |
|
1420 // only start countdown if there is space to save image |
|
1421 if ( CheckMemoryL() ) |
|
1422 { |
|
1423 if ( iMode != ECamControllerVideo ) |
|
1424 { |
|
1425 InitCaptureCountL(); |
|
1426 } |
|
1427 // Start capture operation NOW |
|
1428 iSelfTimer->StartSelfTimer(); |
|
1429 |
|
1430 if ( iController.IsTouchScreenSupported() ) |
|
1431 { |
|
1432 CAknToolbar* toolbar = CurrentFixedToolbar(); |
|
1433 if (toolbar) |
|
1434 { |
|
1435 toolbar->SetToolbarVisibility( EFalse ); |
|
1436 } |
|
1437 } |
|
1438 |
|
1439 iPreventActivePaletteDisplay = ETrue; |
|
1440 SetActivePaletteVisibility( EFalse ); |
|
1441 |
|
1442 // Update CBA |
|
1443 UpdateCba(); |
|
1444 } |
|
1445 } |
|
1446 break; |
|
1447 // ----------------------------------------------------- |
|
1448 case ECamCmdSelfTimerCancel: |
|
1449 { |
|
1450 // Called when the user clicks "Cancel" to leave self-timer mode |
|
1451 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
1452 } |
|
1453 break; |
|
1454 // ----------------------------------------------------- |
|
1455 case ECamCmdSettings: |
|
1456 { |
|
1457 // Turn off the courtesy timer if its active so that the softkeys |
|
1458 // will remain active |
|
1459 if( iCourtesyTimer ) |
|
1460 { |
|
1461 iCourtesyTimer->Cancel(); |
|
1462 } |
|
1463 |
|
1464 iReturnedFromPlugin = EFalse; |
|
1465 iSettingsPluginLaunched = ETrue; |
|
1466 SetActivePaletteVisibility( EFalse ); |
|
1467 CCamViewBase* precapView = NULL; |
|
1468 if ( iView == iStillCaptureView || |
|
1469 iView == iVideoCaptureView ) |
|
1470 { |
|
1471 precapView = static_cast<CCamViewBase*>( iView ); |
|
1472 __ASSERT_DEBUG(precapView, CamPanic(ECamPanicNullPointer)); |
|
1473 precapView->BlankSoftkeysL(); |
|
1474 } |
|
1475 iTargetViewState = ECamViewStateSettings; |
|
1476 if ( iController.IsTouchScreenSupported() ) |
|
1477 { |
|
1478 CAknToolbar* toolbar = CurrentFixedToolbar(); |
|
1479 if ( toolbar ) |
|
1480 { |
|
1481 toolbar->SetToolbarVisibility( EFalse ); |
|
1482 } |
|
1483 } |
|
1484 TrySwitchViewL(); |
|
1485 } |
|
1486 break; |
|
1487 // ----------------------------------------------------- |
|
1488 case ECamCmdSelect: |
|
1489 { |
|
1490 PRINT( _L("Camera => CCamAppUi::HandleCommandL ECamCmdSelect")); |
|
1491 if ( iEikonEnv->StartedAsServerApp() ) |
|
1492 { |
|
1493 const TDesC& name( iController.CurrentFullFileName() ); |
|
1494 |
|
1495 PRINT1( _L("Camera => CCamAppUi::HandleCommandL ECamCmdSelect %S"), &name ) |
|
1496 iEmbeddedObserver->FileCompleteL( name ); |
|
1497 iController.EnterShutdownMode( ETrue ); |
|
1498 } |
|
1499 /*#ifndef __WINS__ |
|
1500 else if ( iSendFileInCall ) |
|
1501 { |
|
1502 PRINT( _L("CCamAppUi::HandleCommandL SendMedia file") ) |
|
1503 // handle in-call send interaction |
|
1504 |
|
1505 // Sending of captured media file and to return to call view after sending |
|
1506 BringPhoneAppToForeGroundL(); |
|
1507 DoInCallSendL(); |
|
1508 HideTaskL( ETrue ); // otherwise camera would show in "Active Applications" |
|
1509 iPretendExit = ETrue; // we are basicly in a "pretended exit" state |
|
1510 //BringPhoneAppToForeGroundL(); |
|
1511 } |
|
1512 #endif*/ |
|
1513 else |
|
1514 { |
|
1515 // ACS What do we need to do here? Call internal exit? |
|
1516 // this will exit when any current process completes |
|
1517 iController.EnterShutdownMode( EFalse ); |
|
1518 } |
|
1519 } |
|
1520 break; |
|
1521 // ----------------------------------------------------- |
|
1522 case EAknSoftkeyEmpty: // Must handle this key, but do nothing |
|
1523 break; |
|
1524 // ----------------------------------------------------- |
|
1525 case ECamCmdPhotos: |
|
1526 { |
|
1527 TUid msgUidLastModified(TUid::Uid(KGlxActivationCmdShowLastModified)); |
|
1528 TUid msgUidCameraAlbum(TUid::Uid(KGlxActivationCameraAlbum)); |
|
1529 TApaTaskList apaTaskList( CCoeEnv::Static()->WsSession() ); |
|
1530 TApaTask apaTask = apaTaskList.FindApp( TUid::Uid( KGlxGalleryApplicationUid) ); |
|
1531 |
|
1532 TBuf8<100> buffer; |
|
1533 RDesWriteStream stream( buffer ); |
|
1534 CleanupClosePushL( stream ); |
|
1535 stream.Open( buffer ); |
|
1536 |
|
1537 |
|
1538 if ( ECamViewStatePreCapture == iViewState ) |
|
1539 { |
|
1540 stream << msgUidCameraAlbum; |
|
1541 } |
|
1542 else |
|
1543 { |
|
1544 stream << msgUidLastModified; |
|
1545 } |
|
1546 stream.CommitL(); |
|
1547 |
|
1548 //Hide fixed toolbar before calling to start photos. |
|
1549 if ( iController.IsTouchScreenSupported() && |
|
1550 IsSecondCameraEnabled() && |
|
1551 iViewState == ECamViewStatePreCapture ) |
|
1552 { |
|
1553 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
1554 if ( fixedToolbar ) |
|
1555 { |
|
1556 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
1557 } |
|
1558 //Bitmap mode's VF consumes much of CPU in second camera, stop VF in advance to accelerate switching to photos. |
|
1559 iController.StopViewFinder(); |
|
1560 } |
|
1561 |
|
1562 if ( apaTask.Exists() ) |
|
1563 { |
|
1564 // sending APA task message |
|
1565 apaTask.SendMessage( TUid::Uid( KGlxActivationCmdShowLastModified ), |
|
1566 buffer ); |
|
1567 } |
|
1568 else // Photos Application is not running |
|
1569 { |
|
1570 StartAppCmdLineL( buffer ); |
|
1571 } |
|
1572 CleanupStack::PopAndDestroy( &stream ); |
|
1573 } |
|
1574 break; |
|
1575 // ----------------------------------------------------- |
|
1576 // This should only be available when time lapse is not supported |
|
1577 // so the current mode should be still or multi |
|
1578 case ECamCmdToggleMulti: |
|
1579 { |
|
1580 if ( iImageMode == ECamImageCaptureSingle ) |
|
1581 { |
|
1582 TRAPD( ignore, SwitchStillCaptureModeL( ECamImageCaptureBurst, ETrue ) ); |
|
1583 if ( ignore ) |
|
1584 { |
|
1585 // do nothing |
|
1586 } |
|
1587 } |
|
1588 else if ( iImageMode == ECamImageCaptureBurst ) |
|
1589 { |
|
1590 SwitchStillCaptureModeL( ECamImageCaptureSingle, ETrue ); |
|
1591 } |
|
1592 else |
|
1593 { |
|
1594 // Lint |
|
1595 } |
|
1596 |
|
1597 // Update timelapse interval |
|
1598 iController.SetTimeLapseInterval( 0 ); |
|
1599 |
|
1600 // stop and start the viewfinder in order to update the settings |
|
1601 iController.ExitViewfinderMode( ECamControllerImage ); |
|
1602 iController.EnterViewfinderMode( ECamControllerImage ); |
|
1603 |
|
1604 } |
|
1605 break; |
|
1606 // ----------------------------------------------------- |
|
1607 // Toggle facetracking setting |
|
1608 case ECamCmdToggleFacetracking: |
|
1609 { |
|
1610 if ( iController.UiConfigManagerPtr()->IsFaceTrackingSupported() ) |
|
1611 { |
|
1612 if ( iController.IntegerSettingValue( ECamSettingItemFaceTracking ) == ECamSettOn ) |
|
1613 { |
|
1614 iController.SetIntegerSettingValueL( |
|
1615 ECamSettingItemFaceTracking, |
|
1616 ECamSettOff ); |
|
1617 } |
|
1618 else |
|
1619 { |
|
1620 iController.SetIntegerSettingValueL( |
|
1621 ECamSettingItemFaceTracking, |
|
1622 ECamSettOn ); |
|
1623 } |
|
1624 iController.TryAFRequest( ECamRequestCancelAutofocus ); |
|
1625 } |
|
1626 } |
|
1627 break; |
|
1628 // ----------------------------------------------------- |
|
1629 // Switch to single capture |
|
1630 case ECamCmdSingleCapture: |
|
1631 { |
|
1632 SwitchStillCaptureModeL( ECamImageCaptureSingle, ETrue ); |
|
1633 } |
|
1634 break; |
|
1635 // ----------------------------------------------------- |
|
1636 // Activate burst mode |
|
1637 case ECamCmdSequence: |
|
1638 { |
|
1639 SwitchStillCaptureModeL( ECamImageCaptureBurst, ETrue ); |
|
1640 } |
|
1641 break; |
|
1642 // ----------------------------------------------------- |
|
1643 // Activate time lapse mode |
|
1644 case ECamCmdTimeLapse: |
|
1645 { |
|
1646 SwitchStillCaptureModeL( ECamImageCaptureTimeLapse, ETrue ); |
|
1647 } |
|
1648 break; |
|
1649 // ----------------------------------------------------- |
|
1650 case ECamCmdOpenPhoto: |
|
1651 { |
|
1652 if(iViewState == ECamViewStateBurstThumbnail ) |
|
1653 { |
|
1654 iTargetViewState = ECamViewStatePostCapture; |
|
1655 TrySwitchViewL(); |
|
1656 } |
|
1657 } |
|
1658 break; |
|
1659 // ----------------------------------------------------- |
|
1660 case ECamCmdUserScene: |
|
1661 { |
|
1662 iTargetViewState = ECamViewStateUserSceneSetup; |
|
1663 TrySwitchViewL(); |
|
1664 } |
|
1665 break; |
|
1666 // ----------------------------------------------------- |
|
1667 case ECamCmdPlay: |
|
1668 { |
|
1669 TDataType dataType; |
|
1670 SetEmbedding( ETrue ); |
|
1671 iDocHandler->OpenFileEmbeddedL( iController.CurrentFullFileName(), |
|
1672 dataType ); |
|
1673 } |
|
1674 break; |
|
1675 // ----------------------------------------------------- |
|
1676 case ECamCmdSwitchCamera: |
|
1677 { |
|
1678 PRINT( _L("Camera => CCamAppUi::HandleCommandL ECamCmdSwitchCamera" )) |
|
1679 //If modechange sequence going on ignore switching... |
|
1680 if( iController.CaptureModeTransitionInProgress() || |
|
1681 iController.CaptureState() != ECamCaptureOff || |
|
1682 iController.IsSavingInProgress() ) |
|
1683 { |
|
1684 PRINT( _L("Camera <= CCamAppUi::HandleCommandL STOP ECamCmdSwitchCamera" )) |
|
1685 iController.SetCameraSwitchRequired( ESwitchDone ); |
|
1686 break; |
|
1687 } |
|
1688 |
|
1689 // Hide fixed toolbar and softkeys to prevent blinking |
|
1690 if ( iController.IsTouchScreenSupported() ) |
|
1691 { |
|
1692 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
1693 if ( fixedToolbar ) |
|
1694 { |
|
1695 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
1696 } |
|
1697 } |
|
1698 CCamViewBase* precapView = static_cast<CCamViewBase*>( iView ); |
|
1699 __ASSERT_DEBUG( precapView, CamPanic( ECamPanicNullPointer )); |
|
1700 if ( precapView ) |
|
1701 { |
|
1702 precapView->ViewCba()->MakeVisible( EFalse ); |
|
1703 } |
|
1704 |
|
1705 PRINT( _L("Camera <> CCamAppUi::HandleCommandL continue ECamCmdSwitchCamera" )) |
|
1706 |
|
1707 if ( ActiveCamera() == ECamActiveCameraPrimary && IsBurstEnabled() ) |
|
1708 { |
|
1709 SwitchStillCaptureModeL( ECamImageCaptureSingle, EFalse ); |
|
1710 } |
|
1711 |
|
1712 TInt primaryOrientation = EAppUiOrientationUnspecified; |
|
1713 TInt secondaryOrientation = EAppUiOrientationUnspecified; |
|
1714 TCamPsiKey orientation = IsQwerty2ndCamera( ETrue )? |
|
1715 ECamPsiPrimaryCameraOrientation: |
|
1716 ECamPsiSecondaryCameraOrientation; |
|
1717 if ( !CamUtility::GetPsiInt( ECamPsiPrimaryCameraOrientation, |
|
1718 primaryOrientation ) && |
|
1719 !CamUtility::GetPsiInt( orientation, |
|
1720 secondaryOrientation ) ) |
|
1721 { |
|
1722 if ( primaryOrientation != secondaryOrientation || IsQwerty2ndCamera() ) |
|
1723 { |
|
1724 if( ( !IsSecondCameraEnabled() || |
|
1725 iController.CameraSwitchQueued() == ESwitchSecondaryOrientation ) && |
|
1726 !IsQwerty2ndCamera() ) |
|
1727 { |
|
1728 PRINT( _L("Camera => CCamAppUi::HandleCommandL ECamCmdSwitchCamera 2ndary portrait" )) |
|
1729 iCamOrientation = ECamOrientationPortrait; |
|
1730 SetOrientationL( static_cast<TAppUiOrientation>( secondaryOrientation ) ); |
|
1731 |
|
1732 if ( iController.IsTouchScreenSupported() ) |
|
1733 { |
|
1734 iStillCaptureView->CreateAndSetToolbarL( R_CAM_STILL_PRECAPTURE_TOOLBAR_PORTRAIT ); |
|
1735 iVideoCaptureView->CreateAndSetToolbarL( R_CAM_VIDEO_PRECAPTURE_TOOLBAR_PORTRAIT ); |
|
1736 } |
|
1737 |
|
1738 StatusPane()->MakeVisible( ETrue ); |
|
1739 } |
|
1740 else |
|
1741 { |
|
1742 PRINT( _L("Camera => CCamAppUi::HandleCommandL ECamCmdSwitchCamera 1ary or 2nd landscape" )) |
|
1743 iCamOrientation = (iSoftkeyPosition == ECamHandLeft) |
|
1744 ? ECamOrientationCamcorderLeft |
|
1745 : ECamOrientationCamcorder; |
|
1746 |
|
1747 SetOrientationL( |
|
1748 static_cast<TAppUiOrientation>( primaryOrientation ) ); |
|
1749 |
|
1750 if ( iController.IsTouchScreenSupported() ) |
|
1751 { |
|
1752 if ( ( !IsSecondCameraEnabled() || iController.CameraSwitchQueued() == ESwitchSecondaryOrientation ) && |
|
1753 IsQwerty2ndCamera() ) |
|
1754 { |
|
1755 iStillCaptureView->CreateAndSetToolbarL( |
|
1756 R_CAM_STILL_PRECAPTURE_TOOLBAR_LANDSCAPE ); |
|
1757 iVideoCaptureView->CreateAndSetToolbarL( |
|
1758 R_CAM_VIDEO_PRECAPTURE_TOOLBAR_LANDSCAPE ); |
|
1759 } |
|
1760 else |
|
1761 { |
|
1762 iStillCaptureView->CreateAndSetToolbarL( |
|
1763 R_CAM_STILL_PRECAPTURE_TOOLBAR ); |
|
1764 if(iController.UiConfigManagerPtr()->IsXenonFlashSupported()) |
|
1765 { |
|
1766 iVideoCaptureView->CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR); |
|
1767 iVideoCaptureView->UpdateToolbarIconsL(); |
|
1768 } |
|
1769 else |
|
1770 { |
|
1771 iVideoCaptureView->CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR_VIDEOLIGHT); |
|
1772 } |
|
1773 } |
|
1774 } |
|
1775 |
|
1776 StatusPane()->MakeVisible( EFalse ); |
|
1777 } |
|
1778 UpdateNaviModelsL(); |
|
1779 |
|
1780 //Reset zoom when changing cameras |
|
1781 ZoomPane()->ResetZoomTo1x(); |
|
1782 |
|
1783 TInt rl( 0 ); |
|
1784 for ( rl = 0; rl < iResourceLoaders.Count(); rl++ ) |
|
1785 { |
|
1786 iResourceLoaders[rl]->ReloadResourceDataL(); |
|
1787 } |
|
1788 |
|
1789 iCamSidePane->UpdateLayout(); |
|
1790 iTargetViewState = ECamViewStatePreCapture; |
|
1791 delete iScreenClearer; |
|
1792 iScreenClearer = NULL; |
|
1793 iScreenClearer = CAknLocalScreenClearer::NewL( |
|
1794 IsSecondCameraEnabled() || IsQwerty2ndCamera() ); |
|
1795 TrySwitchViewL( ETrue ); |
|
1796 iController.SwitchCameraL(); |
|
1797 } |
|
1798 } |
|
1799 } |
|
1800 break; |
|
1801 // ----------------------------------------------------- |
|
1802 case EAknCmdHelp: |
|
1803 { |
|
1804 LaunchHelpL(); |
|
1805 } |
|
1806 break; |
|
1807 // ----------------------------------------------------- |
|
1808 case ECamCmdRedrawScreen: |
|
1809 { |
|
1810 if( !iProcessingScreenRedraw && iView ) |
|
1811 { |
|
1812 iProcessingScreenRedraw = ETrue; |
|
1813 iView->HandleCommandL(ECamCmdRedrawScreen); |
|
1814 iProcessingScreenRedraw = EFalse; |
|
1815 } |
|
1816 } |
|
1817 break; |
|
1818 // ----------------------------------------------------- |
|
1819 case ECamCmdShootSetup: // fall through |
|
1820 case ECamCmdFlash: // fall through |
|
1821 case ECamCmdAddAudio: // fall through |
|
1822 case ECamCmdEdit: // fall through |
|
1823 case ECamCmdPrint: // fall through |
|
1824 case ECamCmdSendToCallerMultimedia: // fall through |
|
1825 case ECamCmdRenameImage: // fall through |
|
1826 case ECamCmdRenameVideo: // fall through |
|
1827 { |
|
1828 User::Leave( KErrNotSupported ); |
|
1829 } |
|
1830 break; |
|
1831 |
|
1832 // ----------------------------------------------------- |
|
1833 case ECamCmdViewfinderGrid: |
|
1834 { |
|
1835 SelectViewFinderGridSettingL(); |
|
1836 break; |
|
1837 } |
|
1838 |
|
1839 // ----------------------------------------------------- |
|
1840 case EAknCmdTaskSwapper: |
|
1841 /* |
|
1842 * MSK: Active Applications |
|
1843 * This command is actually handled by Avkon FW |
|
1844 * Applications should not handle this |
|
1845 */ |
|
1846 break; |
|
1847 //------------------------------------------------------- |
|
1848 default: |
|
1849 { |
|
1850 PRINT( _L("Camera <> CCamAppUi::HandleCommandL does nothing") ) |
|
1851 } |
|
1852 break; |
|
1853 } |
|
1854 // ----------------------------------------------------- |
|
1855 PRINT( _L("Camera <= CCamAppUi::HandleCommandL") ) |
|
1856 } |
|
1857 |
|
1858 // =========================================================================== |
|
1859 // From MCamCameraObserver |
|
1860 |
|
1861 // ----------------------------------------------------------------------------- |
|
1862 // ----------------------------------------------------------------------------- |
|
1863 // |
|
1864 |
|
1865 void |
|
1866 CCamAppUi::HandleCameraEventL( TInt /*aStatus*/, |
|
1867 TCamCameraEventId aEventId, |
|
1868 TAny* /*aEventData //= NULL */ |
|
1869 ) |
|
1870 { |
|
1871 switch( aEventId ) |
|
1872 { |
|
1873 // ----------------------------------------------------- |
|
1874 case ECamCameraEventVfStart: // ECamEventViewFinderStarted |
|
1875 { |
|
1876 PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL ECamCameraEventVfStart" ) ) |
|
1877 if( iScreenClearer ) |
|
1878 { |
|
1879 delete iScreenClearer; |
|
1880 iScreenClearer = NULL; |
|
1881 } |
|
1882 #ifdef CAMERAAPP_DELAYED_POSTCAPTURE_CREATION |
|
1883 |
|
1884 // Construct postcapture views when idle |
|
1885 // or latest when view switch is requested |
|
1886 StartPostCapIdleL(); |
|
1887 #else |
|
1888 TRAPD( err, ConstructPostCaptureViewsL() ) |
|
1889 if ( KErrNone != err ) |
|
1890 { |
|
1891 TRAP_IGNORE( HandleCameraErrorL( err ) ); |
|
1892 |
|
1893 // if embedded need to notify embeddee |
|
1894 if ( iEikonEnv->StartedAsServerApp() ) |
|
1895 { |
|
1896 iEmbeddedObserver->AbortL(); |
|
1897 } |
|
1898 else |
|
1899 { |
|
1900 CloseAppL(); |
|
1901 } |
|
1902 } |
|
1903 #endif |
|
1904 // Only show the Active Palette once viewfinding has started |
|
1905 iPreventActivePaletteDisplay = EFalse; |
|
1906 |
|
1907 // For forced focus scenes, do one autofocus request once vf starts if needed |
|
1908 if( iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
1909 { |
|
1910 if( iController.CurrentSceneHasForcedFocus() ) |
|
1911 { |
|
1912 PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL, TryAFRequest( ECamRequestCancelAutofocus )") ); |
|
1913 //Only autofocuscancel will set AFrange which is needed for forced focus cases |
|
1914 iController.TryAFRequest( ECamRequestCancelAutofocus ); |
|
1915 } |
|
1916 else // For scenes with reticule cancel the autofocus, which sets the focus correctly |
|
1917 { |
|
1918 if ( iController.UiConfigManagerPtr()->IsAutofocusSetInHyperfocalAtStartup() ) |
|
1919 { |
|
1920 PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL, TryAFRequest( ECamRequestCancelAutofocus )") ); |
|
1921 iController.TryAFRequest( ECamRequestCancelAutofocus ); |
|
1922 } |
|
1923 else if ( !iFirstVFStart ) |
|
1924 { |
|
1925 iController.TryAFRequest( ECamRequestCancelAutofocus ); |
|
1926 } |
|
1927 } |
|
1928 } |
|
1929 iFirstVFStart = EFalse; |
|
1930 |
|
1931 break; |
|
1932 } |
|
1933 // ----------------------------------------------------- |
|
1934 case ECamCameraEventVideoAsyncStop: // Audio and video streams are stopped |
|
1935 { |
|
1936 PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL ECamCameraEventVideoAsyncStop" ) ) |
|
1937 // Stop View finder if not needed to left run |
|
1938 if ( iController.IntegerSettingValue( ECamSettingItemVideoShowCapturedVideo ) == ECamSettOn ) |
|
1939 { |
|
1940 iController.StopViewFinderEcam(); |
|
1941 } |
|
1942 break; |
|
1943 } |
|
1944 // ----------------------------------------------------- |
|
1945 case ECamCameraEventPowerOnRequested: |
|
1946 { |
|
1947 // event only send if UIOrientationOverride feature is supported, |
|
1948 // in that case UI construction is divided into two parts, call here |
|
1949 // to complete the construction if in first startup |
|
1950 if( iFirstBoot ) |
|
1951 { |
|
1952 PRINT( _L( "Camera <> CCamAppUi::HandleCameraEventL ECamCameraEventPowerOnRequested" ) ) |
|
1953 if ( iWaitTimer->IsActive() ) |
|
1954 { |
|
1955 PRINT( _L( "Camera <> timer already active" ) ) |
|
1956 iWaitTimer->Cancel(); |
|
1957 } |
|
1958 PRINT( _L( "Camera <> start the appui construct timer" ) ) |
|
1959 iWaitTimer->Start( 0, 0, TCallBack( AppUIConstructCallbackL, this ) ); |
|
1960 } |
|
1961 else |
|
1962 { |
|
1963 //load settings in case they were changed via GS |
|
1964 iController.LoadStaticSettingsL( IsEmbedded() ); |
|
1965 // and check the availability of the memory to be used |
|
1966 iController.CheckMemoryToUseL(); |
|
1967 } |
|
1968 break; |
|
1969 } |
|
1970 default: |
|
1971 { |
|
1972 break; |
|
1973 } |
|
1974 |
|
1975 } |
|
1976 |
|
1977 } |
|
1978 // =========================================================================== |
|
1979 |
|
1980 // ----------------------------------------------------------------------------- |
|
1981 // CCamAppUi::HandleControllerEventL |
|
1982 // Handle controller events |
|
1983 // ----------------------------------------------------------------------------- |
|
1984 // |
|
1985 void |
|
1986 CCamAppUi::HandleControllerEventL( TCamControllerEvent aEvent, |
|
1987 TInt aError ) |
|
1988 { |
|
1989 PRINT1( _L( "Camera => CCamAppUi::HandleControllerEventL() %d" ), aEvent ); |
|
1990 switch ( aEvent ) |
|
1991 { |
|
1992 // ----------------------------------------------------- |
|
1993 case ECamEventExitRequested: |
|
1994 { |
|
1995 PRINT( _L( "Camera <> case ECamEventExitRequested" ) ) |
|
1996 if ( SettingsLaunchedFromCamera() ) |
|
1997 { |
|
1998 SettingsPluginExitedL( ECameraCompleteExit ); |
|
1999 } |
|
2000 if ( iWaitTimer->IsActive() ) |
|
2001 { |
|
2002 PRINT( _L( "Camera <> timer already active" ) ) |
|
2003 iWaitTimer->Cancel(); |
|
2004 } |
|
2005 PRINT( _L( "Camera <> start the exit timer" ) ) |
|
2006 iWaitTimer->Start( 0, 0, TCallBack( CallExit, this ) ); |
|
2007 break; |
|
2008 } |
|
2009 // ----------------------------------------------------- |
|
2010 case ECamEventOperationStateChanged: |
|
2011 { |
|
2012 PRINT( _L("Camera <> case ECamEventOperationStateChanged") ) |
|
2013 |
|
2014 switch ( iController.CurrentOperation() ) |
|
2015 { |
|
2016 case ECamFocusing: |
|
2017 UpdateCba(); |
|
2018 break; |
|
2019 case ECamCapturing: |
|
2020 iPreventActivePaletteDisplay = ETrue; |
|
2021 SetActivePaletteVisibility( EFalse ); |
|
2022 //Image capture has started. If postcaptureview is enabled assume that postcapture |
|
2023 //is next view. Thus if camera goes to background and comes back to foreground don't |
|
2024 //start viewfinder because it is not needed in postcapture view. If image capture fails |
|
2025 //or is canceled enabling viewfinder is possible. |
|
2026 if ( iView && ( iStillCaptureView == iView || iVideoCaptureView == iView ) |
|
2027 && ShowPostCaptureView() ) |
|
2028 { |
|
2029 SetAssumePostCaptureView( ETrue ); |
|
2030 } |
|
2031 break; |
|
2032 case ECamStandby: |
|
2033 //DismissMemoryNote(); |
|
2034 HandleStandbyEventL( aError ); |
|
2035 break; |
|
2036 case ECamNoOperation: |
|
2037 { |
|
2038 if( iPreventActivePaletteDisplay ) |
|
2039 { |
|
2040 iPreventActivePaletteDisplay = EFalse; |
|
2041 } |
|
2042 } |
|
2043 break; |
|
2044 default: |
|
2045 break; |
|
2046 } |
|
2047 break; |
|
2048 } |
|
2049 // ----------------------------------------------------- |
|
2050 case ECamEventRecordComplete: |
|
2051 { |
|
2052 PRINT( _L("Camera <> case ECamEventRecordComplete") ) |
|
2053 // Dismiss the saving video clip wait dialog |
|
2054 if ( iWaitDialog ) |
|
2055 { |
|
2056 iWaitDialog->ProcessFinishedL(); |
|
2057 //iWaitDialog = NULL; //ProcessFinishedL() will make iWaitDialog NULL asynchronously |
|
2058 } |
|
2059 |
|
2060 // switch on active palette recording is complete |
|
2061 if( ECamOrientationCamcorder == iCamOrientation |
|
2062 || ECamOrientationCamcorderLeft == iCamOrientation |
|
2063 || ECamOrientationPortrait == iCamOrientation ) |
|
2064 { |
|
2065 iPreventActivePaletteDisplay = EFalse; |
|
2066 if ( DrawPreCaptureCourtesyUI() ) |
|
2067 { |
|
2068 SetActivePaletteVisibility( ETrue ); |
|
2069 } |
|
2070 } |
|
2071 if ( iController.InCallOrRinging() && |
|
2072 iController.IntegerSettingValue( ECamSettingItemVideoShowCapturedVideo ) == ECamSettOn ) |
|
2073 { |
|
2074 // when video recording is stopped by incoming call |
|
2075 // and post capture view is turned on, post capture timer |
|
2076 // should only start after some user interaction |
|
2077 iDelayVideoPostCaptureTimeout = ETrue; |
|
2078 } |
|
2079 } //lint -fallthrough to switch to post capture view |
|
2080 // ----------------------------------------------------- |
|
2081 case ECamEventSnapshotReady: |
|
2082 { |
|
2083 PRINT( _L("Camera <> case ECamEventSnapshotReady") ) |
|
2084 |
|
2085 // If burst mode is active, do nothing until the whole burst completes |
|
2086 if ( IsBurstEnabled() ) |
|
2087 { |
|
2088 // handle error if necessary |
|
2089 HandleCameraErrorL( aError ); |
|
2090 |
|
2091 // Check if there was an error, and there were no successful |
|
2092 // captures. In this case, we will be staying in pre-capture view |
|
2093 // so allow the active palette to be displayed again |
|
2094 if ( aError != KErrNone && |
|
2095 iController.CurrentItemCount() == 0 ) |
|
2096 { |
|
2097 iPreventActivePaletteDisplay = EFalse; |
|
2098 SetActivePaletteVisibility( ETrue ); |
|
2099 } |
|
2100 |
|
2101 break; |
|
2102 } |
|
2103 // if the MMC has been removed while recording video to it, |
|
2104 // don't go to post-capture view |
|
2105 else if ( iMode == ECamControllerVideo |
|
2106 && iController.IntegerSettingValueUnfiltered( ECamSettingItemVideoMediaStorage ) |
|
2107 == ECamMediaStorageCard |
|
2108 && ( aError != KErrNone && aError != KErrDiskFull ) |
|
2109 && CamUtility::MemoryCardStatus() != ECamMemoryCardInserted ) |
|
2110 { |
|
2111 iTargetViewState = ECamViewStatePreCapture; |
|
2112 } |
|
2113 // if USB was connected while MMC or mass storage was used as storage, |
|
2114 // don't go to postcapture |
|
2115 else if ( CamUtility::IsUsbActive() && |
|
2116 ( iController.CurrentStorage() == ECamMediaStorageCard || |
|
2117 iController.CurrentStorage() == ECamMediaStorageMassStorage ) ) |
|
2118 { |
|
2119 iTargetViewState = ECamViewStatePreCapture; |
|
2120 } |
|
2121 else if ( iController.IsCaptureStoppedForUsb() && |
|
2122 ( iController.CurrentStorage() == ECamMediaStorageCard || |
|
2123 iController.CurrentStorage() == ECamMediaStorageMassStorage ) ) |
|
2124 { |
|
2125 PRINT( _L("Camera <> HandleControllerEventL ECamEventSnapshotReady: video stopped for usb" ) ); |
|
2126 iTargetViewState = ECamViewStatePreCapture; |
|
2127 } |
|
2128 // If there was an error (we have no snap), we must stay in pre-capture view |
|
2129 else if ( aError ) |
|
2130 { |
|
2131 iPreventActivePaletteDisplay = EFalse; |
|
2132 SetActivePaletteVisibility( ETrue ); |
|
2133 iController.SetCaptureKeyPressedWhileImageSaving(EFalse); |
|
2134 // To be able to continue viewfinding |
|
2135 iController.FreezeViewFinder( EFalse ); |
|
2136 |
|
2137 iTargetViewState = ECamViewStatePreCapture; |
|
2138 } |
|
2139 // If the user has the show captured image setting turned on. |
|
2140 // switch to post capture view (Except in burst mode) |
|
2141 else if ( ShowPostCaptureView() ) |
|
2142 { |
|
2143 if( iController.CaptureKeyPressedWhileImageSaving() ) |
|
2144 { |
|
2145 PRINT( _L("Camera <> HandleControllerEventL ECamEventSnapshotReady - Capture key pressed while saving ") ) |
|
2146 iController.SetCaptureKeyPressedWhileImageSaving(EFalse); |
|
2147 iTargetViewState = ECamViewStatePreCapture; |
|
2148 SetSuppressUIRiseOnViewfinderStart( ETrue ); |
|
2149 // To be able to continue viewfinding |
|
2150 iController.FreezeViewFinder( EFalse ); |
|
2151 } |
|
2152 else |
|
2153 { |
|
2154 if ( !CamUtility::IsBatteryPowerEmpty() ) |
|
2155 { |
|
2156 if ( iLensCoverExit ) |
|
2157 { |
|
2158 PRINT (_L ("Camera <> set target to precapture if Battery not Empty") ); |
|
2159 iTargetViewState = ECamViewStatePreCapture; |
|
2160 } |
|
2161 else |
|
2162 { |
|
2163 PRINT (_L ("Camera <> set target to postcapture if Battery not Empty") ); |
|
2164 iTargetViewState = ECamViewStatePostCapture; |
|
2165 |
|
2166 //We need to blank the precapture view CBA here to prevent |
|
2167 //blinking when changing back to precapture from postcapture |
|
2168 UpdateCba(); |
|
2169 } |
|
2170 } |
|
2171 } |
|
2172 } |
|
2173 |
|
2174 // Always switch to post capture view if self timer is enabled |
|
2175 else if ( iInSelfTimerMode != ECamSelfTimerDisabled ) |
|
2176 { |
|
2177 iTargetViewState = ECamViewStatePostCapture; |
|
2178 // ensure that the view doesn't switch to precapture view when |
|
2179 // ECamEventCaptureComplete is received |
|
2180 iSelfTimedCapture = ETrue; |
|
2181 } |
|
2182 // Otherwise, |
|
2183 // if not showing captured images go straight to pre capture view |
|
2184 // (Except in burst mode) |
|
2185 else |
|
2186 { |
|
2187 iTargetViewState = ECamViewStatePreCapture; |
|
2188 SetSuppressUIRiseOnViewfinderStart( ETrue ); |
|
2189 } |
|
2190 |
|
2191 // The app is not going to try to switch to post capture view at all |
|
2192 // so the array needs to be released now. |
|
2193 if ( iTargetViewState == ECamViewStatePreCapture ) |
|
2194 { |
|
2195 iController.ReleaseArray(); |
|
2196 } |
|
2197 |
|
2198 // If no view switch is needed make sure the cba is not disabled |
|
2199 // and the self timer is switched off |
|
2200 if ( ViewSwitchRequired() != ECamViewSwitch ) |
|
2201 { |
|
2202 if ( iInSelfTimerMode != ECamSelfTimerDisabled ) |
|
2203 { |
|
2204 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
2205 } |
|
2206 UpdateCba(); |
|
2207 } |
|
2208 TrySwitchViewL(); |
|
2209 |
|
2210 break; |
|
2211 } |
|
2212 // ----------------------------------------------------- |
|
2213 case ECamEventCaptureComplete: |
|
2214 { |
|
2215 PRINT( _L("Camera <> case ECamEventCaptureComplete") ) |
|
2216 // check if exit is required |
|
2217 if ( iController.CheckExitStatus() ) |
|
2218 { |
|
2219 PRINT( _L("Camera <> calling internal exit after checking exit status") ) |
|
2220 // The exit event is replacing the view switch, |
|
2221 // so release the array now |
|
2222 iController.ReleaseArray(); |
|
2223 InternalExitL(); |
|
2224 return; |
|
2225 } |
|
2226 if( ECamControllerImage == iMode ) |
|
2227 { |
|
2228 switch( iImageMode ) |
|
2229 { |
|
2230 // ----------------------------- |
|
2231 // If burst mode is active, |
|
2232 // only switch view when the whole burst completes |
|
2233 case ECamImageCaptureBurst: |
|
2234 { |
|
2235 // If there are images to show (i.e. user has not cancelled), |
|
2236 // switch to thumbnail view. "Show captured images" setting has no |
|
2237 // effect in burst mode |
|
2238 |
|
2239 if ( iController.CurrentItemCount() != 0 && !iController.IsCaptureStoppedForUsb() ) |
|
2240 { |
|
2241 iTargetViewState = ECamViewStateBurstThumbnail; |
|
2242 |
|
2243 // Normally iPreventActivePaletteDisplay is set to EFalse when |
|
2244 // postcture AP is shown, but in burst case that doesn't |
|
2245 // necessarily happen so do this here. |
|
2246 iPreventActivePaletteDisplay = EFalse; |
|
2247 } |
|
2248 // Otherwise, no images to show. Go straight to pre capture view. |
|
2249 else |
|
2250 { |
|
2251 iTargetViewState = ECamViewStatePreCapture; |
|
2252 // The app is not going to try to switch to post capture view at |
|
2253 // all. So the array needs to be released now. |
|
2254 iController.ReleaseArray(); |
|
2255 iController.StopViewFinder(); |
|
2256 iController.StartViewFinder(); |
|
2257 } |
|
2258 // If no view switch is needed make sure the cba is not disabled |
|
2259 // and the self timer is switched off |
|
2260 if ( ViewSwitchRequired() != ECamViewSwitch ) |
|
2261 { |
|
2262 if ( iInSelfTimerMode != ECamSelfTimerDisabled ) |
|
2263 { |
|
2264 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
2265 } |
|
2266 UpdateCba(); |
|
2267 } |
|
2268 |
|
2269 TrySwitchViewL(); |
|
2270 break; |
|
2271 } |
|
2272 // ----------------------------- |
|
2273 case ECamImageCaptureTimeLapse: |
|
2274 { |
|
2275 iTargetViewState = ECamViewStatePostCapture; |
|
2276 TrySwitchViewL(); |
|
2277 break; |
|
2278 } |
|
2279 // ----------------------------- |
|
2280 case ECamImageCaptureSingle: |
|
2281 { |
|
2282 PRINT( _L("Camera <> case ECamImageCaptureSingle") ) |
|
2283 if( aError != KErrNone ) |
|
2284 { |
|
2285 PRINT( _L("Camera <> error received") ) |
|
2286 // handle error if necessary |
|
2287 HandleCameraErrorL( aError ); |
|
2288 |
|
2289 iPreventActivePaletteDisplay = EFalse; |
|
2290 SetActivePaletteVisibility( ETrue ); |
|
2291 |
|
2292 if (iCamOrientation == ECamOrientationPortrait) |
|
2293 { |
|
2294 iTargetViewState = ECamViewStatePrePortraitCapture; |
|
2295 } |
|
2296 else |
|
2297 { |
|
2298 iTargetViewState = ECamViewStatePreCapture; |
|
2299 } |
|
2300 TrySwitchViewL(); |
|
2301 } |
|
2302 else |
|
2303 { |
|
2304 PRINT( _L("Camera <> no errors in") ) |
|
2305 if ( !ShowPostCaptureView() && |
|
2306 iInSelfTimerMode == ECamSelfTimerDisabled && |
|
2307 !IsSelfTimedCapture() ) |
|
2308 { |
|
2309 PRINT( _L("Camera <> update cba") ) |
|
2310 UpdateCba(); |
|
2311 if( ActiveCamera() != ECamActiveCameraPrimary ) |
|
2312 { |
|
2313 PRINT( _L("Camera <> release array") ) |
|
2314 iController.ReleaseArray(); |
|
2315 } |
|
2316 iPreventActivePaletteDisplay = EFalse; |
|
2317 SetActivePaletteVisibility( ETrue ); |
|
2318 if ( iController.IsTouchScreenSupported() ) |
|
2319 { |
|
2320 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
2321 if ( fixedToolbar ) |
|
2322 { |
|
2323 fixedToolbar->SetToolbarVisibility( ETrue ); |
|
2324 } |
|
2325 } |
|
2326 HandleCommandL( ECamCmdRaiseCourtesyUI ); |
|
2327 if ( IsSecondCameraEnabled() || IsEmbedded() ) |
|
2328 { |
|
2329 //For secondary or embedded camera the viewfinder |
|
2330 //was stopped. Restart it now. |
|
2331 iController.StartViewFinder(); |
|
2332 } |
|
2333 } |
|
2334 else if ( !ShowPostCaptureView() && |
|
2335 iInSelfTimerMode != ECamSelfTimerDisabled ) |
|
2336 { |
|
2337 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
2338 } |
|
2339 } |
|
2340 break; |
|
2341 } |
|
2342 // ----------------------------- |
|
2343 default: |
|
2344 { |
|
2345 // do nothing |
|
2346 break; |
|
2347 } |
|
2348 // ----------------------------- |
|
2349 } |
|
2350 } |
|
2351 // reset the selftimed capture flag for next capture |
|
2352 PRINT( _L("resetting iSelfTimedCapture") ) |
|
2353 iSelfTimedCapture = EFalse; |
|
2354 break; |
|
2355 } |
|
2356 // ----------------------------- |
|
2357 case ECamEventControllerReady: |
|
2358 { |
|
2359 if ( iView ) |
|
2360 { |
|
2361 if ( iFirstBoot && IsSecondCameraEnabled() |
|
2362 && IsQwerty2ndCamera() |
|
2363 && CurrentViewState() != ECamViewStateStandby ) |
|
2364 { |
|
2365 PRINT( _L("Camera <> Booting directly to the secondary camera") ) |
|
2366 // Main camera settings are loades as default. |
|
2367 // Need to be updated to secondary |
|
2368 iStillCaptureView->CreateAndSetToolbarL( |
|
2369 R_CAM_STILL_PRECAPTURE_TOOLBAR_LANDSCAPE ); |
|
2370 iVideoCaptureView->CreateAndSetToolbarL( |
|
2371 R_CAM_VIDEO_PRECAPTURE_TOOLBAR_LANDSCAPE ); |
|
2372 // Add toolbar observer. Needed in first boot to secondary |
|
2373 SetPreCaptureMode( ECamPreCapViewfinder ); |
|
2374 } |
|
2375 iFirstBoot = EFalse; |
|
2376 iView->HandleCommandL( ECamCmdPopUpMenuZoom ); |
|
2377 } |
|
2378 //Remaining recording time counter update needed when recording has stopped and |
|
2379 //show last captured video setting is off. |
|
2380 if( iNaviPaneCounterControl && !ShowPostCaptureView() && iMode == ECamControllerVideo ) |
|
2381 { |
|
2382 iNaviPaneCounterControl->ForceNaviPaneUpdate(); |
|
2383 } |
|
2384 break; |
|
2385 } |
|
2386 // ----------------------------- |
|
2387 // ----------------------------------------------------- |
|
2388 // The MMC is removed |
|
2389 case ECamEventMemoryCardHotswap: |
|
2390 { |
|
2391 TBool mmcInUse = EFalse; |
|
2392 |
|
2393 TCamMediaStorage currentLocation = |
|
2394 static_cast<TCamMediaStorage>( |
|
2395 iController.IntegerSettingValueUnfiltered( |
|
2396 ECamSettingItemVideoMediaStorage ) ); |
|
2397 |
|
2398 // if app is in back show MMC note on returning to foreground |
|
2399 PRINT( _L("Camera => CCamAppUi::HandleControllerEventL ECamEventMMCHotswap") ) |
|
2400 if ( currentLocation == ECamMediaStorageCard ) |
|
2401 { |
|
2402 if ( AppInBackground( ETrue ) && iReturnFromBackground ) |
|
2403 { |
|
2404 PRINT( _L("Camera => CCamAppUi::HandleControllerEventL ECamEventMMCHotswap bckgrn") ) |
|
2405 //iMMCRemoveNoteRequired = ETrue; |
|
2406 |
|
2407 // Force use of phone memory. |
|
2408 // with multiple drive support, |
|
2409 // this actually uses the internal mass memory |
|
2410 iController.UsePhoneMemoryL(); |
|
2411 } |
|
2412 else // show note on next capture attempt |
|
2413 { |
|
2414 PRINT( _L("Camera => CCamAppUi::HandleControllerEventL ECamEventMMCHotswap not bckgrnd") ) |
|
2415 iMMCRemoveNoteRequiredOnCapture = ETrue; |
|
2416 |
|
2417 // force update of navi pane |
|
2418 iNaviPaneCounterControl->ForceNaviPaneUpdate(); |
|
2419 if ( IsDirectViewfinderActive() ) |
|
2420 { |
|
2421 TRAP_IGNORE( HandleCommandL( ECamCmdRedrawScreen ) ); |
|
2422 } |
|
2423 } |
|
2424 } |
|
2425 |
|
2426 // if the current mode is video, and the storage location is MMC |
|
2427 if ( ECamControllerVideo == iMode ) |
|
2428 { |
|
2429 mmcInUse = (ECamMediaStorageCard == currentLocation); |
|
2430 } |
|
2431 // if the current mode is still, and the storage location is MMC |
|
2432 else |
|
2433 { |
|
2434 mmcInUse = ( ECamMediaStorageCard == |
|
2435 iController.IntegerSettingValueUnfiltered( |
|
2436 ECamSettingItemPhotoMediaStorage ) ); |
|
2437 } |
|
2438 |
|
2439 // If a post capture view is active, and the current files |
|
2440 // are saved to the MMC, switch to pre capture view |
|
2441 if ( mmcInUse |
|
2442 && ( ECamViewStateBurstThumbnail == iViewState |
|
2443 || ECamViewStatePostCapture == iViewState ) |
|
2444 ) |
|
2445 { |
|
2446 if (iCamOrientation == ECamOrientationPortrait) |
|
2447 { |
|
2448 iTargetViewState = ECamViewStatePrePortraitCapture; |
|
2449 } |
|
2450 else |
|
2451 { |
|
2452 iTargetViewState = ECamViewStatePreCapture; |
|
2453 } |
|
2454 TrySwitchViewL(); |
|
2455 } |
|
2456 break; |
|
2457 } |
|
2458 // ----------------------------------------------------- |
|
2459 case ECamEventCounterUpdated: |
|
2460 break; |
|
2461 // ----------------------------------------------------- |
|
2462 case ECamEventVideoPauseTimeout: |
|
2463 { |
|
2464 PRINT( _L( "Camera <> case ECamEventVideoPauseTimeout" ) ) |
|
2465 EndCapture(); |
|
2466 break; |
|
2467 } |
|
2468 // ----------------------------------------------------- |
|
2469 case ECamEventSaveLocationChanged: |
|
2470 { |
|
2471 PRINT( _L( "Camera <> case ECamEventSaveLocationChanged" ) ) |
|
2472 if ( IsMMCRemovedNotePending() && |
|
2473 ( CamUtility::MemoryCardStatus() != ECamMemoryCardNotInserted ) ) |
|
2474 { |
|
2475 iMMCRemoveNoteRequired = EFalse; |
|
2476 iMMCRemoveNoteRequiredOnCapture = EFalse; |
|
2477 } |
|
2478 if ( IsDirectViewfinderActive() ) |
|
2479 { |
|
2480 TRAP_IGNORE( HandleCommandL( ECamCmdRedrawScreen ) ); |
|
2481 } |
|
2482 break; |
|
2483 } |
|
2484 |
|
2485 // ----------------------------------------------------- |
|
2486 case ECamEventSaveComplete: |
|
2487 { |
|
2488 PRINT( _L( "Camera <> case ECamEventSaveComplete" ) ) |
|
2489 if ( ECamImageCaptureSingle == iImageMode ) |
|
2490 { |
|
2491 if( iController.CaptureKeyPressedWhileImageSaving() && |
|
2492 ShowPostCaptureView()) |
|
2493 { |
|
2494 PRINT( _L("Camera <> HandleControllerEventL ECamEventSaveComplete - Capture key pressed while saving ") ) |
|
2495 iController.SetCaptureKeyPressedWhileImageSaving(EFalse); |
|
2496 if (iCamOrientation == ECamOrientationPortrait) |
|
2497 { |
|
2498 iTargetViewState = ECamViewStatePrePortraitCapture; |
|
2499 } |
|
2500 else |
|
2501 { |
|
2502 iTargetViewState = ECamViewStatePreCapture; |
|
2503 } |
|
2504 TrySwitchViewL(); |
|
2505 } |
|
2506 } |
|
2507 break; |
|
2508 } |
|
2509 // ----------------------------------------------------- |
|
2510 case ECamEventMediaFileChanged: |
|
2511 { |
|
2512 |
|
2513 if ( iController.UiConfigManagerPtr() && |
|
2514 !iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
2515 { |
|
2516 PRINT2( _L( "Camera <> CCamAppU, ECamEventMediaFileChanged, mode [%s], targetmode[%s]" ), |
|
2517 KCamModeNames[ iController.CurrentMode() ], |
|
2518 KCamModeNames[ iController.TargetMode() ] ) |
|
2519 |
|
2520 if( iEndKeyPressed ) |
|
2521 { |
|
2522 if ( iController.CurrentMode() == ECamControllerShutdown || |
|
2523 iController.IsInShutdownMode() ) |
|
2524 { |
|
2525 PRINT( _L( "Camera <> ECamEventMediaFileChanged, notify shutdown" ) ) |
|
2526 HandleControllerEventL( ECamEventExitRequested, KErrNone ); |
|
2527 } |
|
2528 } |
|
2529 } |
|
2530 |
|
2531 if ( iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
2532 { |
|
2533 // If record location setting is on, stop location trail |
|
2534 if ( ECamViewStatePreCapture != iViewState && ECamLocationOn == iController.IntegerSettingValue( ECamSettingItemRecLocation ) ) |
|
2535 { |
|
2536 PRINT( _L("Camera: Gallery notified and non pre-capture view, stop location trail") ) |
|
2537 iController.StopLocationTrail(); |
|
2538 } |
|
2539 else |
|
2540 { |
|
2541 PRINT1( _L("Camera: location trail not in use or view state (%d) is precapture"), iViewState ) |
|
2542 } |
|
2543 } |
|
2544 |
|
2545 break; |
|
2546 } |
|
2547 // ----------------------------------------------------- |
|
2548 case ECamEventCameraChanged: |
|
2549 { |
|
2550 PRINT( _L("Camera <> case ECamEventCameraChanged")) |
|
2551 // exit standby and use the new camera |
|
2552 if( iView) |
|
2553 { |
|
2554 iView->HandleCommandL( ECamCmdExitStandby ); |
|
2555 } |
|
2556 break; |
|
2557 } |
|
2558 // ----------------------------------------------------- |
|
2559 case ECamEventInvalidMemoryCard: |
|
2560 { |
|
2561 PRINT( _L( "Camera <> case ECamEventInvalidMemoryCard" ) ); |
|
2562 ShowErrorNoteL( ECamMemoryStatusCardNotInserted ); |
|
2563 break; |
|
2564 } |
|
2565 // ----------------------------------------------------- |
|
2566 case ECamEventRestoreCameraSettings: |
|
2567 { |
|
2568 PRINT( _L( "Camera <> case ECamEventRestoreCameraSettings" ) ); |
|
2569 if ( SettingsLaunchedFromCamera() ) |
|
2570 { |
|
2571 iSettingsPluginLaunched = EFalse; |
|
2572 iReturnedFromPlugin = ETrue; |
|
2573 } |
|
2574 iTargetViewState = ECamViewStatePreCapture; |
|
2575 |
|
2576 // get start up mode from settings |
|
2577 if ( StartupMode() == ECamStillCapture ) |
|
2578 { |
|
2579 iMode = ECamControllerImage; |
|
2580 iTargetMode = ECamControllerImage; |
|
2581 SetDefaultViewL( *iStillCaptureView ); |
|
2582 } |
|
2583 else |
|
2584 { |
|
2585 iMode = ECamControllerVideo; |
|
2586 iTargetMode = ECamControllerVideo; |
|
2587 SetDefaultViewL( *iVideoCaptureView ); |
|
2588 } |
|
2589 |
|
2590 TrySwitchViewL(); |
|
2591 break; |
|
2592 } |
|
2593 // ----------------------------------------------------- |
|
2594 case ECamEventCallStateChanged: |
|
2595 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
2596 break; |
|
2597 // ----------------------------------------------------- |
|
2598 default: |
|
2599 break; |
|
2600 // ----------------------------------------------------- |
|
2601 } |
|
2602 PRINT( _L( "Camera: <= CCamAppUi::HandleControllerEventL()" ) ); |
|
2603 } |
|
2604 |
|
2605 // ----------------------------------------------------------------------------- |
|
2606 // HandleStandbyEventL |
|
2607 // ----------------------------------------------------------------------------- |
|
2608 // |
|
2609 void |
|
2610 CCamAppUi::HandleStandbyEventL( TInt aStatus ) |
|
2611 { |
|
2612 PRINT( _L( "Camera => CCamAppUi::HandleStandbyEventL") ); |
|
2613 if( !iPretendExit && |
|
2614 !AppInBackground( EFalse ) ) |
|
2615 { |
|
2616 if( ECamViewStateStandby != iViewState ) |
|
2617 { |
|
2618 DismissMemoryNoteL(); |
|
2619 |
|
2620 if( IsInternalView( iViewState ) ) |
|
2621 { |
|
2622 |
|
2623 if ( aStatus != KErrInUse && |
|
2624 iPreCaptureMode == ECamPreCapCaptureSetup || |
|
2625 iPreCaptureMode == ECamPreCapSceneSetting ) |
|
2626 { |
|
2627 // VF settings does not go to standby state, VF is stopped instead |
|
2628 // Screen saver releases resources |
|
2629 iViewFinderStopped = ETrue; |
|
2630 PRINT( _L( "Camera <> CCamAppUi::HandleStandbyEventL: in one of settings view. Release camera") ); |
|
2631 iController.ReleaseCamera(); |
|
2632 //Draw black viewfinder area. Because camera is in internal viewstate view is valid. |
|
2633 static_cast<CCamViewBase*>( iView )->HandleCommandL( ECamCmdRedrawScreen ); |
|
2634 } |
|
2635 else |
|
2636 { |
|
2637 PRINT( _L( "Camera <> CCamAppUi::HandleStandbyEventL: call iView->ExitAllModesL") ); |
|
2638 PRINT1( _L( "Camera <> CCamAppUi::HandleStandbyEventL: iView = 0x%x"), iView ); |
|
2639 // Exit any special modes. |
|
2640 // If AppUI construction is not finished, do it first, otherwise |
|
2641 // the view has not been created yet |
|
2642 if ( iController.UiConfigManagerPtr() && |
|
2643 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() && |
|
2644 !iUiConstructionComplete ) |
|
2645 { |
|
2646 CompleteAppUIConstructionL(); |
|
2647 } |
|
2648 else |
|
2649 { |
|
2650 static_cast<CCamViewBase*>( iView )->ExitAllModesL(); |
|
2651 } |
|
2652 |
|
2653 } |
|
2654 } |
|
2655 // Not InternalView |
|
2656 else |
|
2657 { |
|
2658 PRINT( _L( "Camera <= CCamAppUi::HandleStandbyEventL: Not internalView, standby ignored, return") ); |
|
2659 return; |
|
2660 } |
|
2661 |
|
2662 // VF settings does not go to standby state, VF is stopped instead |
|
2663 if ( aStatus == KErrInUse || iPreCaptureMode != ECamPreCapCaptureSetup && |
|
2664 iPreCaptureMode != ECamPreCapSceneSetting ) |
|
2665 { |
|
2666 PRINT( _L( "Camera <> CCamAppUi::HandleStandbyEventL: Set standby status..") ); |
|
2667 SetStandbyStatus( aStatus ); |
|
2668 if ( iController.InVideocallOrRinging() && iScreenClearer ) |
|
2669 { |
|
2670 delete iScreenClearer; |
|
2671 iScreenClearer = NULL; |
|
2672 } |
|
2673 |
|
2674 PRINT( _L( "Camera <> CCamAppUi::HandleStandbyEventL: Send command ECamCmdGoToStandby..") ); |
|
2675 HandleCommandL( ECamCmdGoToStandby ); |
|
2676 } |
|
2677 } |
|
2678 else |
|
2679 { |
|
2680 PRINT( _L( "Camera <> CCamAppUi::HandleStandbyEventL: Already in standby, ignored!") ); |
|
2681 } |
|
2682 } |
|
2683 else |
|
2684 { |
|
2685 PRINT( _L( "Camera <> CCamAppUi::HandleStandbyEventL: Camera already in background, no action..") ); |
|
2686 } |
|
2687 PRINT( _L( "Camera <= CCamAppUi::HandleStandbyEventL") ); |
|
2688 } |
|
2689 |
|
2690 // ----------------------------------------------------------------------------- |
|
2691 // SetStandbyStatus |
|
2692 // ----------------------------------------------------------------------------- |
|
2693 // |
|
2694 void CCamAppUi::SetStandbyStatus( TInt aStatus ) |
|
2695 { |
|
2696 PRINT1( _L( "Camera =><= CCamAppUi::SetStandbyStatus( %d )"), aStatus ); |
|
2697 iStandbyStatus = aStatus; |
|
2698 } |
|
2699 |
|
2700 // ----------------------------------------------------------------------------- |
|
2701 // StandbyStatus |
|
2702 // ----------------------------------------------------------------------------- |
|
2703 // |
|
2704 TInt CCamAppUi::StandbyStatus() const |
|
2705 { |
|
2706 return iStandbyStatus; |
|
2707 } |
|
2708 |
|
2709 // --------------------------------------------------------- |
|
2710 // CCamAppUi::IsEmbedded |
|
2711 // Retrun whether we are embedded or not |
|
2712 // --------------------------------------------------------- |
|
2713 // |
|
2714 TBool CCamAppUi::IsEmbedded() const |
|
2715 { |
|
2716 PRINT( _L("Camera => CCamAppUi::IsEmbedded") ); |
|
2717 /*#ifndef __WINS__ |
|
2718 PRINT1( _L("CCamAppUi::IsEmbedded %d"), iSendFileInCall ); |
|
2719 // treat inCallSend mode as same as embedded |
|
2720 if( iSendFileInCall ) |
|
2721 { |
|
2722 PRINT( _L("CCamAppUi::IsEmbedded iCall" ) ); |
|
2723 return ETrue; |
|
2724 } |
|
2725 #endif*/ |
|
2726 PRINT( _L("Camera <= CCamAppUi::IsEmbedded") ); |
|
2727 return iEikonEnv->StartedAsServerApp(); |
|
2728 } |
|
2729 |
|
2730 |
|
2731 // --------------------------------------------------------- |
|
2732 // --------------------------------------------------------- |
|
2733 // CCamAppUi::HandleWsEventL |
|
2734 // Handle a window server event. Used to handle focus loss |
|
2735 // --------------------------------------------------------- |
|
2736 // |
|
2737 void |
|
2738 CCamAppUi::HandleWsEventL( const TWsEvent& aEvent, |
|
2739 CCoeControl* aDestination ) |
|
2740 { |
|
2741 |
|
2742 TInt type = aEvent.Type(); |
|
2743 |
|
2744 PRINT1( _L("Camera => CCamAppUi::HandleWsEventL (type: %d)"), type ) |
|
2745 // In case we receive an enter key event, we should map it to MSK |
|
2746 if ( aEvent.Type() == EEventKey && aEvent.Key()->iRepeats == 0 && |
|
2747 aEvent.Key()->iScanCode == EStdKeyEnter && |
|
2748 !( iMode == ECamControllerVideo && iViewState == ECamViewStatePreCapture && iController.IsDemandKeyRelease() ) ) |
|
2749 { |
|
2750 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: mapping enter to MSK") ); |
|
2751 // Gets the window group id of the app in foreground |
|
2752 TInt windowGroupId = iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
2753 // if the foreground app is this app |
|
2754 if ( windowGroupId == iMyWgId ) |
|
2755 { |
|
2756 // enter key should be mapped to MSK. |
|
2757 TWsEvent ownEvent = aEvent; |
|
2758 ownEvent.Key()->iScanCode = EStdKeyDevice3; |
|
2759 ownEvent.Key()->iCode = EKeyOK; |
|
2760 iCoeEnv->WsSession().SendEventToWindowGroup(windowGroupId, ownEvent); |
|
2761 } |
|
2762 } |
|
2763 // in case we receive a long press of applications key when the self timer is |
|
2764 // enabled, we should cancel the self timer |
|
2765 else if ( aEvent.Type() == EEventKey && |
|
2766 aEvent.Key()->iScanCode == EStdKeyApplication0 && |
|
2767 aEvent.Key()->iRepeats > 0 && |
|
2768 SelfTimerEnabled() ) |
|
2769 { |
|
2770 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
2771 } |
|
2772 // in other cases do the normal handling |
|
2773 else |
|
2774 { |
|
2775 |
|
2776 switch ( type ) |
|
2777 { |
|
2778 // a new window group has the focus |
|
2779 case EEventFocusGroupChanged: |
|
2780 { |
|
2781 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusGroupChanged") ); |
|
2782 |
|
2783 // When camera looses its focus after going to background |
|
2784 // during the state of ViaPlayer play back mode |
|
2785 // we dont perform any operation; but return directly |
|
2786 if ( iViewState == ECamViewStateViaPlayer ) |
|
2787 { |
|
2788 // We call the base class and return |
|
2789 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
2790 return; |
|
2791 } |
|
2792 |
|
2793 // When camera looses its focus after going to background |
|
2794 // we return to the same settings page that was before |
|
2795 if ( SettingsLaunchedFromCamera() ) |
|
2796 { |
|
2797 // We call the base class and return |
|
2798 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
2799 return; |
|
2800 } |
|
2801 // we are going to background no need for harvester callbacks. |
|
2802 iController.DeRegisterHarverterClientEvents(); |
|
2803 |
|
2804 if ( AppInBackground( ETrue ) && iPretendExit ) |
|
2805 { |
|
2806 //Make the current container invisible to prevent windowserver from bringing it to front |
|
2807 //before the foreground event. |
|
2808 TVwsViewId currentViewId; |
|
2809 GetActiveViewId( currentViewId ); |
|
2810 switch ( currentViewId.iViewUid.iUid ) |
|
2811 { |
|
2812 case ECamViewIdStillPreCapture: |
|
2813 { |
|
2814 if( iStillCaptureView->Container() && |
|
2815 !APHandler()->AccessedViaAP() ) |
|
2816 { |
|
2817 iStillCaptureView->Container()->MakeVisible( EFalse ); |
|
2818 } |
|
2819 iLastHiddenViewId = currentViewId.iViewUid; |
|
2820 break; |
|
2821 } |
|
2822 case ECamViewIdStillPostCapture: |
|
2823 { |
|
2824 CCamStillPostCaptureView* stillPostCaptureView = |
|
2825 ((CCamStillPostCaptureView*)View( currentViewId.iViewUid )); |
|
2826 if( stillPostCaptureView && stillPostCaptureView->Container() ) |
|
2827 { |
|
2828 stillPostCaptureView->Container()->MakeVisible( EFalse ); |
|
2829 } |
|
2830 iLastHiddenViewId = currentViewId.iViewUid; |
|
2831 break; |
|
2832 } |
|
2833 case ECamViewIdVideoPreCapture: |
|
2834 { |
|
2835 if( iVideoCaptureView->Container() && |
|
2836 !APHandler()->AccessedViaAP() ) |
|
2837 { |
|
2838 iVideoCaptureView->Container()->MakeVisible( EFalse ); |
|
2839 } |
|
2840 iLastHiddenViewId = currentViewId.iViewUid; |
|
2841 break; |
|
2842 } |
|
2843 case ECamViewIdVideoPostCapture: |
|
2844 { |
|
2845 CCamVideoPostCaptureView* videoPostCaptureView = |
|
2846 ((CCamVideoPostCaptureView*)View( currentViewId.iViewUid )); |
|
2847 if( videoPostCaptureView && videoPostCaptureView->Container() ) |
|
2848 { |
|
2849 videoPostCaptureView->Container()->MakeVisible( EFalse ); |
|
2850 } |
|
2851 iLastHiddenViewId = currentViewId.iViewUid; |
|
2852 break; |
|
2853 } |
|
2854 default: |
|
2855 break; |
|
2856 } |
|
2857 } |
|
2858 |
|
2859 // if the application has gone to the background |
|
2860 // note this does not include eikon server windows |
|
2861 // The exception to this is when the slider is closed with keypad |
|
2862 // lock active and the app grid opens with a keypad status note. |
|
2863 // We know in this situation that the app should release resources. |
|
2864 if ( AppInBackground( EFalse ) || |
|
2865 ( AppInBackground( ETrue ) && iPretendExit ) ) |
|
2866 { |
|
2867 PRINT( _L("Camera <> AppUI EEventFocusGroupChanged A")) |
|
2868 // when we return to foreground we use this boolean to |
|
2869 // check if we have to still exit the settings modes e.g. |
|
2870 // UserScene or SceneSettings that we are in when screen saver |
|
2871 // comes or going InternalExit |
|
2872 iLostFocusToNewWindow = ETrue; |
|
2873 |
|
2874 // Handle losing focus to another application |
|
2875 // this is used for behaviour that does not need to occur |
|
2876 // when views go to the background for another view within our |
|
2877 // own application. Also for when the application was behind |
|
2878 // an eikon server window but another application has now taken |
|
2879 // the foreground |
|
2880 |
|
2881 if( iView && iReturnedFromPlugin ) |
|
2882 { |
|
2883 PRINT( _L("Camera <> AppUI EEventFocusGroupChanged B")) |
|
2884 static_cast<CCamViewBase*>( iView )->HandleFocusLossL(); |
|
2885 } |
|
2886 |
|
2887 // the application knows it is in the background so we are |
|
2888 // not interested in any more events |
|
2889 iCoeEnv->RootWin().DisableFocusChangeEvents(); |
|
2890 // disable timeout to standby when going to background |
|
2891 iController.StopIdleTimer(); |
|
2892 |
|
2893 // We need to know if we gain focus from a true background event |
|
2894 iReturnFromBackground = ETrue; |
|
2895 // Sent to the background, so compress the heap |
|
2896 User::Heap().Compress(); |
|
2897 |
|
2898 // stop listening mmc dismount notifications |
|
2899 iController.CancelDismountMonitoring(); |
|
2900 |
|
2901 #if !defined (__WINSCW__) |
|
2902 if ( AppInBackground( ETrue ) ) |
|
2903 { |
|
2904 // relinquish capture keys |
|
2905 UnRegisterCaptureKeys(); |
|
2906 } |
|
2907 #endif |
|
2908 } |
|
2909 |
|
2910 if( AppInBackground(EFalse) || ( !CamUtility::IsBatteryPowerOK() && |
|
2911 !CamUtility::IsBatteryCharging() ) ) |
|
2912 { |
|
2913 if( ECamControllerVideo == iMode ) |
|
2914 { |
|
2915 TCamCaptureOperation operation( iController.CurrentOperation() ); |
|
2916 // In case of phone app, video rec is stopped already when the call starts ringing |
|
2917 if ( ( !iController.CurrentlySavingVideo() ) && |
|
2918 ( ECamCapturing == operation |
|
2919 || ECamPaused == operation |
|
2920 || ECamPausing == operation |
|
2921 || ECamResuming == operation ) ) |
|
2922 { |
|
2923 iController.StopVideoRecording(); |
|
2924 } |
|
2925 } |
|
2926 else if( iController.SequenceCaptureInProgress() && IsBurstEnabled() ) |
|
2927 { |
|
2928 iController.StopSequenceCaptureL(); |
|
2929 } |
|
2930 else |
|
2931 { |
|
2932 if( iController.IsViewFinding() ) |
|
2933 { |
|
2934 if(CamUtility::IsBatteryPowerOK() ) |
|
2935 { |
|
2936 iController.StopViewFinder(); |
|
2937 iViewFinderStopped = ETrue; |
|
2938 } |
|
2939 // stop self timer countdown if necessary |
|
2940 if( SelfTimer() && SelfTimer()->IsActive() && |
|
2941 CamUtility::IsBatteryPowerOK() ) |
|
2942 { |
|
2943 // If low battery note appears, do not cancel self timer |
|
2944 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
2945 } |
|
2946 } |
|
2947 } |
|
2948 } |
|
2949 break; |
|
2950 } |
|
2951 // ----------------------------------------------------- |
|
2952 // the camera app has regained the focus |
|
2953 case EEventFocusGained: |
|
2954 { |
|
2955 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusGained") ); |
|
2956 TBool uiOverride = iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported(); |
|
2957 |
|
2958 if ( !iSendAsInProgress ) |
|
2959 { |
|
2960 // if we've regained focus assume we're not embedding anything |
|
2961 SetEmbedding( EFalse ); |
|
2962 } |
|
2963 |
|
2964 //Make the current container visible again. This way the camera ui doesn't flash quickly in the portait mode |
|
2965 //when returning from the background. unless this is first startup and uiorientationioverride api is used |
|
2966 if ( !uiOverride || ( !iFirstBoot && uiOverride ) ) |
|
2967 { |
|
2968 switch ( iLastHiddenViewId.iUid ) |
|
2969 { |
|
2970 case ECamViewIdStillPreCapture: |
|
2971 { |
|
2972 if( iStillCaptureView->Container() |
|
2973 && !APHandler()->AccessedViaAP()) |
|
2974 { |
|
2975 iStillCaptureView->Container()->MakeVisible( ETrue ); |
|
2976 } |
|
2977 break; |
|
2978 } |
|
2979 case ECamViewIdStillPostCapture: |
|
2980 { |
|
2981 CCamStillPostCaptureView* stillPostCaptureView = |
|
2982 ((CCamStillPostCaptureView*)View( iLastHiddenViewId )); |
|
2983 if( stillPostCaptureView && stillPostCaptureView->Container() ) |
|
2984 { |
|
2985 stillPostCaptureView->Container()->MakeVisible( ETrue ); |
|
2986 } |
|
2987 break; |
|
2988 } |
|
2989 case ECamViewIdVideoPreCapture: |
|
2990 { |
|
2991 if( iVideoCaptureView->Container() |
|
2992 && !APHandler()->AccessedViaAP()) |
|
2993 { |
|
2994 iVideoCaptureView->Container()->MakeVisible( ETrue ); |
|
2995 } |
|
2996 break; |
|
2997 } |
|
2998 case ECamViewIdVideoPostCapture: |
|
2999 { |
|
3000 CCamVideoPostCaptureView* videoPostCaptureView = |
|
3001 ((CCamVideoPostCaptureView*)View( iLastHiddenViewId )); |
|
3002 if( videoPostCaptureView && videoPostCaptureView->Container() ) |
|
3003 { |
|
3004 videoPostCaptureView->Container()->MakeVisible( ETrue ); |
|
3005 } |
|
3006 break; |
|
3007 } |
|
3008 default: |
|
3009 break; |
|
3010 } |
|
3011 } |
|
3012 // focus gained event is received while videocall is active |
|
3013 if ( iController.InVideocallOrRinging() ) |
|
3014 { |
|
3015 if ( ECamViewStateStandby == iViewState && |
|
3016 StandbyStatus() == KErrInUse ) |
|
3017 { |
|
3018 // We call the base class and return |
|
3019 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3020 return; |
|
3021 } |
|
3022 else if ( iViewState != ECamViewStateSettings && |
|
3023 iViewState != ECamViewStateViaPlayer && |
|
3024 iTargetViewState != ECamViewStatePostCapture && |
|
3025 !iFirstBoot ) |
|
3026 { |
|
3027 //Don't update task state in case of embedded camera |
|
3028 if ( !iEikonEnv->StartedAsServerApp()) |
|
3029 { |
|
3030 HideTaskL( EFalse ); |
|
3031 } |
|
3032 iPretendExit = EFalse; |
|
3033 // Go to standby with error |
|
3034 HandleStandbyEventL( KErrInUse ); |
|
3035 // We call the base class and return |
|
3036 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3037 return; |
|
3038 } |
|
3039 } |
|
3040 // Only do startup performance traces if this is |
|
3041 // a subsequent startup. |
|
3042 if ( IsInPretendExit() ) |
|
3043 { |
|
3044 OstTrace0( CAMERAAPP_PERFORMANCE, CCAMAPPUI_HANDLEWSEVENTL, "e_CAM_APP_INIT 1" ); //CCORAPP_APP_INIT_START |
|
3045 } |
|
3046 |
|
3047 PERF_EVENT_START_L1( EPerfEventAppSubsequentStartup ); |
|
3048 |
|
3049 // start listening mmc dismount notifications |
|
3050 iController.StartDismountMonitoring(); |
|
3051 |
|
3052 if ( !uiOverride || ( !iFirstBoot && uiOverride ) ) |
|
3053 { |
|
3054 NotifyViews( ECamAppEventFocusGained ); |
|
3055 if( !uiOverride ) |
|
3056 { |
|
3057 // whenever we come from background, we reset the image, |
|
3058 // video & common settings as there is a possibility that |
|
3059 // some settings might have changed from the GS application |
|
3060 // by the user. |
|
3061 iController.LoadStaticSettingsL( IsEmbedded() ); |
|
3062 } |
|
3063 |
|
3064 iStillCaptureView->UpdateToolbarIconsL(); |
|
3065 if( !uiOverride ) |
|
3066 { |
|
3067 //check for silent profile whenever we come to foreground. |
|
3068 iController.IsProfileSilent(); |
|
3069 } |
|
3070 } |
|
3071 |
|
3072 //Check existance of current file if in video or image in |
|
3073 //burstthumbnail view. |
|
3074 if( CurrentViewState() == ECamViewStateBurstThumbnail ) |
|
3075 { |
|
3076 StartFileNameCheck(); |
|
3077 } |
|
3078 /* |
|
3079 * We check if the state of the camera is in the ViaPlayer mode state |
|
3080 * if so, then we just activate the player view and return after |
|
3081 * coming from the background. |
|
3082 */ |
|
3083 if ( iViewState == ECamViewStateViaPlayer ) |
|
3084 { |
|
3085 ActivateLocalViewL ( iViaPlayerUid ); |
|
3086 // We call the base class and return |
|
3087 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3088 return; |
|
3089 } |
|
3090 else if ( iTargetViewState == ECamViewStatePostCapture ) |
|
3091 { |
|
3092 TrySwitchViewL( ETrue ); |
|
3093 // register an interest in new events |
|
3094 iCoeEnv->RootWin().EnableFocusChangeEvents(); // ignore error |
|
3095 |
|
3096 #if !defined (__WINSCW__) |
|
3097 // Grab capture keys |
|
3098 RegisterCaptureKeysL(); |
|
3099 |
|
3100 #endif |
|
3101 // iPretendExit flag needs to be reset before returning, otherwise |
|
3102 // views think we are still in exit state and will not reserve camera |
|
3103 iPretendExit = EFalse; |
|
3104 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3105 return; |
|
3106 } |
|
3107 else if ( SettingsLaunchedFromCamera() ) |
|
3108 { |
|
3109 if ( iController.InVideocallOrRinging() && |
|
3110 iController.CurrentOperation() == ECamNoOperation ) |
|
3111 { |
|
3112 iTargetViewState = ECamViewStatePreCapture; |
|
3113 } |
|
3114 else |
|
3115 { |
|
3116 CCamViewBase *precapView = static_cast<CCamViewBase*>( iView ); |
|
3117 __ASSERT_DEBUG(precapView, CamPanic(ECamPanicNullPointer)); |
|
3118 if( precapView->IsInStandbyMode() ) |
|
3119 { |
|
3120 iView->HandleCommandL( ECamCmdExitStandby ); |
|
3121 } |
|
3122 iTargetViewState = ECamViewStateSettings; |
|
3123 } |
|
3124 TrySwitchViewL(); |
|
3125 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3126 return; |
|
3127 } |
|
3128 else |
|
3129 { |
|
3130 // we are now sure that settings plugin is not active |
|
3131 iReturnedFromPlugin = ETrue; |
|
3132 } |
|
3133 |
|
3134 |
|
3135 if ( iLostFocusToNewWindow ) |
|
3136 { |
|
3137 if ( ECamViewStateBurstThumbnail != iTargetViewState ) |
|
3138 { |
|
3139 iLostFocusToNewWindow = EFalse; |
|
3140 } |
|
3141 } |
|
3142 if( !uiOverride || ( !iFirstBoot && uiOverride ) ) |
|
3143 { |
|
3144 StartCheckingDefaultAlbumIdL(); |
|
3145 } |
|
3146 |
|
3147 // Free the needed ram memory if not enough available |
|
3148 iMemoryMonitor->CheckAndRequestMemoryL( |
|
3149 iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained(), |
|
3150 iController.UiConfigManagerPtr()->RequiredRamMemoryFocusGained(), |
|
3151 EFalse ); |
|
3152 |
|
3153 |
|
3154 iController.SetEndKeyExitWaiting( EFalse ); |
|
3155 //Don't update task state in case of embedded camera |
|
3156 if ( !iEikonEnv->StartedAsServerApp()) |
|
3157 { |
|
3158 HideTaskL( EFalse ); |
|
3159 } |
|
3160 // Restart the sensor idle |
|
3161 if ( iController.UiConfigManagerPtr()->IsOrientationSensorSupported() ) |
|
3162 { |
|
3163 // Handle sensor api init when we have idle time |
|
3164 StartSensorIdleL(); |
|
3165 } |
|
3166 |
|
3167 // the focus can be regained during a SendAs Bluetooth operation |
|
3168 // so don't try to exit the app if SendAs is in progress - the |
|
3169 // exit check will be performed once SendAs completes |
|
3170 // The same applies while a sequence capture is being completed |
|
3171 if ( !iSendAsInProgress && !iController.SequenceCaptureInProgress() ) |
|
3172 { |
|
3173 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL EEventFocusGained checking exit status") ) |
|
3174 // check if exit is required |
|
3175 if ( iController.CheckExitStatus() ) |
|
3176 { |
|
3177 InternalExitL(); |
|
3178 PRINT( _L("Camera <= CCamAppUi::HandleWsEventL, internal exit") ) |
|
3179 return; |
|
3180 } |
|
3181 } |
|
3182 |
|
3183 // register an interest in new events |
|
3184 iCoeEnv->RootWin().EnableFocusChangeEvents(); // ignore error |
|
3185 |
|
3186 #if !defined (__WINSCW__) |
|
3187 // Grab capture keys |
|
3188 RegisterCaptureKeysL(); |
|
3189 |
|
3190 #endif |
|
3191 |
|
3192 iReturnFromBackground = EFalse; |
|
3193 |
|
3194 // When the application gains focus |
|
3195 // the memory to use should be re-checked for |
|
3196 // availability. If uioverride supported, check |
|
3197 // made later since settings not loaded at this point |
|
3198 if ( !uiOverride ) |
|
3199 { |
|
3200 iController.CheckMemoryToUseL(); |
|
3201 } |
|
3202 |
|
3203 TBool returningFromPretendExit = iPretendExit; |
|
3204 iPretendExit = EFalse; |
|
3205 |
|
3206 TCamViewSwitch switchNeeded = ECamViewSwitchNone; |
|
3207 |
|
3208 // if a view switch has been waiting for the application to get |
|
3209 // the foreground. |
|
3210 if ( iPendingViewSwitch != EPendingViewSwitchNone && |
|
3211 !iSendAsInProgress ) |
|
3212 { |
|
3213 // In case the application is exited from portrait mode |
|
3214 // and landscape should be used -> orientation switch is required |
|
3215 TAppUiOrientation appOrientation = CAknAppUiBase::Orientation(); |
|
3216 if ( EAppUiOrientationPortrait == appOrientation ) |
|
3217 { |
|
3218 SwitchOrientationIfRequiredL( |
|
3219 CAknAppUiBase::EAppUiOrientationUnspecified ); |
|
3220 } |
|
3221 TBool deactivateFirst = |
|
3222 ( iPendingViewSwitch == EPendingViewSwitchDeactivateFirst ); |
|
3223 switchNeeded = ViewSwitchRequired( deactivateFirst ); |
|
3224 iPendingViewSwitch = EPendingViewSwitchNone; |
|
3225 TrySwitchViewL( deactivateFirst ); |
|
3226 } |
|
3227 else |
|
3228 { |
|
3229 if( iViewFinderStopped ) |
|
3230 { |
|
3231 // don't start VF if EEventFocusGroupChanged is coming later |
|
3232 if( !iLostFocusToNewWindow && |
|
3233 iController.CurrentMode() == ECamControllerImage || |
|
3234 iController.CurrentMode() == ECamControllerVideo ) |
|
3235 { |
|
3236 iController.StartViewFinder(); |
|
3237 } |
|
3238 iLostFocusToNewWindow = EFalse; |
|
3239 } |
|
3240 } |
|
3241 |
|
3242 // force side pane and active palette to update if simulating app |
|
3243 // launch this has to be done after the call to TrySwitchViewL() to |
|
3244 // ensure that IsBurstEnabled() returns the correct value. |
|
3245 if ( returningFromPretendExit ) |
|
3246 { |
|
3247 /*if ( iController.UiConfigManagerPtr() && |
|
3248 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
3249 { |
|
3250 // If record location setting is on, start location trail, |
|
3251 // provided, primary camera and pre-capture view |
|
3252 if ( ECamLocationOn == iController.IntegerSettingValue( ECamSettingItemRecLocation ) |
|
3253 && ECamActiveCameraPrimary == ActiveCamera() |
|
3254 && ECamViewStatePreCapture == iViewState |
|
3255 ) |
|
3256 { |
|
3257 iController.StartLocationTrailL(); |
|
3258 } |
|
3259 }*/ |
|
3260 |
|
3261 iCamSidePane->SetCaptureMode( iMode ); |
|
3262 // The active palette is always switched on when simulating |
|
3263 // app launch |
|
3264 iPreventActivePaletteDisplay = EFalse; |
|
3265 |
|
3266 |
|
3267 if ( iView == iVideoCaptureView ) |
|
3268 { |
|
3269 iVideoCaptureView->UpdateToolbarIconsL(); |
|
3270 } |
|
3271 } |
|
3272 |
|
3273 if ( uiOverride && ( returningFromPretendExit || iFirstBoot ) ) |
|
3274 { |
|
3275 SetActivePaletteVisibility( EFalse ); |
|
3276 } |
|
3277 else if ( !TimeLapseSliderShown() && |
|
3278 iViewState == ECamViewStatePreCapture && |
|
3279 switchNeeded != ECamViewSwitch && |
|
3280 !uiOverride ) |
|
3281 { |
|
3282 RaisePreCaptureCourtesyUI( ETrue ); |
|
3283 } |
|
3284 |
|
3285 // If keylock is set on when recording is starting up but not yet |
|
3286 // started, display toolbar when keylock is set off since we are |
|
3287 // returning to precapture view, unless capturing is still going on. |
|
3288 if ( iView == iVideoCaptureView |
|
3289 && iController.CurrentOperation() != ECamCapturing |
|
3290 && !iController.IsProcessingCapture() ) |
|
3291 { |
|
3292 if ( iController.IsTouchScreenSupported() ) |
|
3293 { |
|
3294 CAknToolbar* toolbar = CurrentFixedToolbar(); |
|
3295 if ( toolbar ) |
|
3296 { |
|
3297 toolbar->SetToolbarVisibility( ETrue ); |
|
3298 } |
|
3299 } |
|
3300 } |
|
3301 break; |
|
3302 } |
|
3303 // ----------------------------------------------------- |
|
3304 case EEventFocusLost: |
|
3305 { |
|
3306 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusLost") ); |
|
3307 |
|
3308 //When go to background from video post caputure view, we need to hide the toolbar to avoid icons overlap |
|
3309 if( AppInBackground( EFalse ) |
|
3310 && iViewState == ECamViewStatePostCapture |
|
3311 && iMode == ECamControllerVideo ) |
|
3312 { |
|
3313 SubmergeToolbar(); |
|
3314 } |
|
3315 |
|
3316 // focus lost event while videocall active and camera in standby, |
|
3317 // no notification to views |
|
3318 if ( iController.InVideocallOrRinging() |
|
3319 && ECamViewStateStandby == iViewState ) |
|
3320 { |
|
3321 // We call the base class and return |
|
3322 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3323 return; |
|
3324 } |
|
3325 |
|
3326 NotifyViews( ECamAppEventFocusLost ); |
|
3327 |
|
3328 if ( iController.UiConfigManagerPtr() |
|
3329 && iController.UiConfigManagerPtr()->IsOrientationSensorSupported() ) |
|
3330 // Shut down the Sensor API object. |
|
3331 iController.UpdateSensorApiL(EFalse); |
|
3332 |
|
3333 if ( iController.UiConfigManagerPtr() && |
|
3334 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
3335 { |
|
3336 // If record location setting is on, stop location trail when losing focus |
|
3337 if ( AppInBackground( EFalse ) ) |
|
3338 { |
|
3339 PRINT( _L("Camera: CCamAppUi::HandleWsEventL focus lost, stop location trail") ) |
|
3340 iController.StopLocationTrail(); |
|
3341 } |
|
3342 } |
|
3343 |
|
3344 #if !defined (__WINSCW__) |
|
3345 // relinquish capture keys |
|
3346 UnRegisterCaptureKeys(); |
|
3347 |
|
3348 RArray <TInt> halfCaptureKeys; |
|
3349 CleanupClosePushL( halfCaptureKeys ); |
|
3350 |
|
3351 // now get half key press code to register |
|
3352 if ( iController.UiConfigManagerPtr() ) |
|
3353 { |
|
3354 iController.UiConfigManagerPtr()-> |
|
3355 SupportedPrimaryCameraAutoFocusKeyL( halfCaptureKeys ); |
|
3356 } |
|
3357 if ( halfCaptureKeys.Count() > 0 ) |
|
3358 { |
|
3359 // Simulate key up event for the half-press key to make |
|
3360 // sure autofocus does not get stuck when we lose focus. |
|
3361 TKeyEvent key; |
|
3362 key.iRepeats = 0; |
|
3363 key.iCode = 0; |
|
3364 key.iScanCode = halfCaptureKeys[0]; |
|
3365 key.iModifiers = 0; |
|
3366 iEikonEnv->SimulateKeyEventL( key, EEventKeyUp ); |
|
3367 } |
|
3368 CleanupStack::PopAndDestroy( &halfCaptureKeys ); |
|
3369 #endif |
|
3370 break; |
|
3371 } |
|
3372 // ----------------------------------------------------- |
|
3373 case KUidValueAknsSkinChangeEvent: |
|
3374 { |
|
3375 if ( iNaviProgressBarModel ) |
|
3376 { |
|
3377 iNaviProgressBarModel->ReloadResourceDataL(); |
|
3378 } |
|
3379 break; |
|
3380 } |
|
3381 case EEventPointer: |
|
3382 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: EEventPointer") ); |
|
3383 // restart idle timer every time screen is touched |
|
3384 iController.StartIdleTimer(); |
|
3385 break; |
|
3386 // ----------------------------------------------------- |
|
3387 default: |
|
3388 PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: unhandled case") ); |
|
3389 break; |
|
3390 // ----------------------------------------------------- |
|
3391 } |
|
3392 |
|
3393 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3394 } |
|
3395 PRINT( _L("Camera <= CCamAppUi::HandleWsEventL") ); |
|
3396 } |
|
3397 |
|
3398 |
|
3399 // ----------------------------------------------------------------------------- |
|
3400 // NotifyViews |
|
3401 // ----------------------------------------------------------------------------- |
|
3402 // |
|
3403 void |
|
3404 CCamAppUi::NotifyViews( const TCamAppEvent& aEvent ) |
|
3405 { |
|
3406 PRINT( _L("Camera => CCamAppUi::NotifyViews") ); |
|
3407 TUid settingsPluginUid = KNullUid; |
|
3408 if ( iPlugin ) |
|
3409 { |
|
3410 settingsPluginUid = iPlugin->Id(); |
|
3411 } |
|
3412 |
|
3413 for( TInt i = 0; i < iViews->Count(); i++ ) |
|
3414 { |
|
3415 const TUid& uid( (*iViews)[i]->Id() ); |
|
3416 PRINT2( _L("Camera <> View[%2d] uid[%3d]"), i, uid.iUid ); |
|
3417 |
|
3418 |
|
3419 if ( |
|
3420 KGSCamImageSettingsViewId != uid && |
|
3421 KGSCamVideoSettingsViewId != uid && |
|
3422 settingsPluginUid != uid && |
|
3423 ECamViewIdViaPlayerPlayBack != uid.iUid ) |
|
3424 |
|
3425 { |
|
3426 static_cast<CCamViewBase*>( (*iViews)[i] )->HandleAppEvent( aEvent ); |
|
3427 } |
|
3428 } |
|
3429 |
|
3430 PRINT( _L("Camera <= CCamAppUi::NotifyViews") ); |
|
3431 } |
|
3432 |
|
3433 // ----------------------------------------------------------------------------- |
|
3434 // CCamAppUi::ConstructPreCaptureViewsL |
|
3435 // Construct the application views |
|
3436 // ----------------------------------------------------------------------------- |
|
3437 // |
|
3438 void CCamAppUi::ConstructPreCaptureViewsL() |
|
3439 { |
|
3440 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CONSTRUCTPRECAPTUREVIEWSL, "e_CCamAppUi_ConstructPreCaptureViewsL 1" ); |
|
3441 PRINT( _L( "Camera => CCamAppUi::ConstructPreCaptureViewsL()" ) ); |
|
3442 PERF_EVENT_START_L2( EPerfEventPreCaptureViewConstruction ); |
|
3443 |
|
3444 // Initialize views |
|
3445 CCamStillPreCaptureView* stillView = |
|
3446 CCamStillPreCaptureView::NewLC( iController ); |
|
3447 iStillCaptureView = stillView; |
|
3448 |
|
3449 AddViewL( stillView ); |
|
3450 CleanupStack::Pop( stillView ); |
|
3451 |
|
3452 PRINT( _L( "Camera => CCamAppUi::ConstructPreCaptureViewsL() still view complete" ) ); |
|
3453 |
|
3454 CCamVideoPreCaptureView* videoView = CCamVideoPreCaptureView::NewLC( iController ); |
|
3455 iVideoCaptureView = videoView; |
|
3456 |
|
3457 AddViewL( videoView ); |
|
3458 CleanupStack::Pop( videoView ); |
|
3459 |
|
3460 #if !( defined(__WINS__) || defined(__WINSCW__) ) |
|
3461 // Get Central Repository key indicating if product uses volume keys |
|
3462 // for zoom. Load the zoom pane orientation value from the Central |
|
3463 // Repository |
|
3464 if( !iRepository ) |
|
3465 { |
|
3466 iRepository = CRepository::NewL( KCRUidCameraappSettings ); |
|
3467 } |
|
3468 |
|
3469 TInt val = 0; |
|
3470 TInt err = iRepository->Get( KCamCrZoomUsingVolumeKeys, val ); |
|
3471 |
|
3472 // If there is an error then assume volume keys not used |
|
3473 if ( err ) |
|
3474 { |
|
3475 iZoomUsingVolumeKeys = EFalse; |
|
3476 } |
|
3477 else |
|
3478 { |
|
3479 iZoomUsingVolumeKeys = val; |
|
3480 } |
|
3481 |
|
3482 if( iZoomUsingVolumeKeys ) |
|
3483 { |
|
3484 // Remote controller observe |
|
3485 delete iVolumeKeyObserver; |
|
3486 iVolumeKeyObserver = NULL; |
|
3487 iVolumeKeyObserver = CCamRemConObserver::NewL( *this ); |
|
3488 } |
|
3489 |
|
3490 #else |
|
3491 iZoomUsingVolumeKeys = EFalse; |
|
3492 #endif // !( defined(__WINS__) || defined(__WINSCW__) ) |
|
3493 |
|
3494 PERF_EVENT_END_L2( EPerfEventPreCaptureViewConstruction ); |
|
3495 PRINT( _L( "Camera <= CCamAppUi::ConstructPreCaptureViewsL()" ) ); |
|
3496 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMAPPUI_CONSTRUCTPRECAPTUREVIEWSL, "e_CCamAppUi_ConstructPreCaptureViewsL 0" ); |
|
3497 } |
|
3498 |
|
3499 // ----------------------------------------------------------------------------- |
|
3500 // CCamAppUi::ConstructPostCaptureViewsL |
|
3501 // Construct the application views |
|
3502 // ----------------------------------------------------------------------------- |
|
3503 // |
|
3504 void CCamAppUi::ConstructPostCaptureViewsL() |
|
3505 { |
|
3506 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CONSTRUCTPOSTCAPTUREVIEWSL, "e_CCamAppUi_ConstructPostCaptureViewsL 1" ); |
|
3507 PRINT( _L( "Camera => CCamAppUi::ConstructPostCaptureViewsL()" ) ); |
|
3508 if ( iPostCaptureViewsConstructed ) |
|
3509 { |
|
3510 PRINT( _L( "Camera <= CCamAppUi::ConstructPostCaptureViewsL(,)iPostCaptureViewsConstructed == ETrue" ) ); |
|
3511 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP2_CCAMAPPUI_CONSTRUCTPOSTCAPTUREVIEWSL, "e_CCamAppUi_ConstructPostCaptureViewsL 0" ); |
|
3512 return; |
|
3513 } |
|
3514 |
|
3515 PERF_EVENT_START_L2( EPerfEventPostCaptureViewConstruction ); |
|
3516 |
|
3517 ConstructPostCaptureViewIfRequiredL( ECamViewStatePostCapture, |
|
3518 ECamControllerImage ); |
|
3519 ConstructPostCaptureViewIfRequiredL( ECamViewStateBurstThumbnail, |
|
3520 ECamControllerImage ); |
|
3521 ConstructPostCaptureViewIfRequiredL( ECamViewStatePostCapture, |
|
3522 ECamControllerVideo ); |
|
3523 |
|
3524 iPostCaptureViewsConstructed = ETrue; |
|
3525 PERF_EVENT_END_L2( EPerfEventPostCaptureViewConstruction ); |
|
3526 PRINT( _L( "Camera <= CCamAppUi::ConstructPostCaptureViewsL()" ) ); |
|
3527 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMAPPUI_CONSTRUCTPOSTCAPTUREVIEWSL, "e_CCamAppUi_ConstructPostCaptureViewsL 0" ); |
|
3528 } |
|
3529 |
|
3530 // ----------------------------------------------------------------------------- |
|
3531 // CCamAppUi::ConstructViewIfRequiredL |
|
3532 // Construct the application views |
|
3533 // ----------------------------------------------------------------------------- |
|
3534 // |
|
3535 void CCamAppUi::ConstructViewIfRequiredL() |
|
3536 { |
|
3537 PRINT( _L( "Camera => CCamAppUi::ConstructViewIfRequiredL()" ) ); |
|
3538 |
|
3539 // Initialize views |
|
3540 CAknView* view( NULL ); |
|
3541 |
|
3542 switch( iTargetViewState ) |
|
3543 { |
|
3544 // ----------------------------------------------------- |
|
3545 // Construct one of the postcapture views if needed |
|
3546 case ECamViewStateBurstThumbnail: |
|
3547 case ECamViewStatePostCapture: |
|
3548 { |
|
3549 ConstructPostCaptureViewIfRequiredL( iTargetViewState, iMode ); |
|
3550 break; |
|
3551 } |
|
3552 // ----------------------------------------------------- |
|
3553 // construct settings views if needed |
|
3554 case ECamViewStateSettings: |
|
3555 { |
|
3556 if( !iPlugin ) |
|
3557 { |
|
3558 CCamGSInterface* plugin = CCamGSInterface::NewL( KCamGSPluginUid ); |
|
3559 CleanupStack::PushL( plugin ); |
|
3560 AddViewL( plugin ); // Transfer ownership to AppUi |
|
3561 CleanupStack::Pop( plugin ); |
|
3562 iPlugin = plugin; |
|
3563 } |
|
3564 break; |
|
3565 } |
|
3566 // ----------------------------------------------------- |
|
3567 // construct user scene setup view if needed |
|
3568 case ECamViewStateUserSceneSetup: |
|
3569 { |
|
3570 if( !iUserSceneSetupViewConstructed ) |
|
3571 { |
|
3572 view = CCamStillUserSceneSetupView::NewLC( iController ); |
|
3573 AddViewL( view ); |
|
3574 CleanupStack::Pop( view ); |
|
3575 iUserSceneSetupViewConstructed = ETrue; |
|
3576 } |
|
3577 break; |
|
3578 } |
|
3579 // ----------------------------------------------------- |
|
3580 |
|
3581 default: |
|
3582 { |
|
3583 // no action |
|
3584 break; |
|
3585 } |
|
3586 // ----------------------------------------------------- |
|
3587 } |
|
3588 PRINT( _L( "Camera <= CCamAppUi::ConstructViewIfRequiredL" ) ); |
|
3589 } |
|
3590 |
|
3591 // ----------------------------------------------------------------------------- |
|
3592 // CCamAppUi::ConstructNaviPaneL |
|
3593 // Construct the navi pane |
|
3594 // ----------------------------------------------------------------------------- |
|
3595 // |
|
3596 void CCamAppUi::ConstructNaviPaneL() |
|
3597 { |
|
3598 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CONSTRUCTNAVIPANEL, "e_CCamAppUi_ConstructNaviPaneL 1" ); |
|
3599 // Navi pane indicators |
|
3600 iNaviPaneCounterControl = |
|
3601 CCamNaviCounterControl::NewL( *iNaviCounterModel ); |
|
3602 |
|
3603 iDecoratedNaviPaneCounter = |
|
3604 CAknNavigationDecorator::NewL( NaviPaneL(), iNaviPaneCounterControl ); |
|
3605 |
|
3606 iDecoratedNaviPaneCounter->SetContainerWindowL( |
|
3607 *(StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); |
|
3608 iNaviPaneCounterControl->SetContainerWindowL( *iDecoratedNaviPaneCounter ); |
|
3609 |
|
3610 iNaviPaneProgressBarControl = |
|
3611 CCamNaviProgressBarControl::NewL( *iNaviProgressBarModel ); |
|
3612 |
|
3613 iDecoratedNaviPaneProgressBar = CAknNavigationDecorator::NewL( |
|
3614 NaviPaneL(), iNaviPaneProgressBarControl ); |
|
3615 |
|
3616 iDecoratedNaviPaneProgressBar->SetContainerWindowL( |
|
3617 *(StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); |
|
3618 iNaviPaneProgressBarControl->SetContainerWindowL( |
|
3619 *iDecoratedNaviPaneProgressBar ); |
|
3620 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMAPPUI_CONSTRUCTNAVIPANEL, "e_CCamAppUi_ConstructNaviPaneL 0" ); |
|
3621 } |
|
3622 |
|
3623 // ---------------------------------------------------- |
|
3624 // CCamAppUi::DoPostCaptureTimeoutL |
|
3625 // Implementation function for post capture view timeout |
|
3626 // ---------------------------------------------------- |
|
3627 // |
|
3628 TInt CCamAppUi::DoPostCaptureTimeoutL() |
|
3629 { |
|
3630 // If burst mode is active, switch to thumbnail view |
|
3631 if ( iViewState == ECamViewStatePostCapture && |
|
3632 iImageMode == ECamImageCaptureBurst ) |
|
3633 { |
|
3634 iTargetViewState = ECamViewStateBurstThumbnail ; |
|
3635 } |
|
3636 // otherwise, return to pre-capture view |
|
3637 else if (iCamOrientation == ECamOrientationPortrait) |
|
3638 { |
|
3639 iTargetViewState = ECamViewStatePrePortraitCapture; |
|
3640 } |
|
3641 else |
|
3642 { |
|
3643 iTargetViewState = ECamViewStatePreCapture; |
|
3644 } |
|
3645 |
|
3646 TrySwitchViewL(); |
|
3647 return EFalse; |
|
3648 } |
|
3649 |
|
3650 // ---------------------------------------------------- |
|
3651 // CCamAppUi::TrySwitchViewL |
|
3652 // Try to switch active view |
|
3653 // ---------------------------------------------------- |
|
3654 // |
|
3655 void |
|
3656 CCamAppUi::TrySwitchViewL( TBool aDeactivateFirst ) |
|
3657 { |
|
3658 PRINT2(_L("Camera => CCamAppUi::TrySwitchViewL, iTargetViewState = %d, iViewState = %d"), iTargetViewState, iViewState); |
|
3659 PRINT2(_L("Camera <> CCamAppUi::TrySwitchViewL, iTargetMode = %d, iMode = %d"), iTargetMode, iMode); |
|
3660 |
|
3661 //Sometimes current view and target view are same. For example switching from main camera to secondary camera |
|
3662 //always sets target mode to precaptrueview and current view could already be in precapture view. This is fine |
|
3663 //but In some postcaptureview cases current view and targetview is postcapture. |
|
3664 //In those cases view switching is not needed unless current mode also changes. |
|
3665 if( (iViewState==iTargetViewState) && ( iViewState==ECamViewStatePostCapture) && (iMode==iTargetMode) ) |
|
3666 { |
|
3667 PRINT(_L("Camera <> CCamAppUi::TrySwitchViewL, CALLED WITHOUT PURPOSE")); |
|
3668 return; |
|
3669 } |
|
3670 |
|
3671 if( iZoomUsingVolumeKeys && !iVolumeKeyObserver && |
|
3672 ECamViewStatePreCapture == iTargetViewState ) |
|
3673 { |
|
3674 // Volumekeyobserver has been removed due to activating an external |
|
3675 // view. Volume keys are only needed for zooming in precapture, so we |
|
3676 // re-create the observer during next switch to precap (=now) |
|
3677 iVolumeKeyObserver = CCamRemConObserver::NewL( *this ); |
|
3678 } |
|
3679 |
|
3680 |
|
3681 //if burst capture stopped for usb inserted, iTargetViewState is ECamViewStatePreCapture, it need to stop sequence capture too. |
|
3682 if ( iViewState == ECamViewStatePreCapture && |
|
3683 ( iTargetViewState == ECamViewStateBurstThumbnail || |
|
3684 ( ( iTargetViewState == ECamViewStatePreCapture ) && iController.IsCaptureStoppedForUsb() ) ) && |
|
3685 iController.SequenceCaptureInProgress() ) |
|
3686 { |
|
3687 iController.StopSequenceCaptureL(); |
|
3688 } |
|
3689 |
|
3690 // some views are only constructed when they are first used |
|
3691 TRAPD( err, ConstructViewIfRequiredL() ) |
|
3692 PRINT1( _L( "Camera <> view constrcuction status:%d"), err ) |
|
3693 // if the view construction failed |
|
3694 if ( err ) |
|
3695 { |
|
3696 iTargetViewState = ECamViewStatePreCapture; |
|
3697 User::Leave( err ); |
|
3698 } |
|
3699 |
|
3700 // if the application is in the background the view switch will happen |
|
3701 // when we get the foreground again. This stops the app coming back to |
|
3702 // the foreground when the view switch occurs. |
|
3703 // If keylock is enabled, view switching is allowed in order to avoid |
|
3704 // flickering |
|
3705 |
|
3706 if ( AppInBackground( ETrue ) && ECamViewStateStandby != iTargetViewState ) |
|
3707 { |
|
3708 PRINT( _L("Camera <> app in background set pending view switch") ) |
|
3709 if ( aDeactivateFirst ) |
|
3710 { |
|
3711 PRINT( _L("Camera <> setting iPendingViewSwitch = EPendingViewSwitchDeactivateFirst") ) |
|
3712 iPendingViewSwitch = EPendingViewSwitchDeactivateFirst; |
|
3713 } |
|
3714 else |
|
3715 { |
|
3716 // If a deactivate first view switch has already been requested |
|
3717 // then don't overwrite it |
|
3718 if ( iPendingViewSwitch != EPendingViewSwitchDeactivateFirst ) |
|
3719 { |
|
3720 PRINT( _L("Camera <> setting iPendingViewSwitch = EPendingViewSwitchNormal") ) |
|
3721 iPendingViewSwitch = EPendingViewSwitchNormal; |
|
3722 } |
|
3723 } |
|
3724 PRINT( _L("Camera TrySwitchViewL returning without switch") ); |
|
3725 return; |
|
3726 } |
|
3727 |
|
3728 if ( iController.UiConfigManagerPtr() && |
|
3729 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() && |
|
3730 !iUiConstructionComplete ) |
|
3731 { |
|
3732 iPendingViewSwitch = EPendingViewSwitchNormal; |
|
3733 PRINT( _L("Camera <= CCamAppUi::TrySwitchViewL setting EPendingViewSwitchNormal, return") ); |
|
3734 return; |
|
3735 } |
|
3736 |
|
3737 TCamViewSwitch switchNeeded = ViewSwitchRequired( aDeactivateFirst ); |
|
3738 PRINT( _L("Camera TrySwitchViewL C") ) |
|
3739 if ( iTargetViewState == ECamViewStatePreCapture ) |
|
3740 { |
|
3741 PRINT( _L("Camera TrySwitchViewL D") ) |
|
3742 // if going back to precapture view in timelapse mode then the array |
|
3743 // of timelapse filenames can now be deleted |
|
3744 if ( iImageMode == ECamImageCaptureTimeLapse ) |
|
3745 { |
|
3746 iController.ResetTimelapseArray(); |
|
3747 } |
|
3748 |
|
3749 // If exiting a post capture view, release the capture array |
|
3750 if ( iViewState == ECamViewStatePostCapture ) |
|
3751 { |
|
3752 iController.ReleaseArray(); |
|
3753 } |
|
3754 else if( iViewState == ECamViewStateBurstThumbnail ) |
|
3755 { |
|
3756 iController.ReleaseArray( ETrue ); |
|
3757 } |
|
3758 if ( iPreCaptureMode != ECamPreCapTimeLapseSlider ) |
|
3759 { |
|
3760 iPreCaptureMode = ECamPreCapViewfinder; |
|
3761 } |
|
3762 } |
|
3763 |
|
3764 if ( iTargetViewState == ECamViewStatePostCapture ) |
|
3765 { |
|
3766 // If going to post capture, make sure the AP is displayed |
|
3767 iPreventActivePaletteDisplay = EFalse; |
|
3768 } |
|
3769 |
|
3770 // If no switches are required |
|
3771 if ( switchNeeded == ECamViewSwitchNone ) |
|
3772 { |
|
3773 PRINT( _L("Camera TrySwitchViewL no VS") ) |
|
3774 if ( IsDirectViewfinderActive() ) |
|
3775 { |
|
3776 TRAP_IGNORE(HandleCommandL( ECamCmdRedrawScreen )); |
|
3777 } |
|
3778 return; |
|
3779 } |
|
3780 // If a full view switch is required, activate new view |
|
3781 if ( switchNeeded == ECamViewSwitch ) |
|
3782 { |
|
3783 PRINT( _L("Camera <> CCamAppUi::TrySwitchViewL: Stop VF for full view switch") ) |
|
3784 // this skip VF stopping if DV is active and camera is in standby mode |
|
3785 // possible if screensaver delay is short and startup takes long enough |
|
3786 if ( ECamViewStateStandby == iViewState && |
|
3787 // DSVF active or in bitmap mode in any active camera (no need to stop VF) |
|
3788 ( IsDirectViewfinderActive() || |
|
3789 ( ECamActiveCameraSecondary == ActiveCamera() && |
|
3790 !iController.UiConfigManagerPtr()->IsDSAViewFinderSupported( EFalse ) ) || |
|
3791 ( ECamActiveCameraPrimary == ActiveCamera() && |
|
3792 !iController.UiConfigManagerPtr()->IsDSAViewFinderSupported( ETrue ) ) ) ) |
|
3793 { |
|
3794 PRINT( _L("Camera <> CCamAppUi::TrySwitchViewL: !!! No stopviewfinder in Standby !!!") ) |
|
3795 } |
|
3796 else |
|
3797 { |
|
3798 SetViewFinderInTransit(ETrue); |
|
3799 iController.StopViewFinder(); |
|
3800 TUid viewId = iView->Id(); |
|
3801 if(viewId == TUid::Uid( ECamViewIdStillPreCapture ) |
|
3802 || viewId == TUid::Uid( ECamViewIdVideoPreCapture )) |
|
3803 { |
|
3804 CCamViewBase* view = static_cast<CCamViewBase*>(iView); |
|
3805 CCamContainerBase* container = view->Container(); |
|
3806 container->DrawNow(); |
|
3807 } |
|
3808 |
|
3809 } |
|
3810 PRINT( _L("Camera TrySwitchViewL E") ) |
|
3811 TUid uid; |
|
3812 TUid messageUid; |
|
3813 TBool validView = ViewId( iTargetViewState, |
|
3814 iTargetMode, |
|
3815 iTargetImageMode, |
|
3816 uid, |
|
3817 messageUid, |
|
3818 aDeactivateFirst ); |
|
3819 PRINT2(_L("Camera <> CCamAppUi::TrySwitchViewL, iTargetViewState = %d, iViewState = %d"), |
|
3820 iTargetViewState, iViewState); |
|
3821 PRINT2(_L("Camera <> CCamAppUi::TrySwitchViewL, uid = %d, messageUid = %d"), |
|
3822 uid.iUid, messageUid.iUid); |
|
3823 |
|
3824 __ASSERT_DEBUG( validView, CamPanic( ECamPanicInvalidView ) ); |
|
3825 |
|
3826 if ( validView ) |
|
3827 { |
|
3828 PRINT( _L("Camera TrySwitchViewL f") ) |
|
3829 // the cba is reset when the view is activated |
|
3830 iCbaIsDisabled = EFalse; |
|
3831 ActivateLocalViewL( uid, messageUid, KNullDesC8 ); |
|
3832 // If self timer mode is enabled and we are switching views, we need to |
|
3833 // disable Self Timer |
|
3834 if ( iInSelfTimerMode != ECamSelfTimerDisabled) |
|
3835 { |
|
3836 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
3837 } |
|
3838 } |
|
3839 } |
|
3840 |
|
3841 // Mode only switches are handled here |
|
3842 |
|
3843 // ...if we are switching to/from the video/photo views then |
|
3844 // ...reset the dynamic settings. |
|
3845 if ( ( ( iMode != ECamControllerVideo ) && |
|
3846 ( iTargetMode == ECamControllerVideo ) ) |
|
3847 || |
|
3848 ( ( iMode == ECamControllerVideo ) && |
|
3849 ( iTargetMode != ECamControllerVideo ) ) ) |
|
3850 { |
|
3851 #ifdef RESET_DYNAMIC_SETTINGS_WHEN_SWITCH_MODE |
|
3852 iController.SetDynamicSettingsToDefaults(); |
|
3853 #endif // RESET_DYNAMIC_SETTINGS_WHEN_SWITCH_MODE |
|
3854 } |
|
3855 |
|
3856 if ( iController.UiConfigManagerPtr() && iDSASupported ) |
|
3857 { |
|
3858 // ...check if we are moving to BurstCapture |
|
3859 // |
|
3860 if ( // If entering burst mode... |
|
3861 ( ( iTargetImageMode == ECamImageCaptureBurst || |
|
3862 iTargetImageMode == ECamImageCaptureTimeLapse ) && |
|
3863 iImageMode == ECamImageCaptureSingle ) |
|
3864 // ...or leaving burst mode |
|
3865 || |
|
3866 ( ( iImageMode == ECamImageCaptureBurst || |
|
3867 iImageMode == ECamImageCaptureTimeLapse ) && |
|
3868 iTargetImageMode == ECamImageCaptureSingle ) |
|
3869 ) |
|
3870 { |
|
3871 // Stop the viewfinder (using the current state) |
|
3872 PRINT( _L("Camera TrySwitchViewL burst stop VF") ) |
|
3873 iController.StopViewFinder(); |
|
3874 |
|
3875 // Update AppUi internal state |
|
3876 iViewState = iTargetViewState; |
|
3877 iMode = iTargetMode; |
|
3878 iImageMode = iTargetImageMode; |
|
3879 |
|
3880 } |
|
3881 else |
|
3882 { |
|
3883 // Not entering/leaving burst mode, so just update the state |
|
3884 iViewState = iTargetViewState; |
|
3885 iMode = iTargetMode; |
|
3886 iImageMode = iTargetImageMode; |
|
3887 } |
|
3888 } |
|
3889 else |
|
3890 { |
|
3891 // ...set the current capture mode and view state to the targets. |
|
3892 iViewState = iTargetViewState; |
|
3893 iMode = iTargetMode; |
|
3894 iImageMode = iTargetImageMode; |
|
3895 } |
|
3896 |
|
3897 PRINT(_L("Camera <= CCamAppUi::TrySwitchViewL")); |
|
3898 } |
|
3899 |
|
3900 // ---------------------------------------------------- |
|
3901 // CCamAppUi::ViewSwitchRequired |
|
3902 // Is a switch of the active view necessary |
|
3903 // ---------------------------------------------------- |
|
3904 // |
|
3905 |
|
3906 CCamAppUi::TCamViewSwitch |
|
3907 CCamAppUi::ViewSwitchRequired( TBool aDeactivateFirst ) const |
|
3908 { |
|
3909 CCamAppUi::TCamViewSwitch vSwitch = ECamViewSwitchNone; |
|
3910 |
|
3911 if ( aDeactivateFirst ) |
|
3912 { |
|
3913 // View switch required |
|
3914 vSwitch = ECamViewSwitch; |
|
3915 } |
|
3916 else |
|
3917 { |
|
3918 // Post <=> Pre and/or Video <=> Image always require view switch |
|
3919 if ( iTargetViewState == iViewState |
|
3920 && iTargetMode == iMode ) |
|
3921 { |
|
3922 // single / burst / timelapse |
|
3923 if( iTargetImageMode == iImageMode ) |
|
3924 { |
|
3925 // Completely same mode already |
|
3926 vSwitch = ECamViewSwitchNone; |
|
3927 } |
|
3928 else |
|
3929 { |
|
3930 // No view switch is required for changing between these modes |
|
3931 vSwitch = ECamViewSwitchModeOnly; |
|
3932 } |
|
3933 } |
|
3934 else |
|
3935 { |
|
3936 // View switch required |
|
3937 vSwitch = ECamViewSwitch; |
|
3938 } |
|
3939 } |
|
3940 |
|
3941 return vSwitch; |
|
3942 } |
|
3943 |
|
3944 // ---------------------------------------------------- |
|
3945 // CCamAppUi::ViewId |
|
3946 // Get uid of view with requested state and mode |
|
3947 // ---------------------------------------------------- |
|
3948 // |
|
3949 TBool CCamAppUi::ViewId( TCamViewState aState, |
|
3950 TCamCameraMode aMode, |
|
3951 TCamImageCaptureMode aImageMode, |
|
3952 TUid& aUid, |
|
3953 TUid& aMessageUid, |
|
3954 TBool aDeactivateFirst ) |
|
3955 { |
|
3956 aMessageUid.iUid = 0; |
|
3957 |
|
3958 TBool found = EFalse; |
|
3959 switch ( aState ) |
|
3960 { |
|
3961 // ----------------------------------------------------- |
|
3962 case ECamViewStateStandby: |
|
3963 { |
|
3964 // Custom message to pass to the view, is to initiate standby |
|
3965 aMessageUid.iUid = ECamViewMessageStandby; |
|
3966 } |
|
3967 //lint -fallthrough |
|
3968 // ----------------------------------------------------- |
|
3969 case ECamViewStatePreCapture: // fallthrough |
|
3970 { |
|
3971 if ( aDeactivateFirst ) |
|
3972 { |
|
3973 aMessageUid.iUid = ECamViewMessageDeactivateFirst; |
|
3974 } |
|
3975 if ( aMode == ECamControllerVideo ) |
|
3976 { |
|
3977 aUid.iUid = ECamViewIdVideoPreCapture; |
|
3978 } |
|
3979 else |
|
3980 { |
|
3981 aUid.iUid = ECamViewIdStillPreCapture; |
|
3982 } |
|
3983 found = ETrue; |
|
3984 break; |
|
3985 } |
|
3986 // ----------------------------------------------------- |
|
3987 case ECamViewStateSceneSettingList: |
|
3988 { |
|
3989 // Ensure the view starts with the capture setup menu displayed. |
|
3990 aMessageUid.iUid = ECamViewMessageSceneSettingList; |
|
3991 if ( aMode == ECamControllerVideo ) |
|
3992 { |
|
3993 aUid.iUid = ECamViewIdVideoPreCapture; |
|
3994 } |
|
3995 else |
|
3996 { |
|
3997 aUid.iUid = ECamViewIdStillPreCapture; |
|
3998 } |
|
3999 found = ETrue; |
|
4000 break; |
|
4001 } |
|
4002 // ----------------------------------------------------- |
|
4003 case ECamViewStatePostCapture: |
|
4004 { |
|
4005 if ( aMode == ECamControllerVideo ) |
|
4006 { |
|
4007 aUid.iUid = ECamViewIdVideoPostCapture; |
|
4008 } |
|
4009 else |
|
4010 { |
|
4011 aUid.iUid = ECamViewIdStillPostCapture; |
|
4012 } |
|
4013 found = ETrue; |
|
4014 break; |
|
4015 } |
|
4016 // ----------------------------------------------------- |
|
4017 case ECamViewStateBurstThumbnail: |
|
4018 { |
|
4019 if ( ECamControllerImage == aMode |
|
4020 && ECamImageCaptureBurst == aImageMode ) |
|
4021 { |
|
4022 aUid.iUid = ECamViewIdBurstThumbnail; |
|
4023 // We have view id for multi capture mode |
|
4024 found = ETrue; |
|
4025 } |
|
4026 else |
|
4027 { |
|
4028 // No valid view id |
|
4029 found = EFalse; |
|
4030 } |
|
4031 break; |
|
4032 } |
|
4033 // ----------------------------------------------------- |
|
4034 case ECamViewStateSettings: |
|
4035 { |
|
4036 TUid viewUid = KNullUid; |
|
4037 aMessageUid = KNullUid; |
|
4038 |
|
4039 if ( ECamControllerVideo == aMode ) |
|
4040 { |
|
4041 if ( IsSecondCameraEnabled() ) |
|
4042 { |
|
4043 aMessageUid = TUid::Uid( KGSSecondaryCameraVideoSettingsView ); |
|
4044 } |
|
4045 viewUid = KGSCamVideoSettingsViewId; |
|
4046 } |
|
4047 else |
|
4048 { |
|
4049 if ( IsSecondCameraEnabled() ) |
|
4050 { |
|
4051 aMessageUid = TUid::Uid( KGSSecondaryCameraPhotoSettingsView ); |
|
4052 } |
|
4053 viewUid = KGSCamImageSettingsViewId; |
|
4054 } |
|
4055 |
|
4056 if ( iPlugin ) |
|
4057 { |
|
4058 aUid = viewUid; |
|
4059 found = ETrue; |
|
4060 } |
|
4061 |
|
4062 break; |
|
4063 } |
|
4064 // ----------------------------------------------------- |
|
4065 case ECamViewStateUserSceneSetup: |
|
4066 { |
|
4067 if ( aMode != ECamControllerVideo ) |
|
4068 { |
|
4069 aUid.iUid = ECamViewIdPhotoUserSceneSetup; |
|
4070 // We have a photo user scene setup view id |
|
4071 found = ETrue; |
|
4072 } |
|
4073 else |
|
4074 { |
|
4075 found = EFalse; |
|
4076 } |
|
4077 break; |
|
4078 } |
|
4079 // ----------------------------------------------------- |
|
4080 default: |
|
4081 break; |
|
4082 // ----------------------------------------------------- |
|
4083 } |
|
4084 |
|
4085 return found; |
|
4086 } |
|
4087 |
|
4088 // ---------------------------------------------------- |
|
4089 // CCamAppUi::NaviPaneL |
|
4090 // Return a pointer to the status pane's navi control container |
|
4091 // ---------------------------------------------------- |
|
4092 // |
|
4093 CAknNavigationControlContainer* CCamAppUi::NaviPaneL() |
|
4094 { |
|
4095 return static_cast<CAknNavigationControlContainer*>( |
|
4096 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
4097 } |
|
4098 |
|
4099 // --------------------------------------------------------------------------- |
|
4100 // CCamAppUi::UpdateCba |
|
4101 // Update softkeys to reflect current state |
|
4102 // --------------------------------------------------------------------------- |
|
4103 // |
|
4104 void CCamAppUi::UpdateCba() |
|
4105 { |
|
4106 CCamViewBase* view = static_cast<CCamViewBase*>( iView ); |
|
4107 TRAP_IGNORE( view->UpdateCbaL() ); |
|
4108 } |
|
4109 |
|
4110 // Added back, but modified the note string resource |
|
4111 // ---------------------------------------------------- |
|
4112 // CCamAppUi::DisplayWaitDialogL |
|
4113 // Displays the wait dialog when saving video |
|
4114 // ---------------------------------------------------- |
|
4115 // |
|
4116 void CCamAppUi::DisplayWaitDialogL() |
|
4117 { |
|
4118 // __ASSERT_DEBUG( iWaitDialog == NULL, CamPanic( ECamPanicUi ) ); |
|
4119 if ( iWaitDialog == NULL ) |
|
4120 { |
|
4121 // Display saving video wait note |
|
4122 // The wait note has its initial delay disabled. This is because the call |
|
4123 // to the engine to stop recording does not return until the video save |
|
4124 // etc. has completed. This does not give the wait dialog a chance to |
|
4125 // receive its timer call back and display itself. |
|
4126 iWaitDialog = new( ELeave ) CCamWaitDialog( |
|
4127 reinterpret_cast<CEikDialog**>( &iWaitDialog ), ETrue ); |
|
4128 iWaitDialog->ExecuteLD( R_CAM_SAVING_VIDEO_WAIT_NOTE ); |
|
4129 // From base class CEikDialog to prevent S60 style CBAs from showing |
|
4130 // unnecessarily |
|
4131 iWaitDialog->ButtonGroupContainer().MakeVisible(EFalse); |
|
4132 } |
|
4133 } |
|
4134 |
|
4135 |
|
4136 // --------------------------------------------------------- |
|
4137 // CCamAppUi::StartupMode |
|
4138 // Get startup capture mode from settings |
|
4139 // --------------------------------------------------------- |
|
4140 // |
|
4141 TCamStartupMode CCamAppUi::StartupMode() const |
|
4142 { |
|
4143 __ASSERT_DEBUG( iRepository, CamPanic( ECamPanicNullPointer ) ); |
|
4144 |
|
4145 TInt value = 0; |
|
4146 TInt err = iRepository->Get( KCamCrDefaultCaptureMode, value ); |
|
4147 TCamStartupMode setting = static_cast<TCamStartupMode>( value ); |
|
4148 if ( err == KErrAbort || |
|
4149 err == KErrPermissionDenied || |
|
4150 err == KErrNotFound || |
|
4151 err == KErrArgument ) |
|
4152 { |
|
4153 PRINT1( _L("Camera <> CCamAppUi::StartupMode err=%d"), err ); |
|
4154 CamPanic( ECamPanicDefaultNotFoundInIniFile ); |
|
4155 } |
|
4156 |
|
4157 return setting; |
|
4158 } |
|
4159 |
|
4160 // --------------------------------------------------------- |
|
4161 // CCamAppUi::SaveCaptureMode |
|
4162 // Save current capture mode to settings |
|
4163 // --------------------------------------------------------- |
|
4164 // |
|
4165 void CCamAppUi::SaveCaptureMode() |
|
4166 { |
|
4167 // Since this function can be called from the destructor, it is neccesary |
|
4168 // to check that iRepository is not null prior to use |
|
4169 if ( iRepository && !IsEmbedded() ) |
|
4170 { |
|
4171 switch ( iMode ) |
|
4172 { |
|
4173 case ECamControllerImage: |
|
4174 // Ignore errors |
|
4175 iRepository->Set( KCamCrDefaultCaptureMode, ECamStillCapture ); |
|
4176 break; |
|
4177 case ECamControllerVideo: |
|
4178 // Ignore errors |
|
4179 iRepository->Set( KCamCrDefaultCaptureMode, ECamVideoCapture ); |
|
4180 break; |
|
4181 default: |
|
4182 break; |
|
4183 } |
|
4184 } |
|
4185 } |
|
4186 |
|
4187 |
|
4188 // --------------------------------------------------------- |
|
4189 // CCamAppUi::SaveCourtesyUiState |
|
4190 // Save whether or not the UI should always be drawn. |
|
4191 // --------------------------------------------------------- |
|
4192 // |
|
4193 |
|
4194 void CCamAppUi::SaveCourtesyUiState() |
|
4195 { |
|
4196 // Since this function can be called from the destructor, |
|
4197 // it is neccesary to check that iRepository is not null prior to use |
|
4198 if ( iRepository ) |
|
4199 { |
|
4200 iRepository->Set( KCamCrAlwaysDrawCourtesyUi, |
|
4201 iAlwaysDrawPreCaptureCourtesyUI ); |
|
4202 } |
|
4203 } |
|
4204 |
|
4205 |
|
4206 |
|
4207 // --------------------------------------------------------- |
|
4208 // CCamAppUi::InitCaptureCountL |
|
4209 // Sets up the number of images to be captured |
|
4210 // --------------------------------------------------------- |
|
4211 // |
|
4212 void CCamAppUi::InitCaptureCountL() |
|
4213 { |
|
4214 PRINT( _L("Camera => CCamAppUi::InitCaptureCountL" )) |
|
4215 // If video mode is active, capture count is not used |
|
4216 if ( iMode == ECamControllerImage ) |
|
4217 { |
|
4218 TInt imageCount = 1; |
|
4219 |
|
4220 switch( iImageMode ) |
|
4221 { |
|
4222 case ECamImageCaptureBurst: |
|
4223 // Capture count initially set to 6 for short burst. |
|
4224 // Once long burst is determined we adjust the burst count. |
|
4225 // This approach keeps short burst as fast as possible. |
|
4226 imageCount = KShortBurstCount; |
|
4227 break; |
|
4228 case ECamImageCaptureTimeLapse: |
|
4229 // In timelapse mode set the limit as high as possible, |
|
4230 // unless self-timer is used. In that case only 6 images |
|
4231 // will be captured. |
|
4232 if ( ECamSelfTimerDisabled != iInSelfTimerMode ) |
|
4233 { |
|
4234 imageCount = KShortBurstCount; |
|
4235 } |
|
4236 else |
|
4237 { |
|
4238 imageCount = iMaxBurstCaptureNum; |
|
4239 } |
|
4240 break; |
|
4241 default: |
|
4242 // Single capture mode. Keep 1 as limit. |
|
4243 break; |
|
4244 } |
|
4245 |
|
4246 iController.SetCaptureLimitL( imageCount ); |
|
4247 } |
|
4248 PRINT( _L("Camera <= CCamAppUi::InitCaptureCountL" )) |
|
4249 } |
|
4250 |
|
4251 // --------------------------------------------------------- |
|
4252 // CCamAppUi::SetCaptureMode |
|
4253 // Set the current capture mode |
|
4254 // --------------------------------------------------------- |
|
4255 // |
|
4256 void |
|
4257 CCamAppUi::SetCaptureMode( TCamCameraMode aMode, |
|
4258 TCamImageCaptureMode aImageMode /*= ECamImageCaptureNone*/) |
|
4259 { |
|
4260 iMode = aMode; |
|
4261 iImageMode = aImageMode; |
|
4262 iTargetMode = aMode; |
|
4263 iTargetImageMode = aImageMode; |
|
4264 } |
|
4265 |
|
4266 // --------------------------------------------------------- |
|
4267 // CCamAppUi::SetTitleEmbeddedL |
|
4268 // Set title to the name of embedding application |
|
4269 // --------------------------------------------------------- |
|
4270 // |
|
4271 void CCamAppUi::SetTitleEmbeddedL() |
|
4272 { |
|
4273 if (iParentAppName != NULL ) |
|
4274 { |
|
4275 SetTitleL ( *iParentAppName ); |
|
4276 } |
|
4277 } |
|
4278 |
|
4279 // --------------------------------------------------------- |
|
4280 // CCamAppUi::CheckMemoryL |
|
4281 // Checks if there is sufficient space available for capture |
|
4282 // --------------------------------------------------------- |
|
4283 // |
|
4284 TBool |
|
4285 CCamAppUi::CheckMemoryL() |
|
4286 { |
|
4287 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CHECKMEMORYL, |
|
4288 "e_CCamAppUi_CheckMemoryL 1" ); |
|
4289 PRINT( _L("Camera => CCamAppUi::CheckMemoryL") ); |
|
4290 TBool capture = ETrue; |
|
4291 |
|
4292 TCamMediaStorage storeToCheck = ECamMediaStorageCurrent; |
|
4293 |
|
4294 if ( ECamControllerVideo == iController.CurrentMode() && |
|
4295 ECamMediaStorageCard == iController.IntegerSettingValue( ECamSettingItemVideoMediaStorage ) && |
|
4296 IsMemoryFullOrUnavailable( ECamMediaStorageCard ) ) |
|
4297 { |
|
4298 storeToCheck = ECamMediaStorageCard; |
|
4299 } |
|
4300 if(AllMemoriesFullOrUnavailable()) |
|
4301 { |
|
4302 HBufC* text = StringLoader::LoadLC(R_NOTE_TEXT_ALLMEMORY_FULL); |
|
4303 TInt ret = ShowOOMNoteL( *text, EFalse); |
|
4304 capture = EFalse; |
|
4305 CleanupStack::PopAndDestroy(text); |
|
4306 } |
|
4307 else if(IsMemoryFullOrUnavailable( storeToCheck )) |
|
4308 { |
|
4309 HBufC* text = StringLoader::LoadLC(R_NOTE_TEXT_MEMORY_FULL); |
|
4310 CAknStaticNoteDialog* note = new( ELeave ) CAknStaticNoteDialog; |
|
4311 note->PrepareLC( R_CAM_OOM_NOTE_OK_CANCEL); |
|
4312 note->SetTextL( *text ); |
|
4313 iController.StopIdleTimer(); |
|
4314 TInt ret = note->RunDlgLD(); |
|
4315 CleanupStack::PopAndDestroy( text ); |
|
4316 if(EAknSoftkeyOk == ret) |
|
4317 { |
|
4318 //when memoryDialog showed, redraw background |
|
4319 if ( IsDirectViewfinderActive() ) |
|
4320 { |
|
4321 TRAP_IGNORE( HandleCommandL( ECamCmdRedrawScreen ) ); |
|
4322 } |
|
4323 |
|
4324 TInt supportedMemTypes = 0; |
|
4325 TCamMediaStorage currentLocation; |
|
4326 TInt key = ( ECamControllerVideo == iMode ) |
|
4327 ? ECamSettingItemVideoMediaStorage |
|
4328 : ECamSettingItemPhotoMediaStorage; |
|
4329 |
|
4330 if ( iMMCRemoveNoteRequiredOnCapture ) |
|
4331 { |
|
4332 iMMCRemoveNoteRequiredOnCapture = EFalse; |
|
4333 currentLocation = static_cast<TCamMediaStorage>( |
|
4334 iController. |
|
4335 IntegerSettingValueUnfiltered( key ) ); |
|
4336 } |
|
4337 else |
|
4338 { |
|
4339 currentLocation = static_cast<TCamMediaStorage>( |
|
4340 iController.IntegerSettingValue( key ) ); |
|
4341 } |
|
4342 if(currentLocation != ECamMediaStoragePhone && |
|
4343 !IsMemoryFullOrUnavailable(ECamMediaStoragePhone)) |
|
4344 { |
|
4345 supportedMemTypes |= AknCommonDialogsDynMem::EMemoryTypePhone; |
|
4346 } |
|
4347 if(currentLocation != ECamMediaStorageCard && |
|
4348 !IsMemoryFullOrUnavailable(ECamMediaStorageCard)) |
|
4349 { |
|
4350 supportedMemTypes |= AknCommonDialogsDynMem::EMemoryTypeMMCExternal; |
|
4351 } |
|
4352 if(currentLocation != ECamMediaStorageMassStorage && |
|
4353 !IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage)) |
|
4354 { |
|
4355 supportedMemTypes |= |
|
4356 AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage; |
|
4357 } |
|
4358 |
|
4359 CAknMemorySelectionDialogMultiDrive* memoryDialog = |
|
4360 CAknMemorySelectionDialogMultiDrive::NewL( |
|
4361 ECFDDialogTypeSelect, |
|
4362 R_CAM_MEMORY_SELECT_DIALOG, |
|
4363 EFalse, |
|
4364 supportedMemTypes ); |
|
4365 TDriveNumber driveNumber = static_cast<TDriveNumber>(KErrNotFound); |
|
4366 CAknCommonDialogsBase::TReturnKey result = |
|
4367 memoryDialog->ExecuteL( driveNumber ); |
|
4368 |
|
4369 if ( result != CAknCommonDialogsBase::TReturnKey( |
|
4370 CAknCommonDialogsBase::ERightSoftkey) ) |
|
4371 { |
|
4372 DriveInfo::TDefaultDrives memVal = |
|
4373 static_cast<DriveInfo::TDefaultDrives>( |
|
4374 CamUtility::GetDriveTypeFromDriveNumber(driveNumber)); |
|
4375 TInt settingValue = |
|
4376 CamUtility::MapFromSettingsListMemory( memVal ); |
|
4377 iController.SetIntegerSettingValueL(key,settingValue); |
|
4378 } |
|
4379 else |
|
4380 { |
|
4381 //No impl. |
|
4382 } |
|
4383 capture = EFalse; |
|
4384 } |
|
4385 else |
|
4386 { |
|
4387 capture = EFalse; |
|
4388 } |
|
4389 iController.StartIdleTimer(); |
|
4390 } |
|
4391 |
|
4392 PRINT1( _L("Camera <= CCamAppUi::CheckMemoryL, capture ok: %d"), capture ); |
|
4393 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMAPPUI_CHECKMEMORYL, |
|
4394 "e_CCamAppUi_CheckMemoryL 0" ); |
|
4395 return capture; |
|
4396 } |
|
4397 |
|
4398 // --------------------------------------------------------- |
|
4399 // CCamAppUi::ShowErrorNoteL |
|
4400 // Display error note |
|
4401 // --------------------------------------------------------- |
|
4402 // |
|
4403 void |
|
4404 CCamAppUi::ShowErrorNoteL( TCamMemoryStatus aStatus ) |
|
4405 { |
|
4406 PRINT( _L("Camera => CCamAppUi::ShowErrorNoteL") ); |
|
4407 TInt resourceId; |
|
4408 |
|
4409 TCamMediaStorage currentLocation; |
|
4410 if ( iMode == ECamControllerVideo ) |
|
4411 { |
|
4412 currentLocation = static_cast<TCamMediaStorage> |
|
4413 ( iController.IntegerSettingValueUnfiltered( ECamSettingItemVideoMediaStorage ) ); |
|
4414 } |
|
4415 else // photo or burst mode |
|
4416 { |
|
4417 currentLocation = static_cast<TCamMediaStorage> |
|
4418 ( iController.IntegerSettingValueUnfiltered( ECamSettingItemPhotoMediaStorage ) ); |
|
4419 } |
|
4420 TInt NumberOfParameters = 0; |
|
4421 TInt drive; |
|
4422 TFileName path; |
|
4423 TInt DriveError = KErrNone; |
|
4424 |
|
4425 // load text from resource |
|
4426 switch ( aStatus ) |
|
4427 { |
|
4428 case ECamMemoryStatusMassStorageFull: |
|
4429 { |
|
4430 // internal and card both full |
|
4431 resourceId = R_NOTE_TEXT_MASSMEMORY_FULL; |
|
4432 // Get the root path of the memory. |
|
4433 DriveError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ); |
|
4434 DriveError = PathInfo::GetRootPath( path, drive ); |
|
4435 if ( DriveError == KErrNone ) |
|
4436 { |
|
4437 // %U parameter |
|
4438 NumberOfParameters = 1; |
|
4439 } |
|
4440 else |
|
4441 { |
|
4442 // no %U parameter |
|
4443 NumberOfParameters = 0; |
|
4444 } |
|
4445 } |
|
4446 break; |
|
4447 |
|
4448 case ECamMemoryStatusFull: |
|
4449 { |
|
4450 if ( currentLocation == ECamMediaStorageMassStorage ) |
|
4451 { |
|
4452 // internal mass storage full |
|
4453 resourceId = R_NOTE_TEXT_MASSMEMORY_FULL; |
|
4454 // Get the root path of the memory. |
|
4455 DriveError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ); |
|
4456 DriveError = PathInfo::GetRootPath( path, drive ); |
|
4457 } |
|
4458 else if ( currentLocation == ECamMediaStoragePhone ) |
|
4459 { |
|
4460 // internal phone memory full |
|
4461 resourceId = R_NOTE_TEXT_NOT_ENOUGH_DEVICE_MEMORY; |
|
4462 // Get the root path of the memory. |
|
4463 DriveError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ); |
|
4464 DriveError = PathInfo::GetRootPath( path, drive ); |
|
4465 } |
|
4466 else |
|
4467 { |
|
4468 // memory card full |
|
4469 resourceId = R_NOTE_TEXT_NOT_ENOUGH_MEMORY_CARD_DEFAULTNAME; |
|
4470 // Get the root path of the memory. |
|
4471 DriveError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); |
|
4472 DriveError = PathInfo::GetRootPath( path, drive ); |
|
4473 } |
|
4474 if ( DriveError == KErrNone ) |
|
4475 { |
|
4476 // %U parameter |
|
4477 NumberOfParameters = 1; |
|
4478 } |
|
4479 else |
|
4480 { |
|
4481 // no %U parameter |
|
4482 NumberOfParameters = 0; |
|
4483 } |
|
4484 |
|
4485 } |
|
4486 break; |
|
4487 |
|
4488 case ECamMemoryStatusInternalFull: |
|
4489 { |
|
4490 if ( currentLocation == ECamMediaStorageMassStorage ) |
|
4491 { |
|
4492 // internal space full |
|
4493 resourceId = R_NOTE_TEXT_MASSMEMORY_FULL; |
|
4494 // Get the root path of the memory. |
|
4495 DriveError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ); |
|
4496 DriveError = PathInfo::GetRootPath( path, drive ); |
|
4497 } |
|
4498 else |
|
4499 { |
|
4500 // internal space full |
|
4501 resourceId = R_NOTE_TEXT_NOT_ENOUGH_DEVICE_MEMORY; |
|
4502 // Get the root path of the memory. |
|
4503 DriveError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ); |
|
4504 DriveError = PathInfo::GetRootPath( path, drive ); |
|
4505 } |
|
4506 if ( DriveError == KErrNone ) |
|
4507 { |
|
4508 // %U parameter |
|
4509 NumberOfParameters = 1; |
|
4510 } |
|
4511 else |
|
4512 { |
|
4513 // no %U parameter |
|
4514 NumberOfParameters = 0; |
|
4515 } |
|
4516 } |
|
4517 break; |
|
4518 |
|
4519 case ECamMemoryStatusCardNotInserted: // fallthrough |
|
4520 case ECamMemoryStatusCardLocked: |
|
4521 { |
|
4522 // card not present or corrupt or locked |
|
4523 resourceId = R_NOTE_TEXT_CARD_NOT_INSERTED; |
|
4524 } |
|
4525 break; |
|
4526 |
|
4527 case ECamMemoryStatusCardReadOnly: |
|
4528 { |
|
4529 // card read-only |
|
4530 resourceId = R_NOTE_TEXT_CARD_READ_ONLY; |
|
4531 } |
|
4532 break; |
|
4533 |
|
4534 default: |
|
4535 { |
|
4536 // invalid status - don't show note |
|
4537 return; |
|
4538 } |
|
4539 } |
|
4540 |
|
4541 // prevent timeout to standby - stop standby timer |
|
4542 iController.StopIdleTimer(); |
|
4543 |
|
4544 if ( iView && ( iStillCaptureView == iView || iVideoCaptureView == iView ) ) |
|
4545 { |
|
4546 // Precapture view is visible... Enable the non-fading flag here to keep |
|
4547 // viewfinder visible under the note. The non-fading flag is reset when |
|
4548 // getting the EEventFocusGained event |
|
4549 CCoeControl* container = static_cast<CCamViewBase*>( iView )->Container(); |
|
4550 if ( container ) |
|
4551 { |
|
4552 RDrawableWindow* window = container->DrawableWindow(); |
|
4553 if ( window ) |
|
4554 { |
|
4555 window->SetNonFading( ETrue ); |
|
4556 } |
|
4557 } |
|
4558 } |
|
4559 if ( NumberOfParameters == 0 ) |
|
4560 { |
|
4561 // set error note text |
|
4562 HBufC* text = StringLoader::LoadLC( resourceId ); |
|
4563 // show error note |
|
4564 CAknStaticNoteDialog* note = new( ELeave ) CAknStaticNoteDialog; |
|
4565 note->PrepareLC( R_CAM_ERROR_NOTE ); |
|
4566 note->SetTextL( *text ); |
|
4567 note->RunDlgLD(); |
|
4568 CleanupStack::PopAndDestroy( text ); |
|
4569 } |
|
4570 else if ( NumberOfParameters == 1 ) |
|
4571 { |
|
4572 // set error note text |
|
4573 HBufC* text = StringLoader::LoadLC( resourceId, path, iEikonEnv ); |
|
4574 // show error note |
|
4575 CAknStaticNoteDialog* note = new( ELeave ) CAknStaticNoteDialog; |
|
4576 note->PrepareLC( R_CAM_ERROR_NOTE ); |
|
4577 note->SetTextL( *text ); |
|
4578 note->RunDlgLD(); |
|
4579 CleanupStack::PopAndDestroy( text ); |
|
4580 } |
|
4581 |
|
4582 // restart standby timer |
|
4583 iController.StartIdleTimer(); |
|
4584 |
|
4585 PRINT( _L("Camera <= CCamAppUi::ShowErrorNoteL") ); |
|
4586 } |
|
4587 |
|
4588 // --------------------------------------------------------- |
|
4589 // CCamAppUi::ShowOOMNoteL |
|
4590 // Display error note for OOM condition |
|
4591 // --------------------------------------------------------- |
|
4592 // |
|
4593 TInt CCamAppUi::ShowOOMNoteL( TDesC& aLabel, TBool aWithCancel ) |
|
4594 { |
|
4595 // prevent timeout to standby - stop standby timer |
|
4596 iController.StopIdleTimer(); |
|
4597 |
|
4598 // show OOM note |
|
4599 CAknStaticNoteDialog* note = new( ELeave ) CAknStaticNoteDialog; |
|
4600 if(aWithCancel) |
|
4601 note->PrepareLC( R_CAM_OOM_NOTE_OK_CANCEL); |
|
4602 else |
|
4603 note->PrepareLC( R_CAM_OOM_NOTE_OK_EMPTY); |
|
4604 note->SetTextL( aLabel ); |
|
4605 TInt ret = note->RunDlgLD(); |
|
4606 |
|
4607 // restart standby timer |
|
4608 iController.StartIdleTimer(); |
|
4609 |
|
4610 return ret; |
|
4611 } |
|
4612 |
|
4613 // --------------------------------------------------------- |
|
4614 // CCamAppUi::ShowMMCRemovalNoteIfRequiredL |
|
4615 // Shows the mmc removal note if it is required |
|
4616 // --------------------------------------------------------- |
|
4617 // |
|
4618 void |
|
4619 CCamAppUi::ShowMMCRemovalNoteIfRequiredL() |
|
4620 { |
|
4621 PRINT( _L("Camera => CCamAppUi::ShowMMCRemovalNoteIfRequiredL") ); |
|
4622 // If we have detected a removal and not shown the note. |
|
4623 if ( iViewState != ECamViewStateStandby && iMMCRemoveNoteRequired ) |
|
4624 { |
|
4625 PRINT( _L("Camera <> Need to show note") ); |
|
4626 |
|
4627 iMMCRemoveNoteRequired = EFalse; |
|
4628 // Show the card not inserted note |
|
4629 if( !iSendAsInProgress ) |
|
4630 { |
|
4631 PRINT( _L("Camera <> showing note..") ); |
|
4632 ShowErrorNoteL( ECamMemoryStatusCardNotInserted ); |
|
4633 PRINT( _L("Camera <> ..done") ); |
|
4634 } |
|
4635 } |
|
4636 if ( IsDirectViewfinderActive() ) |
|
4637 { |
|
4638 TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen)); |
|
4639 } |
|
4640 PRINT( _L("Camera <= CCamAppUi::ShowMMCRemovalNoteIfRequiredL") ); |
|
4641 } |
|
4642 |
|
4643 // --------------------------------------------------------- |
|
4644 // CCamAppUi::CheckMemoryCard |
|
4645 // Check status of the memory card |
|
4646 // --------------------------------------------------------- |
|
4647 // |
|
4648 void CCamAppUi::CheckMemoryCard( TBool& aFull, |
|
4649 TCamMemoryStatus& aStatus, TCamMediaStorage aCurrentLocation ) |
|
4650 { |
|
4651 // check if memory card is full |
|
4652 aFull = MemoryFull( ECamMediaStorageCard, aCurrentLocation ); |
|
4653 |
|
4654 // get status of card |
|
4655 TCamMemoryCardStatus cardStatus = CamUtility::MemoryCardStatus(); |
|
4656 switch ( cardStatus ) |
|
4657 { |
|
4658 case ECamMemoryCardLocked: |
|
4659 { |
|
4660 // card is locked |
|
4661 aStatus = ECamMemoryStatusCardLocked; |
|
4662 } |
|
4663 break; |
|
4664 case ECamMemoryCardInserted: |
|
4665 { |
|
4666 aStatus = ECamMemoryStatusOK; |
|
4667 } |
|
4668 break; |
|
4669 case ECamMemoryCardNotInserted: |
|
4670 default: |
|
4671 { |
|
4672 aStatus = ECamMemoryStatusCardNotInserted; |
|
4673 } |
|
4674 break; |
|
4675 } |
|
4676 } |
|
4677 |
|
4678 // --------------------------------------------------------- |
|
4679 // CCamAppUi::MemoryFull |
|
4680 // Check if the memory location (phone or card) is full |
|
4681 // --------------------------------------------------------- |
|
4682 // |
|
4683 TBool |
|
4684 CCamAppUi::MemoryFull( TCamMediaStorage aStorage, |
|
4685 TCamMediaStorage aCurrentLocation ) |
|
4686 { |
|
4687 PRINT( _L("Camera => CCamAppUi::MemoryFull") ); |
|
4688 TBool cardFull = ETrue; |
|
4689 |
|
4690 if ( iMode != ECamControllerVideo ) |
|
4691 { |
|
4692 // check there is space for image(s) |
|
4693 TInt numImages = iController.ImagesRemaining( aStorage, IsBurstEnabled() ); |
|
4694 |
|
4695 // at least 1 image for still capture and 2 for sequence capture |
|
4696 if ( ( iImageMode == ECamImageCaptureSingle && numImages > 0 ) || |
|
4697 numImages > 1 ) |
|
4698 { |
|
4699 cardFull = EFalse; |
|
4700 } |
|
4701 else |
|
4702 { |
|
4703 cardFull = ETrue; |
|
4704 } |
|
4705 } |
|
4706 else // capture mode is video |
|
4707 { |
|
4708 // If we want to know the remaining time at the current storage location |
|
4709 // we can obtain this from the engine. |
|
4710 if ( aStorage == aCurrentLocation ) |
|
4711 { |
|
4712 TTimeIntervalMicroSeconds timeRemaining = iController.RecordTimeRemaining(); |
|
4713 |
|
4714 // Check that enough rec time available |
|
4715 // or that we are recording short (MMS) video |
|
4716 if ( timeRemaining >= KMemoryFullVideoRemaining ) |
|
4717 { |
|
4718 PRINT( _L("Camera <> not full 1") ); |
|
4719 cardFull = EFalse; |
|
4720 } |
|
4721 else |
|
4722 { |
|
4723 PRINT( _L("Camera <> full 1") ); |
|
4724 cardFull = ETrue; |
|
4725 } |
|
4726 } |
|
4727 else |
|
4728 { |
|
4729 // We want to know how much remaining time is available on the |
|
4730 // storage location not currently in use. |
|
4731 // We don't have a reliable way of estimating this, so we will |
|
4732 // assume that if there is more space available than on the current |
|
4733 // storage location, then the memory is not full. |
|
4734 |
|
4735 TTimeIntervalMicroSeconds phoneMemoryFree = |
|
4736 CamUtility::MemoryFree( DriveInfo::EDefaultPhoneMemory ); |
|
4737 TTimeIntervalMicroSeconds cardMemoryFree = |
|
4738 CamUtility::MemoryFree( DriveInfo::EDefaultRemovableMassStorage ); |
|
4739 TTimeIntervalMicroSeconds MassMemoryFree = |
|
4740 CamUtility::MemoryFree( DriveInfo::EDefaultMassStorage ); |
|
4741 if ( aCurrentLocation == ECamMediaStoragePhone ) |
|
4742 { |
|
4743 if ( phoneMemoryFree > cardMemoryFree |
|
4744 && phoneMemoryFree > MassMemoryFree |
|
4745 ) |
|
4746 { |
|
4747 PRINT( _L("Camera <> full 2") ); |
|
4748 cardFull = ETrue; |
|
4749 } |
|
4750 else |
|
4751 { |
|
4752 PRINT( _L("Camera <> not full 2") ); |
|
4753 cardFull = EFalse; |
|
4754 } |
|
4755 } |
|
4756 else if ( aCurrentLocation == ECamMediaStorageMassStorage ) |
|
4757 { |
|
4758 if ( MassMemoryFree > cardMemoryFree |
|
4759 && MassMemoryFree > phoneMemoryFree ) |
|
4760 { |
|
4761 PRINT( _L("Camera <> full 3") ); |
|
4762 cardFull = ETrue; |
|
4763 } |
|
4764 else |
|
4765 { |
|
4766 PRINT( _L("Camera <> not full 3") ); |
|
4767 cardFull = EFalse; |
|
4768 } |
|
4769 } |
|
4770 else |
|
4771 { |
|
4772 if ( cardMemoryFree > phoneMemoryFree |
|
4773 && cardMemoryFree > MassMemoryFree ) |
|
4774 { |
|
4775 PRINT( _L("Camera <> full 4") ); |
|
4776 cardFull = ETrue; |
|
4777 } |
|
4778 else |
|
4779 { |
|
4780 PRINT( _L("Camera <> not full 4") ); |
|
4781 cardFull = EFalse; |
|
4782 } |
|
4783 } |
|
4784 } |
|
4785 } |
|
4786 |
|
4787 PRINT1( _L("Camera <= CCamAppUi::MemoryFull, full:%d"), cardFull ); |
|
4788 return cardFull; |
|
4789 } |
|
4790 |
|
4791 // --------------------------------------------------------- |
|
4792 // CCamAppUi::StartCaptureL |
|
4793 // Starts the video/photo capture |
|
4794 // --------------------------------------------------------- |
|
4795 // |
|
4796 TKeyResponse |
|
4797 CCamAppUi::StartCaptureL( const TKeyEvent& /*aKeyEvent*/ ) |
|
4798 { |
|
4799 PRINT( _L("Camera => CCamAppUi::StartCaptureL") ); |
|
4800 iLensCoverExit = EFalse; |
|
4801 if ( iMode != ECamControllerVideo ) |
|
4802 { |
|
4803 // Check for active viewfinder before proceeding with capture |
|
4804 if ( !iController.IsViewFinding() ) |
|
4805 { |
|
4806 // VF not active - stop capture |
|
4807 PRINT( _L("Camera <= CCamAppUi::StartCaptureL, not vf") ); |
|
4808 return EKeyWasNotConsumed; |
|
4809 } |
|
4810 // If the view is in self-timer mode, pressing of the shutter |
|
4811 // button initiates the timer... |
|
4812 if ( iInSelfTimerMode != ECamSelfTimerDisabled ) |
|
4813 { |
|
4814 __ASSERT_DEBUG( iSelfTimer, CamPanic( ECamPanicNullPointer ) ); |
|
4815 // Will start timer if not already started. |
|
4816 // If already started, forces capture NOW. |
|
4817 /*iSelfTimer->StartSelfTimer(); |
|
4818 |
|
4819 // Change CBA to be SK1 (Blank) SK2 (Cancel) |
|
4820 UpdateCba();*/ |
|
4821 HandleCommandL(ECamCmdSelfTimerActivate); |
|
4822 } |
|
4823 else // Not in SelfTimer mode so just take the photo. |
|
4824 { |
|
4825 if ( iController.IsProcessingCapture() ) |
|
4826 { |
|
4827 PRINT( _L("Camera <= CCamAppUi::StartCaptureL - already processing - ignored capture key") ); |
|
4828 return EKeyWasNotConsumed; |
|
4829 } |
|
4830 |
|
4831 // Start capture |
|
4832 iController.Capture(); |
|
4833 |
|
4834 // Ensure softkeys are correct for sequence |
|
4835 if ( IsBurstEnabled() ) |
|
4836 { |
|
4837 if( ECamImageCaptureBurst == iImageMode ) |
|
4838 { |
|
4839 //Disable cancel autofocus and capture functionality from now on until burst is finished. |
|
4840 PRINT( _L("Camera <> CCamAppUi::StartCaptureL, SetNoBurstCancel( ETrue )") ); |
|
4841 iController.SetKeyUp(); |
|
4842 iController.SetNoBurstCancel( ETrue ); |
|
4843 } |
|
4844 // Make sure cancel softkey is displayed |
|
4845 iPreventActivePaletteDisplay = ETrue; |
|
4846 static_cast<CCamViewBase*>( iView )->UnsetCourtesySoftKeysL(); |
|
4847 // Change CBA to be SK1 (Blank) SK2 (Cancel) |
|
4848 UpdateCba(); |
|
4849 |
|
4850 // disable timeout to standby during burst capture |
|
4851 iController.StopIdleTimer(); |
|
4852 } |
|
4853 } |
|
4854 // Shutter key - full press -> perform capture |
|
4855 PRINT( _L("Camera <= CCamAppUi::StartCaptureL, image capture requested") ); |
|
4856 return EKeyWasConsumed; |
|
4857 } |
|
4858 |
|
4859 // video capture mode |
|
4860 else |
|
4861 { |
|
4862 // check for available space before proceeding with capture |
|
4863 TInt callType( EPSCTsyCallTypeUninitialized ); |
|
4864 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType ); |
|
4865 // video call or no memory available - stop capture |
|
4866 if ( callType == EPSCTsyCallTypeH324Multimedia || !iController.IsViewFinding() || !CheckMemoryL() ) |
|
4867 { |
|
4868 PRINT( _L("Camera <= CCamAppUi::StartCaptureL, video no memory") ); |
|
4869 return EKeyWasNotConsumed; |
|
4870 } |
|
4871 PERF_EVENT_END_L1( EPerfEventKeyToCapture ); |
|
4872 PERF_EVENT_START_L1( EPerfEventStartVideoRecording ); |
|
4873 static_cast<CCamViewBase*>( iView )->UnsetCourtesySoftKeysL(); |
|
4874 iController.StartVideoRecordingL(); |
|
4875 PRINT( _L("Camera <= CCamAppUi::StartCaptureL, video capture requested") ); |
|
4876 return EKeyWasConsumed; |
|
4877 } |
|
4878 } |
|
4879 |
|
4880 // --------------------------------------------------------- |
|
4881 // CCamAppUi::EndCapture |
|
4882 // Stops the capture of video |
|
4883 // --------------------------------------------------------- |
|
4884 // |
|
4885 void CCamAppUi::EndCapture() |
|
4886 { |
|
4887 PRINT( _L("Camera => CCamAppUi::EndCapture") ); |
|
4888 if ( ECamControllerVideo == iMode && !iController.IsDemandKeyRelease() ) |
|
4889 { |
|
4890 TCamCaptureOperation operation = iController.CurrentOperation(); |
|
4891 // if in video recording or paused state |
|
4892 if ( ECamCapturing == operation |
|
4893 || ECamPaused == operation ) |
|
4894 { |
|
4895 // if already requested to stop the recording |
|
4896 // but the operation hasn't completed yet |
|
4897 // then just return |
|
4898 if ( iWaitTimer->IsActive() ) |
|
4899 { |
|
4900 return; |
|
4901 } |
|
4902 |
|
4903 ZoomPane()->StopZoom(); |
|
4904 ZoomPane()->MakeVisible( EFalse, ETrue ); |
|
4905 // ignore any errors (eg out of memory) |
|
4906 TRAP_IGNORE( SetSoftKeysL( R_CAM_SOFTKEYS_BLANK ) ); |
|
4907 TRAP_IGNORE( DisplayWaitDialogL() ); |
|
4908 // give the wait dialog a chance to display itself |
|
4909 iWaitTimer->Start( 0, 0, TCallBack( StopVideoRecording, this ) ); |
|
4910 } |
|
4911 } |
|
4912 PRINT( _L("Camera <= CCamAppUi::EndCapture") ); |
|
4913 } |
|
4914 |
|
4915 // --------------------------------------------------------- |
|
4916 // CCamAppUi::SwitchOrientationIfRequiredL |
|
4917 // Change to the new orientation if necessary |
|
4918 // --------------------------------------------------------- |
|
4919 // |
|
4920 void CCamAppUi::SwitchOrientationIfRequiredL( TInt aNewOrientation ) |
|
4921 { |
|
4922 TInt error = KErrNone; |
|
4923 // No orientation specified, find the default orientation |
|
4924 if ( aNewOrientation == EAppUiOrientationUnspecified ) |
|
4925 { |
|
4926 if ( iController.UiConfigManagerPtr()->IsSecondaryCameraSupported() ) |
|
4927 { |
|
4928 // Default orientation is determined by current active camera |
|
4929 if ( IsSecondCameraEnabled() && !IsQwerty2ndCamera() ) |
|
4930 { |
|
4931 error = CamUtility::GetPsiInt( ECamPsiSecondaryCameraOrientation, aNewOrientation ); |
|
4932 } |
|
4933 else |
|
4934 { |
|
4935 error = CamUtility::GetPsiInt( ECamPsiPrimaryCameraOrientation, aNewOrientation ); |
|
4936 } |
|
4937 } |
|
4938 else |
|
4939 { |
|
4940 error = CamUtility::GetPsiInt( ECamPsiOrientation, aNewOrientation ); |
|
4941 } |
|
4942 } |
|
4943 TAppUiOrientation currentOrientation = Orientation(); |
|
4944 if ( !error && ( aNewOrientation != currentOrientation ) ) |
|
4945 { |
|
4946 PRINT( _L("Camera => CCamAppUi::SwitchOrientationIfRequiredL set orient" )) |
|
4947 SetOrientationL( static_cast<TAppUiOrientation>( aNewOrientation ) ); |
|
4948 } |
|
4949 } |
|
4950 |
|
4951 // --------------------------------------------------------- |
|
4952 // CCamAppUi::HandleScreenDeviceChangedL |
|
4953 // Handle change of orientation etc. |
|
4954 // --------------------------------------------------------- |
|
4955 // |
|
4956 void CCamAppUi::HandleScreenDeviceChangedL() |
|
4957 { |
|
4958 PRINT( _L("Camera => CCamAppUi::HandleScreenDeviceChangedL") ) |
|
4959 CAknAppUiBase::HandleScreenDeviceChangedL(); |
|
4960 if ( iEngineConstructionDelayed ) |
|
4961 { |
|
4962 PRINT( _L("CCamAppUi::HandleScreenDeviceChangedL continuing engine construction") ); |
|
4963 iEngineConstructionDelayed = EFalse; |
|
4964 iController.CompleteConstructionL(); |
|
4965 // Don't set the target mode here. If the application is not embedded |
|
4966 // the mode will already be correct. If embedded, the target mode is set |
|
4967 // when the HandleNewFileL function is called. |
|
4968 iTargetViewState = ECamViewStatePreCapture; |
|
4969 |
|
4970 // pre-construct side-pane & zoom pane |
|
4971 // get whether we overlay sidepane over view-finder |
|
4972 TBool overlayViewFinder = EFalse; |
|
4973 User::LeaveIfError( CamUtility::GetPsiInt( ECamPsiOverLaySidePane, overlayViewFinder ) ); |
|
4974 |
|
4975 iCamSidePane = CCamSidePane::NewL( iController, overlayViewFinder ); |
|
4976 User::LeaveIfError(iResourceLoaders.Append(iCamSidePane)); |
|
4977 |
|
4978 iCamZoomPane = CCamZoomPane::NewL( iController, overlayViewFinder ); |
|
4979 User::LeaveIfError(iResourceLoaders.Append(iCamZoomPane)); |
|
4980 |
|
4981 // Exit standby mode now |
|
4982 // (unless still waiting for HandleNewFileL command - embedded only) |
|
4983 if ( IsConstructionComplete() ) |
|
4984 { |
|
4985 // make sure standby exits as this may not actually result in |
|
4986 // a view switch if the correct view is already activated |
|
4987 if( iView ) |
|
4988 { |
|
4989 iView->HandleCommandL( ECamCmdExitStandby ); |
|
4990 } |
|
4991 |
|
4992 iViewState = ECamViewStatePreCapture; |
|
4993 TrySwitchViewL(); |
|
4994 } |
|
4995 } |
|
4996 |
|
4997 if ( iController.UiConfigManagerPtr()->IsSecondaryCameraSupported() ) |
|
4998 { |
|
4999 if ( iCameraSwitchDelayed ) |
|
5000 { |
|
5001 PRINT( _L("CCamAppUi::HandleScreenDeviceChangedL restarting switch camera") ); |
|
5002 iCameraSwitchDelayed = EFalse; |
|
5003 iController.SwitchCameraL(); |
|
5004 // The keys will have been blanked - update them |
|
5005 static_cast<CCamViewBase*>( iView )->UpdateCbaL(); |
|
5006 } |
|
5007 } |
|
5008 PRINT( _L("Camera <= CCamAppUi::HandleScreenDeviceChangedL") ); |
|
5009 } |
|
5010 |
|
5011 // --------------------------------------------------------- |
|
5012 // CCamAppUi::StopVideoRecording |
|
5013 // Stops the video recording |
|
5014 // --------------------------------------------------------- |
|
5015 // |
|
5016 TInt CCamAppUi::StopVideoRecording( TAny* aAny ) |
|
5017 { |
|
5018 PRINT( _L("Camera => CCamAppUi::StopVideoRecording") ); |
|
5019 CCamAppUi* appui = static_cast<CCamAppUi*>( aAny ); |
|
5020 __ASSERT_DEBUG( appui != NULL && appui->iWaitTimer != NULL, CamPanic( ECamPanicNullPointer ) ); |
|
5021 appui->iWaitTimer->Cancel(); |
|
5022 appui->iController.StopVideoRecordingAsync(); |
|
5023 PRINT( _L("Camera <= CCamAppUi::StopVideoRecording") ); |
|
5024 return KErrNone; |
|
5025 } |
|
5026 |
|
5027 // --------------------------------------------------------- |
|
5028 // CCamAppUi::CallExit |
|
5029 // Exit the application |
|
5030 // --------------------------------------------------------- |
|
5031 // |
|
5032 TInt CCamAppUi::CallExit( TAny* aAny ) |
|
5033 { |
|
5034 PRINT( _L("Camera => CCamAppUi::CallExit") ) |
|
5035 CCamAppUi* appui = static_cast<CCamAppUi*>( aAny ); |
|
5036 __ASSERT_DEBUG( appui != NULL && appui->iWaitTimer != NULL, CamPanic( ECamPanicNullPointer ) ); |
|
5037 appui->iWaitTimer->Cancel(); |
|
5038 appui->Exit(); |
|
5039 return KErrNone; |
|
5040 } |
|
5041 |
|
5042 // --------------------------------------------------------- |
|
5043 // CCamAppUi::CloseAppL |
|
5044 // Exit the application |
|
5045 // --------------------------------------------------------- |
|
5046 // |
|
5047 void CCamAppUi::CloseAppL() |
|
5048 { |
|
5049 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CLOSEAPPL, "e_CCamAppUi_CloseAppL 1" ); |
|
5050 |
|
5051 PRINT( _L("Camera => CCamAppUi::CloseAppL") ) |
|
5052 |
|
5053 // cancel the self timer if active - can be active |
|
5054 // if closing the slide while counting down |
|
5055 if ( iInSelfTimerMode != ECamSelfTimerDisabled ) |
|
5056 { |
|
5057 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
5058 } |
|
5059 |
|
5060 // if we are exiting cam app, we dont need any updates |
|
5061 // for the navipane |
|
5062 if ( NULL != iNaviCounterControl && NULL != iNaviPaneCounterControl && |
|
5063 NULL != iNaviProgressBarControl && NULL != iNaviPaneProgressBarControl ) |
|
5064 { |
|
5065 UpdateNaviModelsL( EFalse ); |
|
5066 } |
|
5067 |
|
5068 if ( iEikonEnv->StartedAsServerApp() ) |
|
5069 { |
|
5070 TCamCaptureOperation operation( iController.CurrentOperation() ); |
|
5071 |
|
5072 // If recording a video, ensure exit after video recording process has completed |
|
5073 if( ECamControllerVideo == iMode |
|
5074 && ( ECamCapturing == operation |
|
5075 || ECamPausing == operation |
|
5076 || ECamPaused == operation |
|
5077 || ECamResuming == operation ) ) |
|
5078 { |
|
5079 iController.EnterShutdownMode( EFalse ); |
|
5080 } |
|
5081 // Otherwise, close application immediately. |
|
5082 else |
|
5083 { |
|
5084 iController.EnterShutdownMode( ETrue ); |
|
5085 Exit(); |
|
5086 } |
|
5087 } |
|
5088 else |
|
5089 { |
|
5090 // this will exit when any current process completes |
|
5091 iController.EnterShutdownMode( EFalse ); |
|
5092 } |
|
5093 PRINT( _L("Camera <= CCamAppUi::CloseAppL") ) |
|
5094 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP_CCAMAPPUI_CLOSEAPPL, "e_CCamAppUi_CloseAppL 0" ); |
|
5095 |
|
5096 } |
|
5097 |
|
5098 // --------------------------------------------------------- |
|
5099 // CCamAppUi::InternalExitL |
|
5100 // Exit the application from an internal call - this often means |
|
5101 // just going to the background and resetting the settings/modes |
|
5102 // --------------------------------------------------------- |
|
5103 // |
|
5104 void CCamAppUi::InternalExitL() |
|
5105 { |
|
5106 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 1" ); |
|
5107 |
|
5108 PRINT( _L("Camera => CCamAppUi::InternalExitL") ); |
|
5109 |
|
5110 iController.StoreFaceTrackingValue(); // store the current FT setting |
|
5111 |
|
5112 if ( iController.UiConfigManagerPtr() && |
|
5113 iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
5114 { |
|
5115 // If record location setting is on, stop location trail |
|
5116 if ( ECamLocationOn == iController.IntegerSettingValue( ECamSettingItemRecLocation ) ) |
|
5117 { |
|
5118 // The parameter ETrue for also closing the session to location utility server |
|
5119 // when exiting camera. |
|
5120 iController.StopLocationTrail( ETrue ); |
|
5121 } |
|
5122 } |
|
5123 |
|
5124 if( !iController.IsSavingInProgress() ) |
|
5125 { |
|
5126 iController.ReleaseArray(ETrue); |
|
5127 } |
|
5128 |
|
5129 if ( iEikonEnv->StartedAsServerApp() || !iController.AlwaysOnSupported() ) |
|
5130 { |
|
5131 CloseAppL(); |
|
5132 } |
|
5133 else if ( SettingsLaunchedFromCamera() ) |
|
5134 { |
|
5135 //If internal exit was called from settings, we need to set the camera to |
|
5136 //background before closing it to prevent view switch and that way ensuring |
|
5137 //that all the camera resources are released in exit. |
|
5138 SendCameraAppToBackgroundL(); |
|
5139 CloseAppL(); |
|
5140 } |
|
5141 else |
|
5142 { |
|
5143 // if UI orientetion override is supported or lens cover is not and |
|
5144 // exiting 2ndary camera, set cameraswitch to main camera since |
|
5145 // always starting in maincamera stillmode |
|
5146 if ( iController.UiConfigManagerPtr() && |
|
5147 ( iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() || |
|
5148 !iController.UiConfigManagerPtr()->IsLensCoverSupported() ) && |
|
5149 IsSecondCameraEnabled() ) |
|
5150 { |
|
5151 iController.SetCameraSwitchRequired( ESwitchSecondaryToPrimary ); |
|
5152 } |
|
5153 else if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() ) |
|
5154 { |
|
5155 PRINT( _L("Camera <> SetCameraSwitchRequired -> ESwitchToUnknown") ); |
|
5156 iController.SetCameraSwitchRequired( ESwitchToUnknown ); |
|
5157 } |
|
5158 // cancel the self timer if active - can be active |
|
5159 // if closing the slide while counting down |
|
5160 if ( iInSelfTimerMode != ECamSelfTimerDisabled) |
|
5161 { |
|
5162 SelfTimerEnableL( ECamSelfTimerDisabled ); |
|
5163 } |
|
5164 |
|
5165 if ( iController.UiConfigManagerPtr()->IsLensCoverSupported() ) |
|
5166 { |
|
5167 iController.SliderCloseEventActioned(); |
|
5168 } |
|
5169 |
|
5170 iController.SetEndKeyExitWaiting( EFalse ); |
|
5171 PRINT( _L("Camera CCamAppUi::InternalExitL - setting zoom reset pending") ); |
|
5172 |
|
5173 iCamZoomPane->ResetToDefaultAfterPrepare( ETrue ); |
|
5174 SendCameraAppToBackgroundL(); |
|
5175 |
|
5176 // if faster startup feature is supported, always start in stillmode after exit |
|
5177 if ( iController.UiConfigManagerPtr() && |
|
5178 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() && |
|
5179 iMode == ECamControllerVideo ) |
|
5180 { |
|
5181 PRINT( _L("Camera <> InternalExitL - switching to still precapture") ); |
|
5182 iTargetMode = ECamControllerImage; |
|
5183 iTargetViewState = ECamViewStatePreCapture; |
|
5184 TrySwitchViewL( ETrue ); |
|
5185 } |
|
5186 else if ( iView && iViewState != ECamViewStatePreCapture && iReturnedFromPlugin ) |
|
5187 { |
|
5188 PRINT( _L("Camera: CCamAppUi::InternalExitL - switching to precapture mode") ) |
|
5189 iTargetViewState = ECamViewStatePreCapture; |
|
5190 TrySwitchViewL( ETrue ); |
|
5191 } |
|
5192 |
|
5193 // If the application is already in the background but has not released |
|
5194 // the resources (e.g. it was behind an eikon server window and had not yet set |
|
5195 // the iPretendExit flag) then the view needs to know that the resources should |
|
5196 // be released now. |
|
5197 // This situation occurs when the application is 'pretending' to exit after a |
|
5198 // slider closed event, but the keypad lock note appeared (but only if it was |
|
5199 // in the middle of capturing a sequence as the exit is delayed for the sequence |
|
5200 // to complete). |
|
5201 // HandleFocusLoss() releases the resources in situations where the app was |
|
5202 // 'continuing in the background'. This release of resources will only occur |
|
5203 // once as the iContinueInBackground flag is reset as soon as the resources are |
|
5204 // released. |
|
5205 |
|
5206 if ( iView && iReturnedFromPlugin ) |
|
5207 { |
|
5208 PRINT( _L("Camera InternalExitL calling iView->HandleFocusLossL()") ); |
|
5209 static_cast<CCamViewBase*>( iView )->HandleFocusLossL(); |
|
5210 } |
|
5211 // Reset active palette position. As this is done before pretended exit, |
|
5212 // no AP update is needed when the application is returned to foreground |
|
5213 if( iActivePaletteHandler && iReturnedFromPlugin ) |
|
5214 { |
|
5215 iActivePaletteHandler->ResetToDefaultItem(); |
|
5216 // Ensure AP visibility on camera startup (also for 2ndary camera) |
|
5217 // unless UI orientation override is used |
|
5218 if ( iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) |
|
5219 { |
|
5220 iActivePaletteHandler->SetVisibility( EFalse ); |
|
5221 } |
|
5222 else |
|
5223 { |
|
5224 iActivePaletteHandler->SetVisibility( ETrue ); |
|
5225 } |
|
5226 if( ECamViewStatePreCapture == iViewState ) |
|
5227 { |
|
5228 iDrawPreCaptureCourtesyUI = ETrue; |
|
5229 if ( !iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) |
|
5230 { |
|
5231 RaisePreCaptureCourtesyUI(EFalse); |
|
5232 } |
|
5233 |
|
5234 if ( IsSecondCameraEnabled() |
|
5235 && !IsEmbedded() ) |
|
5236 { |
|
5237 if ( ECamControllerVideo == iMode ) |
|
5238 { |
|
5239 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD_SECONDARY ); |
|
5240 } |
|
5241 else |
|
5242 { |
|
5243 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__CAPTURE_SECONDARY ); |
|
5244 } |
|
5245 } |
|
5246 } |
|
5247 } |
|
5248 |
|
5249 // Cancel delayed sensor initialization, in case it's still pending when |
|
5250 // internal exit is requested. |
|
5251 if ( iController.UiConfigManagerPtr()->IsOrientationSensorSupported() ) |
|
5252 { |
|
5253 CancelSensorIdle(); |
|
5254 } |
|
5255 |
|
5256 if ( iController.UiConfigManagerPtr()->IsXenonFlashSupported() ) |
|
5257 { |
|
5258 // Reset the flash error status |
|
5259 iController.FlashStatus()->SetFlashError( EFalse ); |
|
5260 } |
|
5261 /*#ifndef __WINS__ |
|
5262 if ( iSendFileInCall ) |
|
5263 { |
|
5264 // bring phone app to fore ground |
|
5265 BringPhoneAppToForeGroundL(); |
|
5266 } |
|
5267 #endif // __WINS__ */ |
|
5268 } |
|
5269 |
|
5270 if ( iView && ( iStillCaptureView == iView || iVideoCaptureView == iView ) |
|
5271 && ShowPostCaptureView() ) |
|
5272 { |
|
5273 SetAssumePostCaptureView( EFalse ); |
|
5274 } |
|
5275 |
|
5276 if( iController.IsViewFinding() ) |
|
5277 { |
|
5278 iController.StopViewFinder(); |
|
5279 iViewFinderStopped = ETrue; |
|
5280 } |
|
5281 |
|
5282 PRINT( _L("Camera <= CCamAppUi::InternalExitL") ); |
|
5283 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP_CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 0" ); |
|
5284 |
|
5285 } |
|
5286 |
|
5287 // --------------------------------------------------------- |
|
5288 // CCamAppUi::CallSwitch |
|
5289 // Switch view |
|
5290 // --------------------------------------------------------- |
|
5291 // |
|
5292 TInt CCamAppUi::CallSwitch( TAny* aAny ) |
|
5293 { |
|
5294 CCamAppUi* appui = static_cast<CCamAppUi*>( aAny ); |
|
5295 __ASSERT_DEBUG( appui != NULL, CamPanic( ECamPanicNullPointer ) ); |
|
5296 appui->iWaitTimer->Cancel(); |
|
5297 TRAP_IGNORE( appui->TrySwitchViewL() ); |
|
5298 return KErrNone; |
|
5299 } |
|
5300 |
|
5301 |
|
5302 // --------------------------------------------------------- |
|
5303 // CCamAppUi::AppInBackground |
|
5304 // Whether or not the app is in the background |
|
5305 // --------------------------------------------------------- |
|
5306 // |
|
5307 TBool CCamAppUi::AppInBackground( TBool aIncludeNotifier ) const |
|
5308 { |
|
5309 PRINT1( _L("Camera => CCamAppUi::AppInBackground( %d )" ), aIncludeNotifier ); |
|
5310 TBool aBackground = EFalse; |
|
5311 // Gets the window group id of the app coming in foreground |
|
5312 TInt windowGroupId = iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
5313 |
|
5314 PRINT1( _L("Camera CCamAppUi::AppInBackground windowGroupId=%d" ), windowGroupId ); |
|
5315 |
|
5316 // Check if the window group moving to the front is the AknCapServer. |
|
5317 // This often happens when OOM or out of disk space notes are shown |
|
5318 TBool capServerGroup = CamUtility::IdMatchesName( windowGroupId, KAknCapServer ); |
|
5319 |
|
5320 // AknNotifyServer notifies e.g. Location related events. |
|
5321 TBool nfyServerGroup = CamUtility::IdMatchesName( windowGroupId, KAknNotifyServer ); |
|
5322 |
|
5323 // KPbkSever - Contacts App; Assign to contacts scenario |
|
5324 TBool pbkServerGroup = CamUtility::IdMatchesName( windowGroupId, KPbkServer ); |
|
5325 PRINT1( _L("Camera CCamAppUi::AppInBackground iMyWgId=%d" ), iMyWgId ); |
|
5326 // if the foreground app is not this app |
|
5327 if ( windowGroupId != iMyWgId ) |
|
5328 { |
|
5329 // if another app has the foreground |
|
5330 if ( !capServerGroup |
|
5331 && !nfyServerGroup |
|
5332 && !pbkServerGroup |
|
5333 && windowGroupId != iEikonServerWindowGroupId |
|
5334 && windowGroupId != iBTServerWindowGroupId |
|
5335 ) |
|
5336 { |
|
5337 PRINT(_L("Camera CCamAppUi::AppInBackground non-AKN, non-EIK serv has focus")); |
|
5338 aBackground = ETrue; |
|
5339 } |
|
5340 // if the eikon server has the foreground and we're classing that as |
|
5341 // putting us in the background |
|
5342 else if ( aIncludeNotifier ) |
|
5343 { |
|
5344 // Check whether the new foreground window is an Eikon window |
|
5345 if ( windowGroupId == iEikonServerWindowGroupId ) |
|
5346 { |
|
5347 PRINT(_L("Camera <> CCamAppUi::AppInBackground EIK SERV HAS FOCUS")); |
|
5348 aBackground = ETrue; |
|
5349 } |
|
5350 // Check if AknCapServer is in the foreground (includes other notes) |
|
5351 else if ( capServerGroup ) |
|
5352 { |
|
5353 PRINT(_L("Camera <> CCamAppUi::AppInBackground CAP SERV HAS FOCUS")); |
|
5354 aBackground = ETrue; |
|
5355 } |
|
5356 else if( nfyServerGroup ) |
|
5357 { |
|
5358 PRINT(_L("Camera <> CCamAppUi::AppInBackground Avkon notify server has focus")); |
|
5359 aBackground = ETrue; |
|
5360 } |
|
5361 else if ( windowGroupId == iBTServerWindowGroupId ) |
|
5362 { |
|
5363 PRINT(_L("Camera <> CCamAppUi::AppInBackground BT SERV HAS FOCUS")); |
|
5364 aBackground = ETrue; |
|
5365 } |
|
5366 else // empty statement for lint |
|
5367 { |
|
5368 } |
|
5369 } |
|
5370 else // empty statement for lint |
|
5371 { |
|
5372 } |
|
5373 } |
|
5374 PRINT1( _L("Camera <= CCamAppUi::AppInBackground return(%d)" ), aBackground ); |
|
5375 return aBackground; |
|
5376 } |
|
5377 |
|
5378 |
|
5379 // --------------------------------------------------------- |
|
5380 // CCamAppUi::LaunchHelpL |
|
5381 // Launch the context sensitive help application |
|
5382 // --------------------------------------------------------- |
|
5383 // |
|
5384 void CCamAppUi::LaunchHelpL() |
|
5385 { |
|
5386 PRINT( _L("Camera => CCamAppUi::LaunchHelpL") ); |
|
5387 TCoeHelpContext helpContext; |
|
5388 helpContext.iMajor = TUid::Uid( KCameraappUID ); |
|
5389 |
|
5390 // Check which view is active to obtain the help context |
|
5391 TVwsViewId currentViewId; |
|
5392 TInt err = GetActiveViewId( currentViewId ); |
|
5393 if ( err == KErrNone ) |
|
5394 { |
|
5395 switch ( currentViewId.iViewUid.iUid ) |
|
5396 { |
|
5397 case ECamViewIdStillPreCapture: |
|
5398 // Still precapture can have multiple modes. We must ask it |
|
5399 // for the current context. |
|
5400 iStillCaptureView->GetHelpContext( helpContext ); |
|
5401 break; |
|
5402 case ECamViewIdStillPostCapture: |
|
5403 helpContext.iContext = KLCAM_HLP_POST_PHOTO; |
|
5404 break; |
|
5405 case ECamViewIdVideoPreCapture: |
|
5406 // Video precapture can have multiple modes. We must ask it |
|
5407 // for the current context. |
|
5408 iVideoCaptureView->GetHelpContext( helpContext ); |
|
5409 break; |
|
5410 case ECamViewIdVideoPostCapture: |
|
5411 helpContext.iContext = KLCAM_HLP_POST_VIDEO; |
|
5412 break; |
|
5413 case ECamViewIdBurstThumbnail: |
|
5414 helpContext.iContext = KLCAM_HLP_POST_SEQ; |
|
5415 break; |
|
5416 case ECamViewIdVideoSettings: |
|
5417 helpContext.iContext = KLCAM_HLP_SETTINGS_VIDEO; |
|
5418 break; |
|
5419 case ECamViewIdPhotoSettings: |
|
5420 helpContext.iContext = KLCAM_HLP_SETTINGS_PHOTO; |
|
5421 break; |
|
5422 case ECamViewIdPhotoUserSceneSetup: |
|
5423 helpContext.iContext = KLCAM_HLP_SETTINGS_PHOUSER; |
|
5424 break; |
|
5425 default: |
|
5426 break; |
|
5427 } |
|
5428 } |
|
5429 else if ( err == KErrNotFound && iPreCaptureMode == ECamPreCapStandby ) |
|
5430 { |
|
5431 // This is a work-around for the problem of GetActiveViewId() |
|
5432 // returning -1 when in the Standby view. |
|
5433 if ( IsEmbedded() ) |
|
5434 { |
|
5435 helpContext.iContext = KLCAM_HLP_STANDYBY_EM; |
|
5436 } |
|
5437 else |
|
5438 { |
|
5439 helpContext.iContext = KLCAM_HLP_STANDYBY_EM; |
|
5440 } |
|
5441 } |
|
5442 else |
|
5443 { |
|
5444 User::Leave( err ); |
|
5445 } |
|
5446 |
|
5447 PRINT1( _L("Camera <> CCamAppUi::LaunchHelpL, help context: %S"), &(helpContext.iContext) ); |
|
5448 |
|
5449 // Create the context array and append the single context item |
|
5450 CArrayFix<TCoeHelpContext>* contextArray = |
|
5451 new ( ELeave ) CArrayFixFlat<TCoeHelpContext> ( 1 ); |
|
5452 |
|
5453 CleanupStack::PushL( contextArray ); |
|
5454 contextArray->AppendL( helpContext ); |
|
5455 CleanupStack::Pop( contextArray ); |
|
5456 |
|
5457 //Launch help - takes ownership of context array |
|
5458 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
5459 contextArray ); |
|
5460 |
|
5461 PRINT( _L("Camera <= CCamAppUi::LaunchHelpL") ); |
|
5462 } |
|
5463 |
|
5464 #ifndef __WINS__ |
|
5465 // --------------------------------------------------------- |
|
5466 // CCamAppUi::ProcessCommandParametersL |
|
5467 // Allow Camera application to respond to request for in-call send |
|
5468 // functionality from Phone application |
|
5469 // --------------------------------------------------------- |
|
5470 // |
|
5471 TBool CCamAppUi::ProcessCommandParametersL( |
|
5472 TApaCommand aCommand, |
|
5473 TFileName& aDocumentName, |
|
5474 const TDesC8& /*aTail*/ ) |
|
5475 { |
|
5476 PRINT( _L("CCamAppUi::ProcessCommandParametersL") ); |
|
5477 // Check if we should start in SFI mode |
|
5478 /* if ( aCommand == EApaCommandOpen && aDocumentName == KSFITrailing ) |
|
5479 { |
|
5480 if ( !SFIUtility() ) |
|
5481 { |
|
5482 PRINT( _L("CCamAppUi::ProcessCommandParametersL !!") ); |
|
5483 return EFalse; |
|
5484 } |
|
5485 SFIUtility()->IsCLIValidL(); |
|
5486 |
|
5487 iSendFileInCall = ETrue; |
|
5488 PRINT( _L("CCamAppUi::ProcessCommandParametersL iSendFileInCall = ETrue") ); |
|
5489 // Make sure that the static settings are loaded |
|
5490 iController.LoadStaticSettingsL( ETrue ); |
|
5491 }*/ |
|
5492 return EFalse; |
|
5493 } |
|
5494 |
|
5495 // --------------------------------------------------------- |
|
5496 // CCamAppUi::HandleMessageL |
|
5497 // Bring Camera app to foreground in response to request for in-call send |
|
5498 // --------------------------------------------------------- |
|
5499 // |
|
5500 MCoeMessageObserver::TMessageResponse CCamAppUi::HandleMessageL( |
|
5501 TUint32 aClientHandleOfTargetWindowGroup, |
|
5502 TUid aMessageUid, |
|
5503 const TDesC8& aMessageParameters ) |
|
5504 { |
|
5505 PRINT( _L("CCamAppUi::HandleMessageL") ); |
|
5506 // Go to SFI mode at run-time if requested by SFIUtils |
|
5507 // using a window server message. |
|
5508 if ( aMessageUid.iUid == 0 && aMessageParameters.Length() > 0 ) |
|
5509 { |
|
5510 TInt lengthInCharacters = |
|
5511 ( aMessageParameters.Length() * sizeof( TUint8 ) ) / |
|
5512 sizeof( TUint16 ); |
|
5513 TPtrC message( |
|
5514 reinterpret_cast<const TUint16*>( aMessageParameters.Ptr() ), |
|
5515 lengthInCharacters ); |
|
5516 |
|
5517 /*if ( message == KSFITrailing ) |
|
5518 { |
|
5519 if ( !SFIUtility() ) |
|
5520 { |
|
5521 // Jump to foreground anyway, even if SFI mode cannot |
|
5522 // be activated. |
|
5523 iEikonEnv->RootWin().SetOrdinalPosition( 0, 0 ); |
|
5524 return CAknAppUi::HandleMessageL( |
|
5525 aClientHandleOfTargetWindowGroup, |
|
5526 aMessageUid, |
|
5527 aMessageParameters ); |
|
5528 } |
|
5529 |
|
5530 SFIUtility()->IsCLIValidL(); |
|
5531 |
|
5532 iSendFileInCall = ETrue; |
|
5533 PRINT( _L("CCamAppUi::HandleMessageL iSendFileInCall = ETrue") ); |
|
5534 |
|
5535 // Jump to foreground |
|
5536 iEikonEnv->RootWin().SetOrdinalPosition( 0, 0 ); |
|
5537 |
|
5538 // load embedded static settings |
|
5539 iController.LoadStaticSettingsL( ETrue ); |
|
5540 }*/ |
|
5541 } |
|
5542 return CAknAppUi::HandleMessageL( aClientHandleOfTargetWindowGroup, |
|
5543 aMessageUid, aMessageParameters); |
|
5544 } |
|
5545 |
|
5546 #endif // HANDLE_TRANSITIONAL_UI |
|
5547 |
|
5548 // --------------------------------------------------------- |
|
5549 // CCamAppUi::SidePane |
|
5550 // Return reference to side-pane object |
|
5551 // --------------------------------------------------------- |
|
5552 // |
|
5553 CCamSidePane* CCamAppUi::SidePane() |
|
5554 { |
|
5555 return iCamSidePane; |
|
5556 } |
|
5557 |
|
5558 // --------------------------------------------------------- |
|
5559 // CCamAppUi::ZoomPane |
|
5560 // Return reference to zoom-pane object |
|
5561 // --------------------------------------------------------- |
|
5562 // |
|
5563 CCamZoomPane* CCamAppUi::ZoomPane() |
|
5564 { |
|
5565 return iCamZoomPane; |
|
5566 } |
|
5567 |
|
5568 // --------------------------------------------------------- |
|
5569 // CCamAppUi::CurrentViewState |
|
5570 // Return current view state |
|
5571 // --------------------------------------------------------- |
|
5572 // |
|
5573 TCamViewState CCamAppUi::CurrentViewState() const |
|
5574 { |
|
5575 return iViewState; |
|
5576 } |
|
5577 |
|
5578 // --------------------------------------------------------- |
|
5579 // CCamAppUi::TargetViewState |
|
5580 // Returns target view state |
|
5581 // --------------------------------------------------------- |
|
5582 // |
|
5583 TCamViewState CCamAppUi::TargetViewState() |
|
5584 { |
|
5585 return iTargetViewState; |
|
5586 } |
|
5587 |
|
5588 // --------------------------------------------------------- |
|
5589 // CCamAppUi::TargetMode |
|
5590 // --------------------------------------------------------- |
|
5591 // |
|
5592 TCamCameraMode CCamAppUi::TargetMode() const |
|
5593 { |
|
5594 return iTargetMode; |
|
5595 } |
|
5596 |
|
5597 // --------------------------------------------------------- |
|
5598 // CCamAppUi::HandleShutterKeyL |
|
5599 // Handles the shutter key press |
|
5600 // --------------------------------------------------------- |
|
5601 // |
|
5602 void CCamAppUi::HandleShutterKeyL( TBool aPressed ) |
|
5603 { |
|
5604 // only handle the shutter key if the app is |
|
5605 // in the foreground and view finder is active |
|
5606 if ( !AppInBackground( ETrue ) ) |
|
5607 { |
|
5608 RArray<TInt> captureKeys; |
|
5609 CleanupClosePushL( captureKeys ); |
|
5610 |
|
5611 if ( iController.UiConfigManagerPtr() ) |
|
5612 { |
|
5613 iController.UiConfigManagerPtr()-> |
|
5614 SupportedPrimaryCameraCaptureKeyL( captureKeys ); |
|
5615 if ( captureKeys.Count() <= 0 ) |
|
5616 { |
|
5617 User::Leave( KErrNotSupported ); |
|
5618 } |
|
5619 } |
|
5620 TKeyEvent keyEvent; |
|
5621 keyEvent.iScanCode = captureKeys[0];//EProductKeyCapture |
|
5622 keyEvent.iModifiers = 0; |
|
5623 keyEvent.iRepeats = 0; |
|
5624 |
|
5625 CleanupStack::PopAndDestroy( &captureKeys ); |
|
5626 |
|
5627 // check we have a currently active view |
|
5628 if( iView ) |
|
5629 { |
|
5630 CCoeControl* container = static_cast<CCamViewBase*>( iView )->Container(); |
|
5631 if ( container ) |
|
5632 { |
|
5633 if ( aPressed ) |
|
5634 { |
|
5635 container->OfferKeyEventL( keyEvent, EEventKeyDown ); |
|
5636 } |
|
5637 else |
|
5638 { |
|
5639 container->OfferKeyEventL( keyEvent, EEventKeyUp ); |
|
5640 } |
|
5641 } |
|
5642 } |
|
5643 } |
|
5644 } |
|
5645 |
|
5646 |
|
5647 // --------------------------------------------------------------------------- |
|
5648 // CCamAppUi::HandleVolumeKeyEvent |
|
5649 // |
|
5650 // --------------------------------------------------------------------------- |
|
5651 // |
|
5652 void CCamAppUi::HandleVolumeKeyEvent( TRemConCoreApiOperationId aOperationId, |
|
5653 TRemConCoreApiButtonAction aButtonAct ) |
|
5654 { |
|
5655 PRINT2( _L("Camera => CCamAppUi::HandleVolumeKeyEvent op (%d) act (%d)"), aOperationId, aButtonAct ) |
|
5656 |
|
5657 if ( !iZoomUsingVolumeKeys ) |
|
5658 { |
|
5659 PRINT( _L("Camera <= CCamAppUi::HandleVolumeKeyEvent NOT zooming with volume keys") ) |
|
5660 return; |
|
5661 } |
|
5662 // only handle the shutter key if the app is |
|
5663 // in the foreground and view finder is active |
|
5664 if ( !AppInBackground( ETrue ) ) |
|
5665 { |
|
5666 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent yes")) |
|
5667 // check we have a currently active view |
|
5668 if( iView && ( iCamOrientation == ECamOrientationCamcorder |
|
5669 || iCamOrientation == ECamOrientationCamcorderLeft) && |
|
5670 ECamViewStatePreCapture == iViewState ) // Zoom only needed in precap |
|
5671 { |
|
5672 CCoeControl* container = static_cast<CCamViewBase*>( iView )->Container(); |
|
5673 if ( container ) |
|
5674 { |
|
5675 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent cont")) |
|
5676 TKeyEvent keyEvent; |
|
5677 keyEvent.iModifiers = 0; |
|
5678 keyEvent.iRepeats = 0; |
|
5679 |
|
5680 // map up/down to appropriate zoom key |
|
5681 if( aOperationId == ERemConCoreApiVolumeUp ) |
|
5682 { |
|
5683 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent up")) |
|
5684 keyEvent.iScanCode = EStdKeyIncVolume; |
|
5685 } |
|
5686 else if( aOperationId == ERemConCoreApiVolumeDown ) |
|
5687 { |
|
5688 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent down")) |
|
5689 keyEvent.iScanCode = EStdKeyDecVolume; |
|
5690 } |
|
5691 else |
|
5692 { |
|
5693 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent ??")) |
|
5694 } |
|
5695 // map event type |
|
5696 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
5697 { |
|
5698 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent press")) |
|
5699 TRAP_IGNORE( container->OfferKeyEventL( keyEvent, EEventKeyDown ) ); |
|
5700 } |
|
5701 else if( aButtonAct == ERemConCoreApiButtonRelease ) |
|
5702 { |
|
5703 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent release")) |
|
5704 TRAP_IGNORE( container->OfferKeyEventL( keyEvent, EEventKeyUp ) ); |
|
5705 } |
|
5706 else if( aButtonAct == ERemConCoreApiButtonClick ) |
|
5707 { |
|
5708 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent click")) |
|
5709 TRAP_IGNORE( container->OfferKeyEventL( keyEvent, EEventUser ) ); |
|
5710 } |
|
5711 else |
|
5712 { |
|
5713 PRINT( _L("Camera <> CCamAppUi::HandleVolumeKeyEvent unhandled volume keypress")) |
|
5714 } |
|
5715 } |
|
5716 } |
|
5717 } |
|
5718 PRINT( _L("Camera <= CCamAppUi::HandleVolumeKeyEvent")) |
|
5719 } |
|
5720 |
|
5721 |
|
5722 // --------------------------------------------------------- |
|
5723 // CCamAppUi::SetEmbedding |
|
5724 // Sets embedding flag |
|
5725 // --------------------------------------------------------- |
|
5726 // |
|
5727 void CCamAppUi::SetEmbedding( TBool aEmbedding ) |
|
5728 { |
|
5729 PRINT1( _L("Camera => CCamAppUi::SetEmbedding %d"), aEmbedding ) |
|
5730 iEmbedding = aEmbedding; |
|
5731 PRINT( _L("Camera <= CCamAppUi::SetEmbedding") ) |
|
5732 } |
|
5733 |
|
5734 // --------------------------------------------------------- |
|
5735 // CCamAppUi::Embedding |
|
5736 // Returns embedding flag |
|
5737 // --------------------------------------------------------- |
|
5738 // |
|
5739 TBool CCamAppUi::Embedding() const |
|
5740 { |
|
5741 PRINT1( _L("Camera => CCamAppUi::Embedding %d"), iEmbedding ) |
|
5742 PRINT( _L("Camera <= CCamAppUi::Embedding") ) |
|
5743 return iEmbedding; |
|
5744 } |
|
5745 |
|
5746 // --------------------------------------------------------- |
|
5747 // CCamAppUi::SetSendAsInProgressL |
|
5748 // Sets the SendAs flag |
|
5749 // --------------------------------------------------------- |
|
5750 // |
|
5751 void CCamAppUi::SetSendAsInProgressL( TBool aSendAsInProgress ) |
|
5752 { |
|
5753 PRINT1( _L("Camera => CCamAppUi::SetSendAsInProgressL %d"), aSendAsInProgress ); |
|
5754 // Check before updating embedding status. |
|
5755 TBool exitStatus = iController.CheckExitStatus(); |
|
5756 |
|
5757 iSendAsInProgress = aSendAsInProgress; |
|
5758 SetEmbedding( aSendAsInProgress ); |
|
5759 |
|
5760 if ( !iSendAsInProgress ) |
|
5761 { |
|
5762 PRINT( _L("Camera <> CCamAppUi::SetSendAsInProgressL - checking exit status..") ); |
|
5763 // Exit not wanted when embedding / embedded |
|
5764 // Check if camera switch is required. |
|
5765 if ( exitStatus ) |
|
5766 { |
|
5767 InternalExitL(); |
|
5768 } |
|
5769 else if ( iPendingViewSwitch != EPendingViewSwitchNone ) |
|
5770 { |
|
5771 iPendingViewSwitch = EPendingViewSwitchNone; |
|
5772 iWaitTimer->Start( 0, 0, TCallBack( CallSwitch, this ) ); |
|
5773 } |
|
5774 else |
|
5775 { |
|
5776 // Do nothing |
|
5777 } |
|
5778 } |
|
5779 PRINT( _L("Camera <= CCamAppUi::SetSendAsInProgressL") ); |
|
5780 } |
|
5781 |
|
5782 // --------------------------------------------------------- |
|
5783 // CCamAppUi::SendAsInProgressL |
|
5784 // Get the SendAs flag value |
|
5785 // --------------------------------------------------------- |
|
5786 // |
|
5787 TBool CCamAppUi::SendAsInProgress() const |
|
5788 { |
|
5789 return iSendAsInProgress; |
|
5790 } |
|
5791 |
|
5792 |
|
5793 // --------------------------------------------------------- |
|
5794 // CCamAppUi::IsMMCRemoveNotePending |
|
5795 // Return whether an MMC removal note is pending |
|
5796 // --------------------------------------------------------- |
|
5797 // |
|
5798 TBool CCamAppUi::IsMMCRemovedNotePending() const |
|
5799 { |
|
5800 if ( iMMCRemoveNoteRequired || iMMCRemoveNoteRequiredOnCapture ) |
|
5801 { |
|
5802 return ETrue; |
|
5803 } |
|
5804 else |
|
5805 { |
|
5806 return EFalse; |
|
5807 } |
|
5808 } |
|
5809 |
|
5810 // --------------------------------------------------------- |
|
5811 // CCamAppUi::HandleCameraErrorL |
|
5812 // Display an error note |
|
5813 // --------------------------------------------------------- |
|
5814 // |
|
5815 void CCamAppUi::HandleCameraErrorL( TInt aError ) |
|
5816 { |
|
5817 if( aError == KErrNoMemory ) |
|
5818 { |
|
5819 PRINT( _L( "Camera => CCamAppUi::HandleCameraErrorL KErrNoMemory" ) ); |
|
5820 HBufC* text = StringLoader::LoadLC( R_CAM_MEMLO_NOT_ENOUGH_MEMORY ); |
|
5821 // Display an error note |
|
5822 CAknErrorNote* dlg = new (ELeave) CAknErrorNote( ETrue ); |
|
5823 dlg->ExecuteLD( *text ); |
|
5824 |
|
5825 CleanupStack::PopAndDestroy( text ); |
|
5826 } |
|
5827 else if ( aError ) |
|
5828 { |
|
5829 PRINT1( _L( "Camera => CCamAppUi::HandleCameraErrorL (%d)" ), aError ); |
|
5830 |
|
5831 // Resolve the error text with no context or separator |
|
5832 TPtrC buf; |
|
5833 buf.Set( iTextResolver->ResolveErrorString( aError, CTextResolver::ECtxNoCtxNoSeparator ) ); |
|
5834 |
|
5835 // Display an error note |
|
5836 CAknErrorNote* dlg = new (ELeave) CAknErrorNote( ETrue ); |
|
5837 dlg->ExecuteLD( buf ); |
|
5838 |
|
5839 PRINT( _L( "Camera <= CCamAppUi::HandleCameraErrorL" ) ); |
|
5840 } |
|
5841 else |
|
5842 { |
|
5843 } |
|
5844 } |
|
5845 |
|
5846 // --------------------------------------------------------- |
|
5847 // CCamAppUi::TextResolver |
|
5848 // Offers a reference to appui's TextResolver instance |
|
5849 // --------------------------------------------------------- |
|
5850 // |
|
5851 CTextResolver* CCamAppUi::TextResolver() |
|
5852 { |
|
5853 return iTextResolver; |
|
5854 } |
|
5855 |
|
5856 |
|
5857 #ifndef __WINS__ |
|
5858 // --------------------------------------------------------- |
|
5859 // CCamAppUi::SFIUtility |
|
5860 // Return pointer to in-call send utility object |
|
5861 // --------------------------------------------------------- |
|
5862 // |
|
5863 /*CSFIUtilsAppInterface* CCamAppUi::SFIUtility() const |
|
5864 { |
|
5865 return iSFIUtils; |
|
5866 }*/ |
|
5867 |
|
5868 // --------------------------------------------------------- |
|
5869 // CCamAppUi::IsInCallSend |
|
5870 // Return whether in in-call send mode |
|
5871 // --------------------------------------------------------- |
|
5872 // |
|
5873 /*TBool CCamAppUi::IsInCallSend() const |
|
5874 { |
|
5875 return iSendFileInCall; |
|
5876 }*/ |
|
5877 |
|
5878 // --------------------------------------------------------------------------- |
|
5879 // CCamAppUi::DoInCallSendL |
|
5880 // Handle send to caller functionality |
|
5881 // --------------------------------------------------------------------------- |
|
5882 // |
|
5883 /*void CCamAppUi::DoInCallSendL() const |
|
5884 { |
|
5885 PRINT( _L("CCamAppUi::DoInCallSendL in") ); |
|
5886 if ( iSFIUtils && iSFIUtils->IsCLIValidL() ) |
|
5887 { |
|
5888 PRINT( _L("CCamAppUi::DoInCallSendL send") ); |
|
5889 iSFIUtils->SendMediaFileL( iController.CurrentFullFileName() ); |
|
5890 } |
|
5891 PRINT( _L("CCamAppUi::DoInCallSendL out") ); |
|
5892 } */ |
|
5893 |
|
5894 // --------------------------------------------------------------------------- |
|
5895 // CCamAppUi::BringPhoneAppToForeGroundL |
|
5896 // Bring phone application to foreground |
|
5897 // --------------------------------------------------------------------------- |
|
5898 // |
|
5899 void CCamAppUi::BringPhoneAppToForeGroundL() |
|
5900 { |
|
5901 PRINT( _L("CCamAppUi::BringPhoneAppToForeGroundL") ); |
|
5902 TApaTaskList apaTaskList( CCoeEnv::Static()->WsSession() ); |
|
5903 TApaTask apaTask = apaTaskList.FindApp( KPhoneAppUid ); |
|
5904 if ( apaTask.Exists() ) |
|
5905 { |
|
5906 apaTask.BringToForeground(); |
|
5907 } |
|
5908 |
|
5909 // load non-embedded static settings |
|
5910 iController.LoadStaticSettingsL( EFalse ); |
|
5911 // no longer in SFI state |
|
5912 // iSendFileInCall = EFalse; |
|
5913 |
|
5914 // set us back to pre-capture |
|
5915 iTargetViewState = ECamViewStatePreCapture; |
|
5916 // when camera is used again, TrySwitchViewL() will be called |
|
5917 iPendingViewSwitch = EPendingViewSwitchDeactivateFirst; |
|
5918 |
|
5919 PRINT( _L("CCamAppUi::BringPhoneAppToForeGroundL iSendFileInCall = EFalse") ); |
|
5920 } |
|
5921 |
|
5922 #endif |
|
5923 |
|
5924 // --------------------------------------------------------- |
|
5925 // CCamAppUi::IsInPretendExit |
|
5926 // Indicates whether or not the application is in a simulated exit situation |
|
5927 // --------------------------------------------------------- |
|
5928 // |
|
5929 TBool CCamAppUi::IsInPretendExit() const |
|
5930 { |
|
5931 return iPretendExit; |
|
5932 } |
|
5933 |
|
5934 // --------------------------------------------------------------------------- |
|
5935 // CCamAppUi::SendCameraAppToBackgroundL |
|
5936 // Sends the camera application to the background, to pretend we're closing |
|
5937 // --------------------------------------------------------------------------- |
|
5938 // |
|
5939 void CCamAppUi::SendCameraAppToBackgroundL() |
|
5940 { |
|
5941 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_SENDCAMERAAPPTOBACKGROUNDL, "e_CCamAppUi_SendCameraAppToBackgroundL 1" ); |
|
5942 |
|
5943 PRINT( _L("Camera => CCamAppUi::SendCameraAppToBackgroundL") ); |
|
5944 // Pretend we're closing, so reset the dynamic settings. |
|
5945 iController.SetDynamicSettingsToDefaults(); |
|
5946 |
|
5947 // stop listening mmc dismount notifications |
|
5948 iController.CancelDismountMonitoring(); |
|
5949 |
|
5950 // Switch sequence capture off if the app is going to pretend to close |
|
5951 if ( IsBurstEnabled() ) |
|
5952 { |
|
5953 PRINT( _L("CCamAppUi::SendCameraAppToBackgroundL calling ToggleMulti") ); |
|
5954 SwitchStillCaptureModeL( ECamImageCaptureSingle, EFalse ); |
|
5955 } |
|
5956 |
|
5957 // Send the task with the given WgId to the background |
|
5958 CAknSgcClient::MoveApp( iMyWgId, ESgcMoveAppToBackground ); |
|
5959 |
|
5960 // Hide from task list/FSW and send to background |
|
5961 HideTaskL( ETrue ); |
|
5962 iPretendExit = ETrue; |
|
5963 iFirstVFStart = ETrue; |
|
5964 |
|
5965 PRINT( _L("Camera <= CCamAppUi::SendCameraAppToBackgroundL") ); |
|
5966 OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMAPPUI_SENDCAMERAAPPTOBACKGROUNDL, "e_CCamAppUi_SendCameraAppToBackgroundL 0" ); |
|
5967 |
|
5968 } |
|
5969 |
|
5970 // --------------------------------------------------------------------------- |
|
5971 // CCamAppUi::HideTaskL |
|
5972 // Hides or shows the Camera app task in the tasklist |
|
5973 // --------------------------------------------------------------------------- |
|
5974 // |
|
5975 void CCamAppUi::HideTaskL(TBool aHide) |
|
5976 { |
|
5977 // HideApplicationFromFSW also hides running status from menu grid |
|
5978 HideApplicationFromFSW( aHide ); |
|
5979 |
|
5980 // The following ensures that the task is hidden even if an embedded camera app is also running |
|
5981 RWsSession session = iEikonEnv->WsSession(); |
|
5982 CApaWindowGroupName* wgName = CApaWindowGroupName::NewL( session, iMyWgId ); |
|
5983 wgName->SetHidden( aHide ); |
|
5984 wgName->SetWindowGroupName( iEikonEnv->RootWin() ); |
|
5985 delete wgName; |
|
5986 } |
|
5987 |
|
5988 // --------------------------------------------------------- |
|
5989 // CCamAppUi::StartAsServerAppL |
|
5990 // Start application as file server application |
|
5991 // --------------------------------------------------------- |
|
5992 // |
|
5993 void |
|
5994 CCamAppUi::StartAsServerAppL( MCamEmbeddedObserver* aEmbeddedObserver, |
|
5995 TInt aMode ) |
|
5996 { |
|
5997 PRINT( _L("Camera => CCamAppUi::StartAsServerAppL") ); |
|
5998 |
|
5999 __ASSERT_ALWAYS( aMode == ECamControllerVideo || aMode == ECamControllerImage, |
|
6000 CamPanic( ECamPanicNotSupported ) ); |
|
6001 |
|
6002 // Load Embedded Settings |
|
6003 iController.LoadStaticSettingsL( ETrue ); |
|
6004 iEmbeddedViewSet = ETrue; |
|
6005 iEmbeddedObserver = aEmbeddedObserver; |
|
6006 iTargetViewState = ECamViewStatePreCapture; |
|
6007 |
|
6008 |
|
6009 if ( aMode == ECamControllerVideo ) |
|
6010 { |
|
6011 iTargetMode = ECamControllerVideo; |
|
6012 } |
|
6013 else if ( aMode == ECamControllerImage ) |
|
6014 { |
|
6015 iTargetMode = ECamControllerImage; |
|
6016 } |
|
6017 |
|
6018 // Find the parent app's name: |
|
6019 |
|
6020 RWsSession ws = iEikonEnv->WsSession(); |
|
6021 |
|
6022 // Get a list of the names and IDs of the all the window groups |
|
6023 RArray<RWsSession::TWindowGroupChainInfo> windowList; |
|
6024 CleanupClosePushL(windowList); |
|
6025 |
|
6026 // Get a list of window group IDs |
|
6027 User::LeaveIfError(ws.WindowGroupList(&windowList)); |
|
6028 |
|
6029 // Find our window group ID |
|
6030 RThread thread; |
|
6031 TInt cameraWindowGroup = ws.FindWindowGroupIdentifier(0, thread.Id()); |
|
6032 thread.Close(); |
|
6033 |
|
6034 TInt parentID = 0; |
|
6035 TBool found = EFalse; |
|
6036 |
|
6037 // Find our window ID in the list, to look up the parent ID |
|
6038 for( TInt i = 0; !found && i < windowList.Count(); i++ ) |
|
6039 { |
|
6040 RWsSession::TWindowGroupChainInfo windowInfo = windowList[i]; |
|
6041 if ( windowInfo.iId == cameraWindowGroup ) |
|
6042 { |
|
6043 parentID = windowInfo.iParentId; |
|
6044 found = ETrue; |
|
6045 } |
|
6046 } |
|
6047 |
|
6048 CleanupStack::PopAndDestroy(&windowList); |
|
6049 |
|
6050 if ( found ) |
|
6051 { |
|
6052 TBuf<100> windowName; |
|
6053 ws.GetWindowGroupNameFromIdentifier( parentID, windowName ); |
|
6054 |
|
6055 // The format of windowName is: |
|
6056 // [number][zero-char][UID of app][zero-char][Title of window][zero-char] |
|
6057 // We want to discard everything up to the window title: |
|
6058 for ( TInt t = 0; t < 2; t++ ) |
|
6059 { |
|
6060 TInt zeroPos = windowName.Locate(0); |
|
6061 |
|
6062 if ( zeroPos != KErrNotFound |
|
6063 && zeroPos < windowName.Length() ) |
|
6064 { |
|
6065 windowName.Delete(0, zeroPos + 1); |
|
6066 } |
|
6067 } |
|
6068 |
|
6069 // And the final zero-char |
|
6070 if ( windowName.Length() > 0 ) |
|
6071 { |
|
6072 if ( windowName[windowName.Length() - 1] == 0 ) |
|
6073 { |
|
6074 windowName.Delete(windowName.Length() - 1, 1); |
|
6075 } |
|
6076 } |
|
6077 |
|
6078 if ( windowName.Length() > 0 ) |
|
6079 { |
|
6080 iParentAppName = HBufC::NewL(windowName.Length()); |
|
6081 iParentAppName->Des().Copy(windowName); |
|
6082 |
|
6083 SetTitleL(windowName); |
|
6084 } |
|
6085 else |
|
6086 { |
|
6087 // Something's wrong - act as if we haven't found it |
|
6088 found = EFalse; |
|
6089 } |
|
6090 } |
|
6091 |
|
6092 // We were unable to find the parent app's name, so fall back on our own app title |
|
6093 if( !found ) |
|
6094 { |
|
6095 iParentAppName = StringLoader::LoadL(R_CAM_GENERIC_TITLE_NAME); |
|
6096 } |
|
6097 |
|
6098 // make sure standby exits as this may not actually result in |
|
6099 // a view switch if the correct view is already activated |
|
6100 if( iView ) |
|
6101 { |
|
6102 iView->HandleCommandL( ECamCmdExitStandby ); |
|
6103 } |
|
6104 iViewState = ECamViewStatePreCapture; |
|
6105 iTargetViewState = ECamViewStatePreCapture; |
|
6106 TrySwitchViewL(); |
|
6107 |
|
6108 |
|
6109 PRINT( _L("Camera <= CCamAppUi::StartAsServerAppL") ); |
|
6110 } |
|
6111 |
|
6112 |
|
6113 // --------------------------------------------------------------------------- |
|
6114 // CCamAppUi::CamOrientation |
|
6115 // Returns the current orientation of the app |
|
6116 // --------------------------------------------------------------------------- |
|
6117 // |
|
6118 TCamOrientation CCamAppUi::CamOrientation() |
|
6119 { |
|
6120 return iCamOrientation; |
|
6121 } |
|
6122 |
|
6123 // --------------------------------------------------------------------------- |
|
6124 // CCamAppUi::SetCamOrientationToLandscape() |
|
6125 // Set the current orientation as landscape |
|
6126 // --------------------------------------------------------------------------- |
|
6127 // |
|
6128 void CCamAppUi::SetCamOrientationToLandscape() |
|
6129 { |
|
6130 iCamOrientation = (ECamHandLeft == iSoftkeyPosition ) |
|
6131 ? ECamOrientationCamcorderLeft |
|
6132 : ECamOrientationCamcorder; |
|
6133 } |
|
6134 |
|
6135 // --------------------------------------------------------------------------- |
|
6136 // CCamAppUi::AppUiOrientation |
|
6137 // Returns the AppUi orientation (e.g. Portrait or Landscape) for the given product-specific orientation |
|
6138 // --------------------------------------------------------------------------- |
|
6139 // |
|
6140 CAknAppUiBase::TAppUiOrientation CCamAppUi::AppUiOrientation(TCamOrientation aCamOrientation) |
|
6141 { |
|
6142 switch ( aCamOrientation ) |
|
6143 { |
|
6144 case ECamOrientationCamcorder: // fallthrough |
|
6145 case ECamOrientationCamcorderLeft: |
|
6146 { |
|
6147 return CAknAppUiBase::EAppUiOrientationLandscape; |
|
6148 } |
|
6149 case ECamOrientationViewMode: |
|
6150 { |
|
6151 return CAknAppUiBase::EAppUiOrientationLandscape; |
|
6152 } |
|
6153 case ECamOrientationPortrait: |
|
6154 { |
|
6155 return CAknAppUiBase::EAppUiOrientationPortrait; |
|
6156 } |
|
6157 default: |
|
6158 { |
|
6159 return CAknAppUiBase::EAppUiOrientationUnspecified; |
|
6160 } |
|
6161 } |
|
6162 } |
|
6163 |
|
6164 // --------------------------------------------------------------------------- |
|
6165 // CCamAppUi::LayoutStateToOrientation |
|
6166 // Returns the camera orientation based on the layout state set by the phone |
|
6167 // --------------------------------------------------------------------------- |
|
6168 // |
|
6169 TCamOrientation CCamAppUi::LayoutStateToOrientation( TInt aLayoutState ) |
|
6170 { |
|
6171 TCamOrientation orientation = ECamOrientationDefault; |
|
6172 |
|
6173 #ifdef __WINS__ |
|
6174 switch(aLayoutState) |
|
6175 { |
|
6176 // Emulator numbers |
|
6177 case 2: |
|
6178 orientation = ECamOrientationPortrait; |
|
6179 break; |
|
6180 case 6: |
|
6181 if( iSoftkeyPosition == ECamHandLeft ) |
|
6182 { |
|
6183 orientation = ECamOrientationCamcorderLeft; |
|
6184 } |
|
6185 else |
|
6186 { |
|
6187 orientation = ECamOrientationCamcorder; |
|
6188 } |
|
6189 break; |
|
6190 } |
|
6191 #else // !__WINS__ |
|
6192 switch(aLayoutState) |
|
6193 { |
|
6194 // Magic number alert! |
|
6195 // These numbers come from AknPriv.rss, where they are currently hardcoded |
|
6196 case 0: |
|
6197 orientation = ECamOrientationPortrait; |
|
6198 break; |
|
6199 case 1: |
|
6200 if( iSoftkeyPosition == ECamHandLeft ) |
|
6201 { |
|
6202 orientation = ECamOrientationCamcorderLeft; |
|
6203 } |
|
6204 else |
|
6205 { |
|
6206 orientation = ECamOrientationCamcorder; |
|
6207 } |
|
6208 break; |
|
6209 case 2: |
|
6210 orientation = ECamOrientationViewMode; |
|
6211 break; |
|
6212 case 3: |
|
6213 orientation = ECamOrientationPortrait; |
|
6214 break; |
|
6215 default: |
|
6216 orientation = ECamOrientationDefault; |
|
6217 break; |
|
6218 } |
|
6219 #endif // __WINS__ |
|
6220 |
|
6221 return orientation; |
|
6222 } |
|
6223 |
|
6224 |
|
6225 // --------------------------------------------------------------------------- |
|
6226 // CCamAppUi::ReadCurrentDeviceOrientation |
|
6227 // Returns the camera orientation based on the layout state set by the phone |
|
6228 // --------------------------------------------------------------------------- |
|
6229 // |
|
6230 TCamOrientation CCamAppUi::ReadCurrentDeviceOrientation() |
|
6231 { |
|
6232 PRINT( _L("Camera <> CCamAppUi::ReadCurrentDeviceOrientation") ) |
|
6233 return ECamOrientationDefault; |
|
6234 } |
|
6235 |
|
6236 // --------------------------------------------------------------------------- |
|
6237 // CCamAppUi::ActivePalette |
|
6238 // Return handle to Active Palette |
|
6239 // --------------------------------------------------------------------------- |
|
6240 // |
|
6241 MActivePalette2UI* CCamAppUi::ActivePalette() const |
|
6242 { |
|
6243 return iActivePaletteHandler->ActivePalette(); |
|
6244 } |
|
6245 |
|
6246 // --------------------------------------------------------------------------- |
|
6247 // CCamAppUi::APHandler |
|
6248 // Returns pointer to Active Palette handler |
|
6249 // --------------------------------------------------------------------------- |
|
6250 // |
|
6251 CCamActivePaletteHandler* CCamAppUi::APHandler() const |
|
6252 { |
|
6253 return iActivePaletteHandler; |
|
6254 } |
|
6255 |
|
6256 // --------------------------------------------------------------------------- |
|
6257 // CCamAppUi::DrawPreCaptureCourtesyUI |
|
6258 // Returns whether the optional precapture UI should be currently shown |
|
6259 // --------------------------------------------------------------------------- |
|
6260 // |
|
6261 TBool CCamAppUi::DrawPreCaptureCourtesyUI() const |
|
6262 { |
|
6263 if ( CourtesyUiApplies() ) |
|
6264 { |
|
6265 return iDrawPreCaptureCourtesyUI; |
|
6266 } |
|
6267 else |
|
6268 { |
|
6269 // Otherwise always draw the UI |
|
6270 return ETrue; |
|
6271 } |
|
6272 } |
|
6273 |
|
6274 // --------------------------------------------------------------------------- |
|
6275 // CCamAppUi::DrawPostCaptureCourtesyUI |
|
6276 // Returns whether the optional postcapture UI should be currently shown |
|
6277 // --------------------------------------------------------------------------- |
|
6278 // |
|
6279 TBool CCamAppUi::DrawPostCaptureCourtesyUI() const |
|
6280 { |
|
6281 if ( CourtesyUiApplies() ) |
|
6282 { |
|
6283 return iDrawPostCaptureCourtesyUI; |
|
6284 } |
|
6285 else |
|
6286 { |
|
6287 // Otherwise always draw the UI |
|
6288 return ETrue; |
|
6289 } |
|
6290 } |
|
6291 |
|
6292 // --------------------------------------------------------------------------- |
|
6293 // CCamAppUi::AlwaysDrawPreCaptureCourtesyUI |
|
6294 // Returns whether the optional precapture UI should always be shown |
|
6295 // --------------------------------------------------------------------------- |
|
6296 // |
|
6297 TBool CCamAppUi::AlwaysDrawPreCaptureCourtesyUI() const |
|
6298 { |
|
6299 return iAlwaysDrawPreCaptureCourtesyUI; |
|
6300 } |
|
6301 |
|
6302 // --------------------------------------------------------------------------- |
|
6303 // CCamAppUi::AlwaysDrawPostCaptureCourtesyUI |
|
6304 // Returns whether the optional postcapture UI should always be shown |
|
6305 // --------------------------------------------------------------------------- |
|
6306 // |
|
6307 TBool CCamAppUi::AlwaysDrawPostCaptureCourtesyUI() const |
|
6308 { |
|
6309 return iAlwaysDrawPostCaptureCourtesyUI; |
|
6310 } |
|
6311 |
|
6312 // --------------------------------------------------------------------------- |
|
6313 // CCamAppUi::SetAlwaysDrawPreCaptureCourtesyUI |
|
6314 // Set whether the optional precapture UI should always be shown |
|
6315 // --------------------------------------------------------------------------- |
|
6316 // |
|
6317 void CCamAppUi::SetAlwaysDrawPreCaptureCourtesyUI( TBool aNewSetting ) |
|
6318 { |
|
6319 iAlwaysDrawPreCaptureCourtesyUI = aNewSetting; |
|
6320 |
|
6321 if ( aNewSetting ) |
|
6322 { |
|
6323 RaisePreCaptureCourtesyUI(EFalse); |
|
6324 } |
|
6325 else |
|
6326 { |
|
6327 SubmergePreCaptureCourtesyUI(); |
|
6328 } |
|
6329 } |
|
6330 |
|
6331 // --------------------------------------------------------------------------- |
|
6332 // CCamAppUi::SetAlwaysDrawPostCaptureCourtesyUI |
|
6333 // Set whether the optional postcapture UI should always be shown |
|
6334 // --------------------------------------------------------------------------- |
|
6335 // |
|
6336 void CCamAppUi::SetAlwaysDrawPostCaptureCourtesyUI(TBool aNewSetting) |
|
6337 { |
|
6338 iAlwaysDrawPostCaptureCourtesyUI = aNewSetting; |
|
6339 |
|
6340 if ( aNewSetting ) |
|
6341 { |
|
6342 RaisePostCaptureCourtesyUI(); |
|
6343 } |
|
6344 else |
|
6345 { |
|
6346 SubmergePostCaptureCourtesyUI(); |
|
6347 } |
|
6348 } |
|
6349 |
|
6350 // --------------------------------------------------------------------------- |
|
6351 // CCamAppUi::CourtesyTimeout |
|
6352 // Called after 15 seconds of key inactivity |
|
6353 // --------------------------------------------------------------------------- |
|
6354 // |
|
6355 TInt CCamAppUi::CourtesyTimeout( TAny* aPtr ) |
|
6356 { |
|
6357 return static_cast<CCamAppUi*>( aPtr )->DoCourtesyTimeout(); |
|
6358 } |
|
6359 |
|
6360 // --------------------------------------------------------------------------- |
|
6361 // CCamAppUi::DoCourtesyTimeoutL |
|
6362 // Called after 15 seconds of key inactivity |
|
6363 // --------------------------------------------------------------------------- |
|
6364 // |
|
6365 TInt CCamAppUi::DoCourtesyTimeout() |
|
6366 { |
|
6367 if ( iCourtesyTimerInPreCapture ) |
|
6368 { |
|
6369 if ( iController.IsTouchScreenSupported() ) |
|
6370 { |
|
6371 CAknToolbar* toolbar = CurrentFixedToolbar(); |
|
6372 if ( toolbar ) |
|
6373 { |
|
6374 CAknToolbarExtension* toolbarextension = |
|
6375 toolbar->ToolbarExtension(); |
|
6376 if ( toolbarextension && toolbarextension->IsShown() ) |
|
6377 { |
|
6378 // Do not hide courtesy UI when toolbar extension is open |
|
6379 |
|
6380 return EFalse; |
|
6381 } |
|
6382 } |
|
6383 } |
|
6384 iDrawPreCaptureCourtesyUI = EFalse; |
|
6385 SubmergePreCaptureCourtesyUI(); |
|
6386 } |
|
6387 |
|
6388 iCourtesyTimer->Cancel(); |
|
6389 |
|
6390 return EFalse; |
|
6391 } |
|
6392 |
|
6393 // --------------------------------------------------------------------------- |
|
6394 // CCamAppUi::CheckCourtesyKeyEventL |
|
6395 // Check whether the current key event should raise the optional UI |
|
6396 // --------------------------------------------------------------------------- |
|
6397 // |
|
6398 TKeyResponse CCamAppUi::CheckCourtesyKeyEventL( |
|
6399 const TKeyEvent aKeyEvent, |
|
6400 TEventCode aType, |
|
6401 TBool aInPreCapture ) |
|
6402 { |
|
6403 PRINT(_L("Camera => CheckCourtesyKeyEventL")) |
|
6404 |
|
6405 TKeyResponse retVal = EKeyWasNotConsumed; |
|
6406 |
|
6407 if ( CourtesyUiApplies() ) |
|
6408 { |
|
6409 // Always reset the timer on any key event, if appropriate |
|
6410 if( ( ( aInPreCapture && !iAlwaysDrawPreCaptureCourtesyUI ) |
|
6411 || ( !aInPreCapture && !iAlwaysDrawPostCaptureCourtesyUI ) |
|
6412 ) |
|
6413 && |
|
6414 ( ( aInPreCapture && iDrawPreCaptureCourtesyUI ) |
|
6415 || (!aInPreCapture && iDrawPostCaptureCourtesyUI ) |
|
6416 ) |
|
6417 ) |
|
6418 { |
|
6419 iCourtesyTimer->Cancel(); |
|
6420 iCourtesyTimer->StartTimer(); |
|
6421 iCourtesyTimerInPreCapture = aInPreCapture; |
|
6422 } |
|
6423 // Here we check if the LSK key is pressed by using the scan code |
|
6424 // We do this, to show the active tool bar when LSK is pressed when |
|
6425 // the AP tool bar is hidden AND Pressing "RSK" shall have to return |
|
6426 // to PreCaptureView (Image/Video mode) |
|
6427 // LSK --> Left Softkey |
|
6428 // RSK --> Right Softkey |
|
6429 if ( aType == EEventKeyDown && |
|
6430 aKeyEvent.iScanCode == EStdKeyDevice0 ) |
|
6431 { |
|
6432 iLeftSoftKeyPressed = ETrue; |
|
6433 } |
|
6434 else |
|
6435 { |
|
6436 iLeftSoftKeyPressed = EFalse; |
|
6437 } |
|
6438 |
|
6439 if ( iController.UiConfigManagerPtr() && |
|
6440 !iController.UiConfigManagerPtr()->IsLocationSupported() ) |
|
6441 { |
|
6442 if ( aType == EEventKey && |
|
6443 aKeyEvent.iScanCode == EStdKeyNo ) |
|
6444 { |
|
6445 iEndKeyPressed = ETrue; |
|
6446 } |
|
6447 else |
|
6448 { |
|
6449 iEndKeyPressed = EFalse; |
|
6450 } |
|
6451 } |
|
6452 |
|
6453 const TCamCaptureOperation operation( iController.CurrentOperation() ); |
|
6454 if ( aType == EEventKey ) |
|
6455 { |
|
6456 if ( EStdKeyRightArrow == aKeyEvent.iScanCode && !iController.IsTouchScreenSupported() ) |
|
6457 { |
|
6458 if( aInPreCapture ) |
|
6459 { |
|
6460 // during sequence capturing, Navi-Right is inactive to affect CourtesyUI |
|
6461 if ( !( IsBurstEnabled() && ( ECamCapturing == operation || ECamCompleting == operation ) ) ) |
|
6462 { |
|
6463 iDrawPreCaptureCourtesyUI = EFalse; |
|
6464 if ( !IsSecondCameraEnabled() ) |
|
6465 { |
|
6466 SubmergePreCaptureCourtesyUI(); |
|
6467 } |
|
6468 else if ( !IsEmbedded() ) |
|
6469 { |
|
6470 SetActivePaletteVisibility( EFalse ); |
|
6471 if ( ECamControllerVideo == iMode ) |
|
6472 { |
|
6473 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD_TXT ); |
|
6474 } |
|
6475 else |
|
6476 { |
|
6477 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__CAPTURE_TXT ); |
|
6478 } |
|
6479 } |
|
6480 } |
|
6481 } |
|
6482 else |
|
6483 { |
|
6484 iDrawPostCaptureCourtesyUI = EFalse; |
|
6485 if ( !IsSecondCameraEnabled() ) |
|
6486 { |
|
6487 SubmergePostCaptureCourtesyUI(); |
|
6488 } |
|
6489 else |
|
6490 { |
|
6491 SetActivePaletteVisibility( EFalse ); |
|
6492 } |
|
6493 } |
|
6494 return EKeyWasConsumed; |
|
6495 } |
|
6496 |
|
6497 else if ( ( EStdKeyLeftArrow == aKeyEvent.iScanCode |
|
6498 || (!aInPreCapture && EStdKeyDevice3 == aKeyEvent.iScanCode && !IsToolBarVisible() ) ) |
|
6499 && !iController.IsTouchScreenSupported() ) |
|
6500 { |
|
6501 iRotatedKeyEvent = ETrue; |
|
6502 if( aInPreCapture ) |
|
6503 { |
|
6504 // during sequence capturing, Navi-Left is inactive to affect CourtesyUI |
|
6505 if ( !( IsBurstEnabled() && ( ECamCapturing == operation || ECamCompleting == operation ) ) ) |
|
6506 { |
|
6507 iDrawPreCaptureCourtesyUI = ETrue; |
|
6508 RaisePreCaptureCourtesyUI(EFalse); |
|
6509 |
|
6510 if ( /*IsSecondCameraEnabled() |
|
6511 &&*/ !IsEmbedded() ) |
|
6512 { |
|
6513 if ( ECamControllerVideo == iMode ) |
|
6514 { |
|
6515 IsSecondCameraEnabled()?SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD_SECONDARY ): |
|
6516 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__RECORD ); |
|
6517 } |
|
6518 else |
|
6519 { |
|
6520 IsSecondCameraEnabled()?SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__CAPTURE_SECONDARY ): |
|
6521 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_EXIT__CAPTURE ); |
|
6522 } |
|
6523 } |
|
6524 } |
|
6525 } |
|
6526 else |
|
6527 { |
|
6528 iDrawPostCaptureCourtesyUI = ETrue; |
|
6529 RaisePostCaptureCourtesyUI(); |
|
6530 } |
|
6531 return EKeyWasConsumed; |
|
6532 } |
|
6533 // Only check if the user has turned the UI off |
|
6534 if( ( aInPreCapture && !iAlwaysDrawPreCaptureCourtesyUI ) |
|
6535 || ( !aInPreCapture && !iAlwaysDrawPostCaptureCourtesyUI )) |
|
6536 { |
|
6537 // Decide whether to turn the UI back on |
|
6538 if( ( aInPreCapture && !iDrawPreCaptureCourtesyUI) |
|
6539 || (!aInPreCapture && !iDrawPostCaptureCourtesyUI)) |
|
6540 { |
|
6541 if ( aKeyEvent.iScanCode == EStdKeyUpArrow |
|
6542 || aKeyEvent.iScanCode == EStdKeyDownArrow |
|
6543 || aKeyEvent.iScanCode == EStdKeyDevice3 |
|
6544 // Navikey select |
|
6545 ) |
|
6546 { |
|
6547 if ( aInPreCapture ) |
|
6548 { |
|
6549 RaisePreCaptureCourtesyUI(EFalse); |
|
6550 } |
|
6551 else |
|
6552 { |
|
6553 RaisePostCaptureCourtesyUI(); |
|
6554 } |
|
6555 retVal = EKeyWasConsumed; |
|
6556 } |
|
6557 } |
|
6558 #ifndef __WINS__ |
|
6559 RArray <TInt> halfCaptureKeys; |
|
6560 CleanupClosePushL( halfCaptureKeys ); |
|
6561 |
|
6562 // now get half key press code to register |
|
6563 if ( iController.UiConfigManagerPtr() ) |
|
6564 { |
|
6565 iController.UiConfigManagerPtr()-> |
|
6566 SupportedPrimaryCameraAutoFocusKeyL( halfCaptureKeys ); |
|
6567 } |
|
6568 if ( halfCaptureKeys.Count() > 0 ) |
|
6569 { |
|
6570 if ( aInPreCapture && aKeyEvent.iScanCode |
|
6571 == halfCaptureKeys[0] ) |
|
6572 { |
|
6573 SubmergePreCaptureCourtesyUI(); |
|
6574 retVal = EKeyWasConsumed; |
|
6575 } |
|
6576 } |
|
6577 CleanupStack::PopAndDestroy( &halfCaptureKeys ); |
|
6578 #else |
|
6579 if ( aInPreCapture && aKeyEvent.iScanCode |
|
6580 == EProductKeyCaptureHalf ) |
|
6581 { |
|
6582 SubmergePreCaptureCourtesyUI(); |
|
6583 retVal = EKeyWasConsumed; |
|
6584 } |
|
6585 #endif |
|
6586 } |
|
6587 } |
|
6588 } |
|
6589 PRINT(_L("Camera <= CheckCourtesyKeyEvent")) |
|
6590 |
|
6591 return retVal; |
|
6592 } |
|
6593 |
|
6594 // --------------------------------------------------------------------------- |
|
6595 // CCamAppUi::RaisePreCaptureCourtesyUI |
|
6596 // Shows the optional precapture UI |
|
6597 // --------------------------------------------------------------------------- |
|
6598 // |
|
6599 void CCamAppUi::RaisePreCaptureCourtesyUI(TBool aShowZoomBar) |
|
6600 { |
|
6601 PRINT1(_L("Camera => CCamAppUi::RaisePreCaptureCourtesyUI \ |
|
6602 aShowZoomBar = %d"), aShowZoomBar); |
|
6603 |
|
6604 if ( CourtesyUiApplies() && iDrawPreCaptureCourtesyUI ) |
|
6605 { |
|
6606 |
|
6607 iDrawPreCaptureCourtesyUI = ETrue; |
|
6608 |
|
6609 if ( iCamZoomPane && aShowZoomBar && !iCamZoomPane->IsZoomAtMinimum() ) |
|
6610 { |
|
6611 PRINT(_L("Camera == CCamAppUi::RaisePreCaptureCourtesyUI \ |
|
6612 Showing zoom pane")); |
|
6613 |
|
6614 CCamViewBase* view = NULL; |
|
6615 |
|
6616 if ( iMode == ECamControllerVideo ) |
|
6617 { |
|
6618 view = iVideoCaptureView; |
|
6619 } |
|
6620 else |
|
6621 { |
|
6622 view = iStillCaptureView; |
|
6623 } |
|
6624 |
|
6625 if ( view ) |
|
6626 { |
|
6627 CCamContainerBase* container = view->Container(); |
|
6628 |
|
6629 if ( container ) |
|
6630 { |
|
6631 container->ShowZoomPaneWithTimer(); |
|
6632 } |
|
6633 } |
|
6634 } |
|
6635 else |
|
6636 { |
|
6637 if ( iZoomPaneShown && iRotatedKeyEvent ) |
|
6638 { |
|
6639 HideZoomPane(ETrue); |
|
6640 iRotatedKeyEvent = EFalse; |
|
6641 } |
|
6642 } |
|
6643 PRINT(_L("Camera == CCamAppUi::RaisePreCaptureCourtesyUI Showing AP")); |
|
6644 SetActivePaletteVisibility( ETrue ); |
|
6645 |
|
6646 TUid settingsPluginUid = KNullUid; |
|
6647 |
|
6648 if ( iPlugin ) |
|
6649 { |
|
6650 settingsPluginUid = iPlugin->Id(); |
|
6651 } |
|
6652 |
|
6653 if ( iView ) |
|
6654 { |
|
6655 const TUid uid1( iView->Id() ); |
|
6656 const TInt uid( uid1.iUid ); |
|
6657 |
|
6658 if( !iController.InVideocallOrRinging() && |
|
6659 ( ECamViewIdStillPreCapture == uid || |
|
6660 ECamViewIdStillPostCapture == uid || |
|
6661 ECamViewIdVideoPreCapture == uid || |
|
6662 ECamViewIdVideoPostCapture == uid || |
|
6663 ECamViewIdBurstThumbnail == uid ) |
|
6664 ) |
|
6665 { |
|
6666 TRAP_IGNORE( static_cast<CCamViewBase*> |
|
6667 ( iView )->UnsetCourtesySoftKeysL() ); |
|
6668 } |
|
6669 } |
|
6670 |
|
6671 TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen)); |
|
6672 |
|
6673 iCourtesyTimerInPreCapture = ETrue; |
|
6674 |
|
6675 if ( iCourtesyTimer ) |
|
6676 { |
|
6677 iCourtesyTimer->Cancel(); |
|
6678 |
|
6679 if ( !iAlwaysDrawPreCaptureCourtesyUI ) |
|
6680 { |
|
6681 iCourtesyTimer->StartTimer(); |
|
6682 } |
|
6683 } |
|
6684 } |
|
6685 PRINT(_L("Camera <= CCamAppUi::RaisePreCaptureCourtesyUI")) |
|
6686 } |
|
6687 |
|
6688 // --------------------------------------------------------------------------- |
|
6689 // CCamAppUi::RaisePostCaptureCourtesyUI |
|
6690 // Shows the optional postcapture UI |
|
6691 // --------------------------------------------------------------------------- |
|
6692 // |
|
6693 void CCamAppUi::RaisePostCaptureCourtesyUI() |
|
6694 { |
|
6695 PRINT(_L("Camera => CCamAppUi::RaisePostCaptureCourtesyUI")) |
|
6696 if ( CourtesyUiApplies() ) |
|
6697 { |
|
6698 iDrawPostCaptureCourtesyUI = ETrue; |
|
6699 |
|
6700 SetActivePaletteVisibility( ETrue ); |
|
6701 |
|
6702 if ( iView ) |
|
6703 { |
|
6704 TRAP_IGNORE(static_cast<CCamViewBase*> |
|
6705 (iView)->UnsetCourtesySoftKeysL()); |
|
6706 } |
|
6707 |
|
6708 TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen)); |
|
6709 |
|
6710 iCourtesyTimerInPreCapture = EFalse; |
|
6711 |
|
6712 } |
|
6713 PRINT(_L("Camera <= CCamAppUi::RaisePostCaptureCourtesyUI")) |
|
6714 } |
|
6715 |
|
6716 // --------------------------------------------------------------------------- |
|
6717 // CCamAppUi::SubmergePreCaptureCourtesyUI |
|
6718 // Hides the optional precapture UI |
|
6719 // --------------------------------------------------------------------------- |
|
6720 // |
|
6721 void CCamAppUi::SubmergePreCaptureCourtesyUI() |
|
6722 { |
|
6723 PRINT(_L("Camera => CCamAppUi::SubmergePreCaptureCourtesyUI")) |
|
6724 |
|
6725 const TCamCaptureOperation operation( iController.CurrentOperation() ); |
|
6726 |
|
6727 |
|
6728 |
|
6729 if ( ( CourtesyUiApplies() && !iDrawPreCaptureCourtesyUI |
|
6730 && !SelfTimerEnabled() |
|
6731 && ECamViewStatePreCapture == iViewState ) |
|
6732 // and if we are burst capturing |
|
6733 // then do not remove the cancel softkey |
|
6734 && !( IsBurstEnabled() |
|
6735 && (ECamCapturing == operation |
|
6736 ||ECamCompleting == operation ) ) ) |
|
6737 { |
|
6738 if ( FullScreenViewfinderEnabled() ) |
|
6739 { |
|
6740 // Don't submerge if we're capturing time-lapse photos |
|
6741 if ( !(ECamImageCaptureTimeLapse == CurrentBurstMode() |
|
6742 && iController.SequenceCaptureInProgress()) ) |
|
6743 { |
|
6744 |
|
6745 if ( ECamControllerVideo == iMode ) |
|
6746 { |
|
6747 |
|
6748 SetActivePaletteVisibility( EFalse ); |
|
6749 |
|
6750 if ( iController.IsTouchScreenSupported() ) |
|
6751 { |
|
6752 // Enable fixed toolbar |
|
6753 CAknToolbar* toolbar = CurrentFixedToolbar(); |
|
6754 if ( toolbar ) |
|
6755 { |
|
6756 toolbar->SetToolbarVisibility( EFalse ); |
|
6757 } |
|
6758 } |
|
6759 |
|
6760 if ( iView ) |
|
6761 { |
|
6762 if(!iController.IsTouchScreenSupported()) |
|
6763 { |
|
6764 TRAP_IGNORE(static_cast<CCamViewBase*> |
|
6765 (iView)->SetCourtesySoftKeysL()); |
|
6766 } |
|
6767 else |
|
6768 { |
|
6769 TRAP_IGNORE(static_cast<CCamViewBase*> |
|
6770 (iView)->UnsetCourtesySoftKeysL()); |
|
6771 } |
|
6772 } |
|
6773 |
|
6774 } // end if ( iMode == ECamControllerVideo ) |
|
6775 else |
|
6776 { |
|
6777 // in still mode toolbar and softkeys |
|
6778 // are not to be hidden as part of courtesy ui |
|
6779 // imode: ECamControllerIdle, ECamControllerImage, |
|
6780 // or ECamControllerShutdown |
|
6781 |
|
6782 SetActivePaletteVisibility( EFalse ); |
|
6783 |
|
6784 if ( iView ) |
|
6785 { |
|
6786 if(!iController.IsTouchScreenSupported()) |
|
6787 { |
|
6788 TRAP_IGNORE(static_cast<CCamViewBase*> |
|
6789 (iView)->SetCourtesySoftKeysL()); |
|
6790 } |
|
6791 else |
|
6792 { |
|
6793 TRAP_IGNORE(static_cast<CCamViewBase*> |
|
6794 (iView)->UnsetCourtesySoftKeysL()); |
|
6795 } |
|
6796 } |
|
6797 |
|
6798 } |
|
6799 |
|
6800 TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen)); |
|
6801 } |
|
6802 |
|
6803 } // if ( FullScreenViewfinderEnabled() |
|
6804 } |
|
6805 PRINT(_L("Camera <= CCamAppUi::SubmergePreCaptureCourtesyUI")) |
|
6806 } |
|
6807 |
|
6808 |
|
6809 // --------------------------------------------------------------------------- |
|
6810 // CCamAppUi::SubmergePostCaptureCourtesyUI |
|
6811 // Hides the optional postcapture UI |
|
6812 // --------------------------------------------------------------------------- |
|
6813 // |
|
6814 void CCamAppUi::SubmergePostCaptureCourtesyUI() |
|
6815 { |
|
6816 PRINT(_L("Camera => CCamAppUi::SubmergePostCaptureCourtesyUI")) |
|
6817 if ( CourtesyUiApplies() |
|
6818 |
|
6819 && ECamViewStatePostCapture == iViewState ) |
|
6820 { |
|
6821 iDrawPostCaptureCourtesyUI = EFalse; |
|
6822 |
|
6823 SetActivePaletteVisibility( EFalse ); |
|
6824 |
|
6825 if ( iView ) |
|
6826 { |
|
6827 TRAP_IGNORE(static_cast<CCamViewBase*> |
|
6828 (iView)->SetCourtesySoftKeysL()); |
|
6829 } |
|
6830 |
|
6831 TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen)); |
|
6832 } |
|
6833 PRINT(_L("Camera <= CCamAppUi::SubmergePostCaptureCourtesyUI")) |
|
6834 } |
|
6835 |
|
6836 // --------------------------------------------------------------------------- |
|
6837 // CCamAppUi::ShowZoomPane |
|
6838 // Needed to show or update the zoom pane in direct viewfinder mode, |
|
6839 // or where the active toolbar is used. |
|
6840 // --------------------------------------------------------------------------- |
|
6841 // |
|
6842 void CCamAppUi::ShowZoomPane(TBool aRedraw) |
|
6843 { |
|
6844 PRINT( _L("Camera => CCamAppUi::ShowZoomPane" )) |
|
6845 iZoomPaneShown = ETrue; |
|
6846 |
|
6847 if ( aRedraw && IsDirectViewfinderActive() ) |
|
6848 { |
|
6849 TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen)); |
|
6850 } |
|
6851 PRINT( _L("Camera <= CCamAppUi::ShowZoomPane" )) |
|
6852 } |
|
6853 |
|
6854 // --------------------------------------------------------------------------- |
|
6855 // CCamAppUi::HideZoomPane |
|
6856 // Needed to hide the zoom pane in direct viewfinder mode, |
|
6857 // or where the active toolbar is used. |
|
6858 // --------------------------------------------------------------------------- |
|
6859 // |
|
6860 void CCamAppUi::HideZoomPane( TBool aRedraw ) |
|
6861 { |
|
6862 PRINT( _L("Camera => CCamAppUi::HideZoomPane" )) |
|
6863 iZoomPaneShown = EFalse; |
|
6864 |
|
6865 if ( iDrawPreCaptureCourtesyUI && iController.IsViewFinding() ) |
|
6866 { |
|
6867 if ( iViewState == ECamViewStatePreCapture ) |
|
6868 { |
|
6869 SetActivePaletteVisibility( ETrue ); |
|
6870 } |
|
6871 } |
|
6872 |
|
6873 if ( aRedraw && IsDirectViewfinderActive() ) |
|
6874 { |
|
6875 TRAP_IGNORE( HandleCommandL(ECamCmdRedrawScreen ) ); |
|
6876 } |
|
6877 PRINT( _L("Camera <= CCamAppUi::HideZoomPane" )) |
|
6878 } |
|
6879 |
|
6880 // --------------------------------------------------------------------------- |
|
6881 // CCamAppUi::SetActivePaletteVisibility |
|
6882 // Displays or hides the active palette, depending on some inbuilt restraints |
|
6883 // --------------------------------------------------------------------------- |
|
6884 // |
|
6885 |
|
6886 void CCamAppUi::SetActivePaletteVisibility( TBool aShown ) |
|
6887 { |
|
6888 PRINT1( _L("Camera => CCamAppUi::SetActivePaletteVisibility %d" ), aShown ) |
|
6889 |
|
6890 if ( !iController.IsTouchScreenSupported() ) |
|
6891 { |
|
6892 if ( ECamOrientationCamcorder == iCamOrientation |
|
6893 || ECamOrientationCamcorderLeft == iCamOrientation |
|
6894 || ECamOrientationPortrait == iCamOrientation ) |
|
6895 { |
|
6896 TCamCaptureOperation operation = iController.CurrentOperation(); |
|
6897 |
|
6898 // Does the current video mode prevent showing. |
|
6899 // |
|
6900 TBool videoOperationPrevents = |
|
6901 ( ECamControllerVideo == iMode ) |
|
6902 && ( ECamCapturing == operation || ECamPaused == operation ); |
|
6903 |
|
6904 TBool imageOperationPrevents = |
|
6905 ( ECamControllerImage == iMode ) |
|
6906 && ( ECamCapturing == operation || ECamCompleting == operation |
|
6907 || ECamFocusing == operation || ECamFocused == operation |
|
6908 || ECamFocusFailed == operation ); |
|
6909 |
|
6910 if ( (!aShown ) |
|
6911 |
|
6912 || ( aShown && !iPreventActivePaletteDisplay |
|
6913 && !TimeLapseSliderShown() |
|
6914 && ( iViewState == ECamViewStatePostCapture |
|
6915 || FullScreenViewfinderEnabled() |
|
6916 || IsSecondCameraEnabled() ) |
|
6917 && !videoOperationPrevents |
|
6918 && !imageOperationPrevents |
|
6919 && ((iDrawPreCaptureCourtesyUI && iViewState == ECamViewStatePreCapture) |
|
6920 || (iDrawPostCaptureCourtesyUI && iViewState == ECamViewStatePostCapture) )) |
|
6921 ) |
|
6922 { |
|
6923 if ( iActivePaletteHandler ) |
|
6924 { |
|
6925 PRINT1(_L("Precapture mode is %d"),iPreCaptureMode) |
|
6926 PRINT(_L("Setting Active Palette Visibility")) |
|
6927 iActivePaletteHandler->SetVisibility( aShown ); |
|
6928 if ( ( !IsEmbedded() && IsSecondCameraEnabled() ) |
|
6929 || !IsSecondCameraEnabled() ) |
|
6930 { |
|
6931 iToolbarVisibility = aShown; |
|
6932 } |
|
6933 else if ( IsEmbedded() && IsSecondCameraEnabled() ) |
|
6934 { |
|
6935 iToolbarVisibility = EFalse; |
|
6936 } |
|
6937 } |
|
6938 } |
|
6939 } |
|
6940 } |
|
6941 PRINT( _L("Camera <= CCamAppUi::SetActivePaletteVisibility" )) |
|
6942 } |
|
6943 |
|
6944 |
|
6945 // --------------------------------------------------------------------------- |
|
6946 // CCamAppUi::IsDirectViewfinderActive |
|
6947 // Detects whether the direct viewfinder is in use or not |
|
6948 // --------------------------------------------------------------------------- |
|
6949 // |
|
6950 TBool CCamAppUi::IsDirectViewfinderActive() |
|
6951 { |
|
6952 if ( iController.UiConfigManagerPtr() && |
|
6953 ( ( iDSASupported && iCamOrientation == ECamOrientationCamcorder || |
|
6954 iCamOrientation == ECamOrientationCamcorderLeft ) || |
|
6955 ( iController.IsDirectScreenVFSupported( EFalse ) && |
|
6956 iCamOrientation == ECamOrientationPortrait ) ) && |
|
6957 !( IsBurstEnabled() && iController.SequenceCaptureInProgress() ) ) |
|
6958 { |
|
6959 return ETrue; |
|
6960 } |
|
6961 return EFalse; |
|
6962 } |
|
6963 |
|
6964 // --------------------------------------------------------------------------- |
|
6965 // CCamAppUi::UpdateNaviModelsL |
|
6966 // Called to set the correct navicounter / naviprogress controls to "active" |
|
6967 // --------------------------------------------------------------------------- |
|
6968 // |
|
6969 void CCamAppUi::UpdateNaviModelsL( const TBool aUpdateNavi ) |
|
6970 { |
|
6971 iNaviCounterControl->SetActiveL( EFalse ); |
|
6972 iNaviPaneCounterControl->SetActiveL( EFalse ); |
|
6973 iNaviProgressBarControl->SetActiveL( EFalse ); |
|
6974 iNaviPaneProgressBarControl->SetActiveL( EFalse ); |
|
6975 if ( !aUpdateNavi ) |
|
6976 { |
|
6977 // We are immediately closing the app or in Pretend Exit |
|
6978 // No need to update NaviPane |
|
6979 return; |
|
6980 } |
|
6981 else if ( ECamOrientationCamcorder == iCamOrientation |
|
6982 || ECamOrientationCamcorderLeft == iCamOrientation |
|
6983 || ECamOrientationPortrait == iCamOrientation ) |
|
6984 { |
|
6985 iNaviCounterControl->SetExtentToWholeScreen(); |
|
6986 iNaviCounterControl->SetActiveL( ETrue ); |
|
6987 iNaviProgressBarControl->SetExtentToWholeScreen(); |
|
6988 iNaviProgressBarControl->SetActiveL( ETrue ); |
|
6989 } |
|
6990 else |
|
6991 { |
|
6992 iNaviPaneCounterControl->SetActiveL( ETrue ); |
|
6993 iNaviPaneProgressBarControl->SetActiveL( ETrue ); |
|
6994 } |
|
6995 } |
|
6996 |
|
6997 // --------------------------------------------------------------------------- |
|
6998 // CCamAppUi::AppController |
|
6999 // Returns the app controller |
|
7000 // --------------------------------------------------------------------------- |
|
7001 // |
|
7002 MCamAppController& CCamAppUi::AppController() |
|
7003 { |
|
7004 return iController; |
|
7005 } |
|
7006 |
|
7007 // --------------------------------------------------------- |
|
7008 // CCamAppUi::ForegroundAppIsPhoneApp |
|
7009 // Whether or not the phone app is in the foreground |
|
7010 // --------------------------------------------------------- |
|
7011 // |
|
7012 TBool CCamAppUi::ForegroundAppIsPhoneApp() const |
|
7013 { |
|
7014 TBool phoneInForeground = EFalse; |
|
7015 // Gets the window group id of the app coming in foreground |
|
7016 TInt windowGroupId = iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
7017 if ( windowGroupId == iPhoneAppWindowGroupId ) |
|
7018 { |
|
7019 phoneInForeground = ETrue; |
|
7020 } |
|
7021 return phoneInForeground; |
|
7022 } |
|
7023 |
|
7024 // --------------------------------------------------------------------------- |
|
7025 // CCamAppUi::SwitchStillCaptureModeL |
|
7026 // Change the still capture mode |
|
7027 // --------------------------------------------------------------------------- |
|
7028 // |
|
7029 void |
|
7030 CCamAppUi::SwitchStillCaptureModeL( TCamImageCaptureMode aImageMode, |
|
7031 TBool aReprepare, |
|
7032 TBool aUpdateUi /*=ETrue*/) |
|
7033 { |
|
7034 PRINT( _L( "Camera => CCamAppUi::SwitchStillCaptureModeL" ) ) |
|
7035 |
|
7036 iTargetImageMode = aImageMode; |
|
7037 |
|
7038 if ( iController.UiConfigManagerPtr()->IsXenonFlashSupported() ) |
|
7039 { |
|
7040 switch( iTargetImageMode ) |
|
7041 { |
|
7042 case ECamImageCaptureSingle: |
|
7043 case ECamImageCaptureTimeLapse: |
|
7044 { |
|
7045 // Switching from burst mode to single/timelapse mode. |
|
7046 // Restore previous original flash setting. |
|
7047 iController.RestoreFlashMode(); |
|
7048 break; |
|
7049 } |
|
7050 case ECamImageCaptureBurst: |
|
7051 { |
|
7052 if( iImageMode != iTargetImageMode ) |
|
7053 { |
|
7054 // Switching from single/timelapse capture to burst mode. |
|
7055 // Save current flash mode, and disable flash. |
|
7056 iController.SaveFlashMode(); |
|
7057 } |
|
7058 iController.SetIntegerSettingValueL( ECamSettingItemDynamicPhotoFlash, |
|
7059 ECamFlashOff ); |
|
7060 break; |
|
7061 } |
|
7062 } |
|
7063 } |
|
7064 |
|
7065 TBool burstEnabled = ( ECamImageCaptureBurst == aImageMode |
|
7066 || ECamImageCaptureTimeLapse == aImageMode ); |
|
7067 |
|
7068 if ( iController.TimeLapseSupported() ) |
|
7069 { |
|
7070 // if burst has been disabled |
|
7071 // then make sure the timelapse interval has been |
|
7072 // set back to 0 in the controller. |
|
7073 if ( !burstEnabled ) |
|
7074 { |
|
7075 iController.SetTimeLapseInterval( TInt64(0) ); |
|
7076 } |
|
7077 } |
|
7078 |
|
7079 if ( iImageMode != iTargetImageMode ) |
|
7080 { |
|
7081 // Inform any observers that burst mode has been changed |
|
7082 TInt count = iBurstModeObservers.Count(); |
|
7083 TInt i; |
|
7084 for ( i = 0; i < count; i++ ) |
|
7085 { |
|
7086 iBurstModeObservers[i]->BurstModeActiveL( burstEnabled, aReprepare ); |
|
7087 } |
|
7088 } |
|
7089 |
|
7090 if( aUpdateUi ) |
|
7091 { |
|
7092 TrySwitchViewL(); |
|
7093 } |
|
7094 |
|
7095 iController.BurstModeActiveL( burstEnabled, aReprepare ); |
|
7096 |
|
7097 if( aUpdateUi ) |
|
7098 { |
|
7099 iNaviCounterModel->SetCaptureModeL( iMode, iImageMode ); |
|
7100 |
|
7101 if ( aReprepare ) |
|
7102 { |
|
7103 PRINT( _L( "Camera <> CCamAppUi::SwitchStillCaptureModeL: update AP.." )) |
|
7104 iActivePaletteHandler->UpdateActivePaletteL(); |
|
7105 } |
|
7106 } |
|
7107 PRINT( _L("Camera <= CCamAppUi::SwitchStillCaptureModeL") ) |
|
7108 } |
|
7109 |
|
7110 #if !defined(__WINSCW__) |
|
7111 // --------------------------------------------------------------------------- |
|
7112 // CCamAppUi::RegisterCaptureKeysL |
|
7113 // Register to capture half and full shutter press key events |
|
7114 // --------------------------------------------------------------------------- |
|
7115 // |
|
7116 void CCamAppUi::RegisterCaptureKeysL() |
|
7117 { |
|
7118 RArray<TInt> captureKeys; |
|
7119 CleanupClosePushL( captureKeys ); |
|
7120 |
|
7121 if ( iController.UiConfigManagerPtr() ) |
|
7122 { |
|
7123 iController.UiConfigManagerPtr()-> |
|
7124 SupportedPrimaryCameraCaptureKeyL( captureKeys ); |
|
7125 } |
|
7126 |
|
7127 if( iCameraKeyHandle == 0 ) |
|
7128 { |
|
7129 iCameraKeyHandle = iCoeEnv->RootWin().CaptureKey( EKeyCamera, 0, 0 ); |
|
7130 } |
|
7131 |
|
7132 if( iFullShutterUpDownHandle == 0 ) |
|
7133 { |
|
7134 if ( captureKeys.Count() > 0 ) |
|
7135 { |
|
7136 //EProductKeyCapture |
|
7137 iFullShutterUpDownHandle = iCoeEnv-> |
|
7138 RootWin().CaptureKeyUpAndDowns( captureKeys[0] , 0, 0 ); |
|
7139 } |
|
7140 |
|
7141 } |
|
7142 |
|
7143 if( iFullShutterPressHandle == 0 ) |
|
7144 { |
|
7145 if ( captureKeys.Count() > 0 ) |
|
7146 { |
|
7147 iFullShutterPressHandle = iCoeEnv-> |
|
7148 RootWin().CaptureKey( captureKeys[0], 0, 0 ); |
|
7149 } |
|
7150 } |
|
7151 |
|
7152 if( iHalfShutterPressHandle == 0 ) |
|
7153 { |
|
7154 captureKeys.Reset(); |
|
7155 |
|
7156 // now get half key press code to register |
|
7157 if ( iController.UiConfigManagerPtr() ) |
|
7158 { |
|
7159 iController.UiConfigManagerPtr()-> |
|
7160 SupportedPrimaryCameraAutoFocusKeyL( captureKeys ); |
|
7161 } |
|
7162 if ( captureKeys.Count() > 0 ) |
|
7163 { |
|
7164 iHalfShutterPressHandle = iCoeEnv-> |
|
7165 RootWin().CaptureKey( captureKeys[0], 0, 0 ); |
|
7166 } |
|
7167 } |
|
7168 CleanupStack::PopAndDestroy( &captureKeys ); |
|
7169 } |
|
7170 |
|
7171 // --------------------------------------------------------------------------- |
|
7172 // CCamAppUi::UnRegisterCaptureKeys |
|
7173 // Release capture of half and full shutter press key events |
|
7174 // --------------------------------------------------------------------------- |
|
7175 // |
|
7176 void CCamAppUi::UnRegisterCaptureKeys() |
|
7177 { |
|
7178 //Since this function can be called from the destructor, we should |
|
7179 //check that iCoeEnv isn't null prior to using it. |
|
7180 if( iCoeEnv ) |
|
7181 { |
|
7182 if ( iCameraKeyHandle > 0 ) |
|
7183 { |
|
7184 iCoeEnv->RootWin().CancelCaptureKey( iCameraKeyHandle ); |
|
7185 iCameraKeyHandle = 0; |
|
7186 } |
|
7187 if ( iFullShutterPressHandle > 0 ) |
|
7188 { |
|
7189 iCoeEnv->RootWin().CancelCaptureKey( iFullShutterPressHandle ); |
|
7190 iFullShutterPressHandle = 0; |
|
7191 } |
|
7192 if ( iHalfShutterPressHandle > 0 ) |
|
7193 { |
|
7194 iCoeEnv->RootWin().CancelCaptureKey( iHalfShutterPressHandle ); |
|
7195 iHalfShutterPressHandle = 0; |
|
7196 } |
|
7197 |
|
7198 if ( iFullShutterUpDownHandle > 0 ) |
|
7199 { |
|
7200 iCoeEnv->RootWin().CancelCaptureKey( iFullShutterUpDownHandle ); |
|
7201 iFullShutterUpDownHandle = 0; |
|
7202 } |
|
7203 } |
|
7204 } |
|
7205 |
|
7206 #endif |
|
7207 |
|
7208 // --------------------------------------------------------------------------- |
|
7209 // CCamAppUi::SetSoftKeysL |
|
7210 // Sets the softkeys to the specified Resource ID |
|
7211 // --------------------------------------------------------------------------- |
|
7212 // |
|
7213 void CCamAppUi::SetSoftKeysL( TInt aResource ) |
|
7214 { |
|
7215 PRINT1( _L("Camera => CCamAppUi::SetSoftKeysL resource:%x"), aResource ); |
|
7216 if ( iView ) |
|
7217 { |
|
7218 static_cast<CCamViewBase*>(iView)->SetSoftKeysL(aResource); |
|
7219 } |
|
7220 PRINT( _L("Camera <= CCamAppUi::SetSoftKeysL") ); |
|
7221 } |
|
7222 |
|
7223 // --------------------------------------------------------------------------- |
|
7224 // CCamAppUi::TimeLapseSliderShown |
|
7225 // Returns whether time lapse slider is currently shown |
|
7226 // --------------------------------------------------------------------------- |
|
7227 // |
|
7228 TBool CCamAppUi::TimeLapseSliderShown() const |
|
7229 { |
|
7230 return ECamPreCapTimeLapseSlider == iPreCaptureMode; |
|
7231 } |
|
7232 |
|
7233 // --------------------------------------------------------------------------- |
|
7234 // CCamAppUi::FullScreenViewfinderEnabled |
|
7235 // Returns whether or not the full screen viewfinder is being shown |
|
7236 // --------------------------------------------------------------------------- |
|
7237 // |
|
7238 TBool CCamAppUi::FullScreenViewfinderEnabled() const |
|
7239 { |
|
7240 TBool retVal = EFalse; |
|
7241 |
|
7242 if ( ECamViewStatePreCapture == iViewState |
|
7243 && ( ECamOrientationCamcorder == iCamOrientation |
|
7244 || ECamOrientationCamcorderLeft == iCamOrientation ) |
|
7245 && ECamPreCapViewfinder == iPreCaptureMode) |
|
7246 { |
|
7247 retVal = ETrue; |
|
7248 } |
|
7249 |
|
7250 return retVal; |
|
7251 } |
|
7252 |
|
7253 // --------------------------------------------------------------------------- |
|
7254 // CCamAppUi::SetPreCaptureModeL |
|
7255 // Sets the current pre-capture mode |
|
7256 // --------------------------------------------------------------------------- |
|
7257 // |
|
7258 void CCamAppUi::SetPreCaptureModeL(TCamPreCaptureMode aMode) |
|
7259 { |
|
7260 PRINT(_L("Camera=>CCamAppUi::SetPreCaptureMode")) |
|
7261 iPreCaptureMode = aMode; |
|
7262 |
|
7263 CCamViewBase* precapView = NULL; |
|
7264 if ( iView == iStillCaptureView || |
|
7265 iView == iVideoCaptureView ) |
|
7266 { |
|
7267 precapView = static_cast<CCamViewBase*>( iView ); |
|
7268 __ASSERT_DEBUG( precapView, CamPanic( ECamPanicNullPointer )); |
|
7269 } |
|
7270 |
|
7271 if ( ECamPreCapViewfinder == iPreCaptureMode ) |
|
7272 { |
|
7273 if ( !( iController.UiConfigManagerPtr() && |
|
7274 iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) ) |
|
7275 { |
|
7276 RaisePreCaptureCourtesyUI(ETrue); |
|
7277 } |
|
7278 if ( precapView ) |
|
7279 { |
|
7280 if ( iView == iStillCaptureView ) |
|
7281 { |
|
7282 // fixed toolbar is used only with touch devices |
|
7283 if ( iController.IsTouchScreenSupported() ) |
|
7284 { |
|
7285 if ( IsSecondCameraEnabled() ) |
|
7286 { |
|
7287 TInt resourceId = IsQwerty2ndCamera()? |
|
7288 R_CAM_STILL_PRECAPTURE_TOOLBAR_LANDSCAPE: |
|
7289 R_CAM_STILL_PRECAPTURE_TOOLBAR_PORTRAIT; |
|
7290 precapView->CreateAndSetToolbarL( resourceId ); |
|
7291 } |
|
7292 else |
|
7293 { |
|
7294 precapView->CreateAndSetToolbarL( R_CAM_STILL_PRECAPTURE_TOOLBAR ); |
|
7295 } |
|
7296 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
7297 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
7298 |
|
7299 if ( !IsSecondCameraEnabled() ) |
|
7300 { |
|
7301 iStillCaptureView->UpdateToolbarIconsL(); |
|
7302 } |
|
7303 |
|
7304 fixedToolbar->SetToolbarObserver( iStillCaptureView ); |
|
7305 SetToolbarVisibility(); |
|
7306 |
|
7307 if ( IsEmbedded() ) |
|
7308 { |
|
7309 iStillCaptureView->HideButton( ECamCmdNewVideo ); |
|
7310 } |
|
7311 |
|
7312 // Make sure toolbar extension button has no background |
|
7313 CAknButton* extensionButton = static_cast<CAknButton*>( |
|
7314 fixedToolbar->ControlOrNull( ECamCmdToolbarExtension ) ); |
|
7315 if ( extensionButton ) |
|
7316 { |
|
7317 extensionButton->SetButtonFlags( |
|
7318 // Set KAknButtonNoFrame flag for extension buttons |
|
7319 extensionButton->ButtonFlags() | KAknButtonNoFrame ); |
|
7320 } |
|
7321 } |
|
7322 } |
|
7323 else if ( iView == iVideoCaptureView ) |
|
7324 { |
|
7325 // fixed toolbar is used only with touch devices |
|
7326 if ( iController.IsTouchScreenSupported() ) |
|
7327 { |
|
7328 if ( IsSecondCameraEnabled() ) |
|
7329 { |
|
7330 TInt resourceId = IsQwerty2ndCamera()? |
|
7331 R_CAM_VIDEO_PRECAPTURE_TOOLBAR_LANDSCAPE: |
|
7332 R_CAM_VIDEO_PRECAPTURE_TOOLBAR_PORTRAIT; |
|
7333 precapView->CreateAndSetToolbarL( resourceId ); |
|
7334 } |
|
7335 else |
|
7336 { |
|
7337 if(iController.UiConfigManagerPtr()->IsXenonFlashSupported()) |
|
7338 { |
|
7339 precapView->CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR); |
|
7340 } |
|
7341 else |
|
7342 { |
|
7343 precapView->CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR_VIDEOLIGHT); |
|
7344 } |
|
7345 } |
|
7346 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
7347 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
7348 |
|
7349 if ( !IsSecondCameraEnabled() ) |
|
7350 { |
|
7351 iVideoCaptureView->UpdateToolbarIconsL(); |
|
7352 } |
|
7353 |
|
7354 fixedToolbar->SetToolbarObserver( iVideoCaptureView ); |
|
7355 SetToolbarVisibility(); |
|
7356 if ( IsEmbedded() ) |
|
7357 { |
|
7358 iVideoCaptureView->HideButton( ECamCmdNewPhoto ); |
|
7359 } |
|
7360 |
|
7361 // Make sure toolbar extension button has no background |
|
7362 CAknButton* extensionButton = static_cast<CAknButton*>( |
|
7363 fixedToolbar->ControlOrNull( ECamCmdToolbarExtension ) ); |
|
7364 if ( extensionButton ) |
|
7365 { |
|
7366 extensionButton->SetButtonFlags( |
|
7367 // Set KAknButtonNoFrame flag for extension buttons |
|
7368 extensionButton->ButtonFlags() | KAknButtonNoFrame ); |
|
7369 } |
|
7370 } |
|
7371 } |
|
7372 |
|
7373 if( !IsSecondCameraEnabled() || IsQwerty2ndCamera() ) |
|
7374 { |
|
7375 EikSoftkeyPostingTransparency::MakeTransparent( |
|
7376 *precapView->ViewCba(), ETrue ); |
|
7377 |
|
7378 if( iDrawPreCaptureCourtesyUI ) |
|
7379 { |
|
7380 precapView->ViewCba()->MakeVisible( ETrue ); |
|
7381 } |
|
7382 } |
|
7383 |
|
7384 } |
|
7385 } |
|
7386 else |
|
7387 { |
|
7388 if ( precapView ) |
|
7389 { |
|
7390 precapView->ViewCba()->MakeVisible( ETrue ); |
|
7391 // fixed toolbar is used only with touch devices |
|
7392 if ( iController.IsTouchScreenSupported() ) |
|
7393 { |
|
7394 precapView->CreateAndSetToolbarL( R_CAM_EMPTY_FIXED_TOOLBAR ); |
|
7395 } |
|
7396 EikSoftkeyPostingTransparency::MakeTransparent( |
|
7397 *precapView->ViewCba(), EFalse ); |
|
7398 } |
|
7399 SetActivePaletteVisibility( EFalse ); |
|
7400 } |
|
7401 |
|
7402 if ( iViewState != ECamViewStateUserSceneSetup ) |
|
7403 { |
|
7404 if ( CamUtility::IsNhdDevice() ) |
|
7405 { |
|
7406 StatusPane()->MakeVisible( aMode == ECamPreCapStandby || |
|
7407 IsSecondCameraEnabled() && |
|
7408 !IsQwerty2ndCamera() || |
|
7409 SettingsLaunchedFromCamera() ); |
|
7410 } |
|
7411 else |
|
7412 { |
|
7413 // Settings, launched via toolbar, have a visible statuspane in |
|
7414 // Non-touch device |
|
7415 StatusPane()->MakeVisible( !precapView || |
|
7416 aMode != ECamPreCapViewfinder && |
|
7417 aMode != ECamPreCapTimeLapseSlider || |
|
7418 IsSecondCameraEnabled() || |
|
7419 SettingsLaunchedFromCamera() ); |
|
7420 } |
|
7421 } |
|
7422 |
|
7423 |
|
7424 PRINT(_L("Camera<=CCamAppUi::SetPreCaptureMode")) |
|
7425 } |
|
7426 |
|
7427 // --------------------------------------------------------------------------- |
|
7428 // CCamAppUi::SetPreCaptureMode |
|
7429 // Sets the current pre-capture mode |
|
7430 // --------------------------------------------------------------------------- |
|
7431 // |
|
7432 void CCamAppUi::SetPreCaptureMode( TCamPreCaptureMode aMode ) |
|
7433 { |
|
7434 TRAPD(err, SetPreCaptureModeL( aMode ) ); |
|
7435 if ( err ) |
|
7436 { |
|
7437 PRINT1(_L("Camera<=CCamAppUi::SetPreCaptureModeL Leave=%d"), err) |
|
7438 } |
|
7439 } |
|
7440 |
|
7441 // --------------------------------------------------------------------------- |
|
7442 // CCamAppUi::ShowPostCaptureView |
|
7443 // Whether to show the post capture view in current mode |
|
7444 // --------------------------------------------------------------------------- |
|
7445 // |
|
7446 TBool CCamAppUi::ShowPostCaptureView() const |
|
7447 { |
|
7448 TInt settingId( ( ECamControllerVideo == iMode ) |
|
7449 ? ECamSettingItemVideoShowCapturedVideo |
|
7450 : ECamSettingItemShowCapturedPhoto ); |
|
7451 |
|
7452 return ( ECamSettOn == iController.IntegerSettingValue( settingId ) ); |
|
7453 } |
|
7454 |
|
7455 |
|
7456 // --------------------------------------------------------------------------- |
|
7457 // CCamAppUi::SuppressUIRiseOnViewfinderStart |
|
7458 // Whether the automatic UI-rise should be suppressed on |
|
7459 // next viewfinder start event |
|
7460 // --------------------------------------------------------------------------- |
|
7461 // |
|
7462 TBool |
|
7463 CCamAppUi::SuppressUIRiseOnViewfinderStart() const |
|
7464 { |
|
7465 return iSuppressUIRise; |
|
7466 } |
|
7467 |
|
7468 |
|
7469 // --------------------------------------------------------------------------- |
|
7470 // CCamAppUi::SetSuppressUIRiseOnViewfinderStart |
|
7471 // Sets whether the automatic UI-rise should be suppressed on |
|
7472 // next viewfinder start event |
|
7473 // --------------------------------------------------------------------------- |
|
7474 // |
|
7475 void |
|
7476 CCamAppUi::SetSuppressUIRiseOnViewfinderStart(TBool aSuppress) |
|
7477 { |
|
7478 iSuppressUIRise = aSuppress; |
|
7479 } |
|
7480 |
|
7481 |
|
7482 // --------------------------------------------------------------------------- |
|
7483 // CCamAppUi::SelectViewFinderGridSettingL |
|
7484 // Select the viewfinder grid setting. |
|
7485 // Currently only sets the grid ON or OFF. |
|
7486 // --------------------------------------------------------------------------- |
|
7487 // |
|
7488 void |
|
7489 CCamAppUi::SelectViewFinderGridSettingL() |
|
7490 { |
|
7491 PRINT( _L("Camera => CCamAppUi::SelectViewFinderGridSettingL") ); |
|
7492 PRINT1( _L("Camera <> ECamSettingItemViewfinderGrid == (%d)"), |
|
7493 ECamSettingItemViewfinderGrid ); |
|
7494 |
|
7495 TInt current = iController.IntegerSettingValue( ECamSettingItemViewfinderGrid ); |
|
7496 TInt invert = (current == ECamViewfinderGridOn) |
|
7497 ? ECamViewfinderGridOff |
|
7498 : ECamViewfinderGridOn; |
|
7499 |
|
7500 // Switch the value. |
|
7501 iController.SetIntegerSettingValueL( ECamSettingItemViewfinderGrid, invert ); |
|
7502 |
|
7503 // We'll get a HandleControllerEventL callback |
|
7504 // from iController when the value has been set. |
|
7505 PRINT( _L("Camera <= CCamAppUi::SelectViewFinderGridSettingL") ); |
|
7506 } |
|
7507 |
|
7508 |
|
7509 // --------------------------------------------------------------------------- |
|
7510 // CCamAppUi::ConstructPostCaptureViewIfRequiredL |
|
7511 // |
|
7512 // Construct a postcapture view if not already constructed |
|
7513 // |
|
7514 // The following parameter combinations can be used: |
|
7515 // * Still postcapture view: aViewState = ECamViewStatePostCapture, |
|
7516 // aMode = ECamControllerImage |
|
7517 // * Burst thumbnail view: aViewState = ECamViewStateBurstThumbnail |
|
7518 // aMode = << ignored >> |
|
7519 // * Video postcapture view: aViewState = ECamViewStatePostCapture, |
|
7520 // aMode = ECamControllerVideo |
|
7521 // --------------------------------------------------------------------------- |
|
7522 // |
|
7523 void |
|
7524 CCamAppUi::ConstructPostCaptureViewIfRequiredL( TCamViewState aViewState, |
|
7525 TCamCameraMode aCaptureMode ) |
|
7526 { |
|
7527 CAknView* view; |
|
7528 |
|
7529 if( ECamViewStateBurstThumbnail == aViewState ) |
|
7530 { |
|
7531 // Burst thumbnail view |
|
7532 if( !iBurstThumbnailViewConstructed ) |
|
7533 { |
|
7534 PRINT( _L("Camera => CCamAppUi::\ |
|
7535 ConstructPostCaptureViewIfRequiredL - BurstThumbnail") ); |
|
7536 view = CCamBurstThumbnailView::NewLC( iController ); |
|
7537 AddViewL( view ); |
|
7538 CleanupStack::Pop( view ); |
|
7539 iBurstThumbnailViewConstructed = ETrue; |
|
7540 PRINT( _L("Camera <= CCamAppUi::\ |
|
7541 ConstructPostCaptureViewIfRequiredL - BurstThumbnail") ); |
|
7542 } |
|
7543 } |
|
7544 else if( ECamViewStatePostCapture == aViewState ) |
|
7545 { |
|
7546 if( ECamControllerVideo == aCaptureMode ) |
|
7547 { |
|
7548 // Video postcapture |
|
7549 if( !iVideoPostCaptureViewConstructed ) |
|
7550 { |
|
7551 PRINT( _L("Camera => \ |
|
7552 CCamAppUi::ConstructPostCaptureViewIfRequiredL \ |
|
7553 - VideoPostCapture") ); |
|
7554 view = CCamVideoPostCaptureView::NewLC( iController ); |
|
7555 AddViewL( view ); |
|
7556 CleanupStack::Pop( view ); |
|
7557 iVideoPostCaptureViewConstructed = ETrue; |
|
7558 PRINT( _L("Camera <= \ |
|
7559 CCamAppUi::ConstructPostCaptureViewIfRequiredL \ |
|
7560 - VideoPostCapture") ); |
|
7561 } |
|
7562 } |
|
7563 else |
|
7564 { |
|
7565 // Still postcapture |
|
7566 if( !iStillPostCaptureViewConstructed ) |
|
7567 { |
|
7568 PRINT( _L("Camera => \ |
|
7569 CCamAppUi::ConstructPostCaptureViewIfRequiredL \ |
|
7570 - StillPostCapture") ); |
|
7571 view = CCamStillPostCaptureView::NewLC( iController ); |
|
7572 AddViewL( view ); |
|
7573 CleanupStack::Pop( view ); |
|
7574 iStillPostCaptureViewConstructed = ETrue; |
|
7575 PRINT( _L("Camera <= \ |
|
7576 CCamAppUi::ConstructPostCaptureViewIfRequiredL \ |
|
7577 - StillPostCapture") ); |
|
7578 } |
|
7579 } |
|
7580 } |
|
7581 } |
|
7582 |
|
7583 |
|
7584 #ifdef CAMERAAPP_DELAYED_POSTCAPTURE_CREATION |
|
7585 |
|
7586 // --------------------------------------------------------------------------- |
|
7587 // CCamAppUi::StartPostCapIdleL |
|
7588 // |
|
7589 // Starts calls to PostCapIdleCallBack during processor idle time. The calls |
|
7590 // are continued until PostCapIdleCallBack is done. |
|
7591 // |
|
7592 // --------------------------------------------------------------------------- |
|
7593 void CCamAppUi::StartPostCapIdleL() |
|
7594 { |
|
7595 if( !iPostCapIdle ) |
|
7596 { |
|
7597 iPostCapIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
7598 iPostCapProgress = ECamConstructStillPostCap; |
|
7599 iPostCapIdle->Start( TCallBack( PostCapIdleCallBack, this ) ); |
|
7600 } |
|
7601 else |
|
7602 { |
|
7603 // iPostCapIdle already exists. |
|
7604 // Do nothing - the views have already been constructed |
|
7605 } |
|
7606 } |
|
7607 |
|
7608 // --------------------------------------------------------------------------- |
|
7609 // CCamAppUi::PostCapIdleCallBack |
|
7610 // |
|
7611 // Handles postcapture view construction so that each call to this function |
|
7612 // constructs one postcapture view. Returns ETrue if there are still more views |
|
7613 // to construct, EFalse if all are finished and no further calls are required. |
|
7614 // |
|
7615 // --------------------------------------------------------------------------- |
|
7616 TInt CCamAppUi::PostCapIdleCallBack( TAny* aSelf ) |
|
7617 { |
|
7618 PRINT( _L("Camera => CCamAppUi::PostCapIdleCallBack") ); |
|
7619 TInt ret = EFalse; |
|
7620 |
|
7621 CCamAppUi* self = static_cast<CCamAppUi*>( aSelf ); |
|
7622 if( self ) |
|
7623 { |
|
7624 if( ECamConstructStillPostCap == self->iPostCapProgress ) |
|
7625 { |
|
7626 TRAP_IGNORE( self->ConstructPostCaptureViewIfRequiredL( |
|
7627 ECamViewStatePostCapture, ECamControllerImage ) ); |
|
7628 self->iPostCapProgress = ECamConstructBurstPostCap; |
|
7629 ret = ETrue; |
|
7630 } |
|
7631 else if( ECamConstructBurstPostCap == self->iPostCapProgress ) |
|
7632 { |
|
7633 TRAP_IGNORE( self->ConstructPostCaptureViewIfRequiredL( |
|
7634 ECamViewStateBurstThumbnail, ECamControllerImage ) ); |
|
7635 self->iPostCapProgress = ECamConstructVideoPostCap; |
|
7636 ret = ETrue; |
|
7637 } |
|
7638 else if( ECamConstructVideoPostCap == self->iPostCapProgress ) |
|
7639 { |
|
7640 TRAP_IGNORE( self->ConstructPostCaptureViewIfRequiredL( |
|
7641 ECamViewStatePostCapture, ECamControllerVideo ) ); |
|
7642 self->iPostCapProgress = ECamPostCapsDone; |
|
7643 // Complete |
|
7644 ret = EFalse; |
|
7645 } |
|
7646 } |
|
7647 |
|
7648 PRINT( _L("Camera <= CCamAppUi::PostCapIdleCallBack") ); |
|
7649 return ret; |
|
7650 } |
|
7651 |
|
7652 #endif // CAMERAAPP_DELAYED_POSTCAPTURE_CREATION |
|
7653 |
|
7654 |
|
7655 // --------------------------------------------------------------------------- |
|
7656 // CCamAppUi::StartSensorIdleL |
|
7657 // |
|
7658 // Initiates a call to SensorIdleCallback during processor idle time |
|
7659 // --------------------------------------------------------------------------- |
|
7660 // |
|
7661 void CCamAppUi::StartSensorIdleL() |
|
7662 { |
|
7663 if ( iController.UiConfigManagerPtr()->IsOrientationSensorSupported() ) |
|
7664 { |
|
7665 if( iSensorIdleRunning ) |
|
7666 { |
|
7667 // Delayed sensor initialization is already in progress |
|
7668 return; |
|
7669 } |
|
7670 |
|
7671 if( !iSensorIdle ) |
|
7672 { |
|
7673 // Instantiate new CIdle |
|
7674 iSensorIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
7675 } |
|
7676 else |
|
7677 { |
|
7678 // Cancel existing the existing request, just in case |
|
7679 iSensorIdle->Cancel(); |
|
7680 } |
|
7681 |
|
7682 // Initialize the idle callback |
|
7683 iSensorIdle->Start( TCallBack( SensorIdleCallBack, this ) ); |
|
7684 iSensorIdleRunning = ETrue; |
|
7685 } |
|
7686 } |
|
7687 |
|
7688 // --------------------------------------------------------------------------- |
|
7689 // CCamAppUi::CancelSensorIdle |
|
7690 // |
|
7691 // Cancels the (possibly) pending call to SensorIdleCallBack |
|
7692 // --------------------------------------------------------------------------- |
|
7693 // |
|
7694 void CCamAppUi::CancelSensorIdle() |
|
7695 { |
|
7696 if ( iController.UiConfigManagerPtr()->IsOrientationSensorSupported() ) |
|
7697 { |
|
7698 if( iSensorIdle && iSensorIdleRunning ) |
|
7699 { |
|
7700 iSensorIdle->Cancel(); |
|
7701 iSensorIdleRunning = EFalse; |
|
7702 } |
|
7703 } |
|
7704 } |
|
7705 |
|
7706 // --------------------------------------------------------------------------- |
|
7707 // CCamAppUi::SensorIdleCallBack |
|
7708 // |
|
7709 // Calls iControler.UpdateSensorApiL |
|
7710 // --------------------------------------------------------------------------- |
|
7711 // |
|
7712 TInt CCamAppUi::SensorIdleCallBack( TAny* aSelf ) |
|
7713 { |
|
7714 CCamAppUi* self = static_cast<CCamAppUi*>( aSelf ); |
|
7715 |
|
7716 if( self ) |
|
7717 { |
|
7718 TRAP_IGNORE( self->iController.UpdateSensorApiL( ETrue ) ); |
|
7719 self->iSensorIdleRunning = EFalse; |
|
7720 } |
|
7721 return EFalse; // No more calls needed |
|
7722 } |
|
7723 |
|
7724 |
|
7725 // --------------------------------------------------------------------------- |
|
7726 // CCamAppUi::IsSelfTimedCapture |
|
7727 // Whether the current capture was selftimer initiated |
|
7728 // --------------------------------------------------------------------------- |
|
7729 // |
|
7730 TBool CCamAppUi::IsSelfTimedCapture() const |
|
7731 { |
|
7732 return iSelfTimedCapture; |
|
7733 } |
|
7734 |
|
7735 // --------------------------------------------------------------------------- |
|
7736 // CCamAppUi::DismissMemoryNoteL |
|
7737 // Dismisses out of memory / memory card removed note, if active. |
|
7738 // --------------------------------------------------------------------------- |
|
7739 // |
|
7740 void |
|
7741 CCamAppUi::DismissMemoryNoteL() |
|
7742 { |
|
7743 if( iMemoryNote ) |
|
7744 { |
|
7745 if( iMemoryNote->IsFocused() ) |
|
7746 { |
|
7747 // For some reason, the note's softkeys are displayed in standby mode, |
|
7748 // even though the note itself has been dismissed (=deleted) |
|
7749 // HACK: |
|
7750 // If the note is focused, we know that also its softkeys are in use, |
|
7751 // so we can simulate key events to emulate user closing the note |
|
7752 // using left softkey. |
|
7753 |
|
7754 TKeyEvent key; |
|
7755 key.iRepeats = 0; |
|
7756 key.iCode = EKeyDevice0; |
|
7757 key.iModifiers = 0; |
|
7758 iEikonEnv->SimulateKeyEventL( key, EEventKeyDown ); |
|
7759 CEikButtonGroupContainer::Current()->OfferKeyEventL( key, |
|
7760 EEventKeyDown ); |
|
7761 } |
|
7762 |
|
7763 // Make sure the note closes even if it wasn't focused. |
|
7764 delete iMemoryNote; |
|
7765 iMemoryNote = NULL; |
|
7766 } |
|
7767 } |
|
7768 |
|
7769 |
|
7770 // --------------------------------------------------------------------------- |
|
7771 // Starts Gallery Application command line |
|
7772 // --------------------------------------------------------------------------- |
|
7773 // |
|
7774 |
|
7775 |
|
7776 void |
|
7777 CCamAppUi::StartAppCmdLineL( const TDes8& aData ) |
|
7778 { |
|
7779 // MM not running yet - use Command Line Tail |
|
7780 RApaLsSession appArcSession; |
|
7781 CleanupClosePushL( appArcSession ); |
|
7782 User::LeaveIfError( appArcSession.Connect() ); |
|
7783 TApaAppInfo appInfo; |
|
7784 User::LeaveIfError( appArcSession.GetAppInfo( appInfo, |
|
7785 TUid::Uid( KGlxGalleryApplicationUid) ) ); |
|
7786 |
|
7787 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
7788 cmdLine->SetExecutableNameL( appInfo.iFullName ); |
|
7789 cmdLine->SetCommandL( EApaCommandRun ); |
|
7790 cmdLine->SetTailEndL( aData ); |
|
7791 |
|
7792 User::LeaveIfError( appArcSession.StartApp( *cmdLine ) ); |
|
7793 |
|
7794 CleanupStack::PopAndDestroy( cmdLine ); |
|
7795 CleanupStack::PopAndDestroy( &appArcSession ); |
|
7796 } |
|
7797 // --------------------------------------------------------------------------- |
|
7798 // CCamAppUi::StartCheckingDefaultAlbumIdL() |
|
7799 // We start check operation to see if "Default Album exists" |
|
7800 // Usecase: Whenever the camera returns from background/startup we first start |
|
7801 // checking the default album which is set, if any, to make sure that album |
|
7802 // really exists. If not, then we set back the value of setting item "Add to |
|
7803 // album" to "No" in Image/Video setting image settings |
|
7804 // --------------------------------------------------------------------------- |
|
7805 // |
|
7806 void CCamAppUi::StartCheckingDefaultAlbumIdL() |
|
7807 { |
|
7808 TBool checkAlbum = ( |
|
7809 iController.IntegerSettingValue( |
|
7810 ECamSettingItemPhotoStoreInAlbum ) == ECamSettYes || |
|
7811 iController.IntegerSettingValue( |
|
7812 ECamSettingItemVideoStoreInAlbum ) == ECamSettYes ); |
|
7813 |
|
7814 if ( !iCheckOperationInProgress && checkAlbum ) |
|
7815 { |
|
7816 TUint32 defaultAlbumId = |
|
7817 static_cast<TUint32> ( |
|
7818 iController.IntegerSettingValue( |
|
7819 ECamSettingItemDefaultAlbumId ) ); |
|
7820 if ( iCollectionManager ) |
|
7821 { |
|
7822 iCheckOperationInProgress = ETrue; |
|
7823 iCollectionManager->CheckForAlbumExistenceL( defaultAlbumId ); |
|
7824 } |
|
7825 } |
|
7826 |
|
7827 } |
|
7828 |
|
7829 // --------------------------------------------------------------------------- |
|
7830 // CCamAppUi::CheckAlbumIdOperationCompleteL |
|
7831 // Call back method, which is called once the check operation is complete |
|
7832 // --------------------------------------------------------------------------- |
|
7833 // |
|
7834 void CCamAppUi::CheckAlbumIdOperationCompleteL( |
|
7835 TBool aAlbumExists, const TDesC& /*aAlbumTitle*/ ) |
|
7836 { |
|
7837 PRINT( _L("CCamAppUi::CheckAlbumIdOperationCompleteL --> ENTERS") ); |
|
7838 if ( iController.UiConfigManagerPtr()->IsPhotosSupported() ) |
|
7839 { |
|
7840 if ( iCheckOperationInProgress ) |
|
7841 { |
|
7842 PRINT( _L("CheckAlbumIdOperationCompleteL \ |
|
7843 iCheckOperationInProgress: ETRUE") ); |
|
7844 iCheckOperationInProgress = EFalse; |
|
7845 if ( !aAlbumExists ) |
|
7846 { |
|
7847 // Reset all the values to the default ones, |
|
7848 // if the default album doesnt exist, when returned from background |
|
7849 iController.SetIntegerSettingValueL( |
|
7850 ECamSettingItemPhotoStoreInAlbum, |
|
7851 ECamSettNo ); |
|
7852 iController.SetIntegerSettingValueL( |
|
7853 ECamSettingItemVideoStoreInAlbum, |
|
7854 ECamSettNo ); |
|
7855 // reseting the album id to the default value "0" |
|
7856 iController.SetIntegerSettingValueL( |
|
7857 ECamSettingItemDefaultAlbumId, |
|
7858 0 ); |
|
7859 } |
|
7860 } |
|
7861 } |
|
7862 PRINT( _L("CCamAppUi::CheckAlbumIdOperationCompleteL <-- EXITS") ); |
|
7863 } |
|
7864 |
|
7865 |
|
7866 // --------------------------------------------------------------------------- |
|
7867 // CCamAppUi::SettingsLaunchedFromCamera() |
|
7868 // We keep track of plugin event launched from camera |
|
7869 // --------------------------------------------------------------------------- |
|
7870 // |
|
7871 TBool CCamAppUi::SettingsLaunchedFromCamera() const |
|
7872 { |
|
7873 return iSettingsPluginLaunched; |
|
7874 } |
|
7875 |
|
7876 |
|
7877 // --------------------------------------------------------------------------- |
|
7878 // CCamAppUi::SettingsPluginExitedL |
|
7879 // We handle the case when settings plugin exists |
|
7880 // --------------------------------------------------------------------------- |
|
7881 // |
|
7882 void CCamAppUi::SettingsPluginExitedL( TCamSettingsPluginExitMessage aType ) |
|
7883 { |
|
7884 iSettingsPluginLaunched = EFalse; |
|
7885 iTargetViewState = ECamViewStatePreCapture; |
|
7886 TrySwitchViewL(); |
|
7887 |
|
7888 switch ( aType ) |
|
7889 { |
|
7890 case ECameraPluginExit: |
|
7891 { |
|
7892 // we exit the plugin and switch to pre-capture |
|
7893 iReturnedFromPlugin = ETrue; |
|
7894 break; |
|
7895 } |
|
7896 case ECameraInternalExit: |
|
7897 { |
|
7898 // Internal Exit from Plugin -> Options -> Exit |
|
7899 iReturnedFromPlugin = EFalse; |
|
7900 InternalExitL(); |
|
7901 break; |
|
7902 } |
|
7903 case ECameraCompleteExit: |
|
7904 { |
|
7905 // Plugiin -> End Key or "c" key |
|
7906 iReturnedFromPlugin = EFalse; |
|
7907 break; |
|
7908 } |
|
7909 } |
|
7910 PRINT( _L("Camera <= CCamAppUi::SettingsPluginExitedL") ); |
|
7911 } |
|
7912 |
|
7913 // --------------------------------------------------------------------------- |
|
7914 // CCamAppUi::StaticSettingsModel() |
|
7915 // |
|
7916 // Gets the handle to the settings model, which is used inturn by the |
|
7917 // plugin to call the interfaces for performing needed actions. |
|
7918 // --------------------------------------------------------------------------- |
|
7919 // |
|
7920 MCamStaticSettings& |
|
7921 CCamAppUi::StaticSettingsModel() |
|
7922 { |
|
7923 return iController.StaticSettingsModel(); |
|
7924 } |
|
7925 |
|
7926 // --------------------------------------------------------------------------- |
|
7927 // CCamAppUi::CreateNaviBitmapsL |
|
7928 // Draw the counter to the bitmap used in the navi pane |
|
7929 // --------------------------------------------------------------------------- |
|
7930 // |
|
7931 void |
|
7932 CCamAppUi::CreateNaviBitmapsL( TBool aDrawStorageIconAndCounter ) |
|
7933 { |
|
7934 if ( iNaviCounterModel ) |
|
7935 { |
|
7936 iNaviCounterModel->CreateNaviBitmapsL( aDrawStorageIconAndCounter ); |
|
7937 } |
|
7938 } |
|
7939 |
|
7940 // --------------------------------------------------------------------------- |
|
7941 // CCamAppUi::ReadyToDraw |
|
7942 // Checks whether its safe to draw controls |
|
7943 // --------------------------------------------------------------------------- |
|
7944 // |
|
7945 TBool CCamAppUi::ReadyToDraw() const |
|
7946 { |
|
7947 if ( AppInBackground( ETrue ) || !iView ) |
|
7948 { |
|
7949 return EFalse; |
|
7950 } |
|
7951 else |
|
7952 { |
|
7953 return ETrue; |
|
7954 } |
|
7955 } |
|
7956 |
|
7957 // --------------------------------------------------------------------------- |
|
7958 // CCamAppUi::StartFileNameCheck |
|
7959 // Checks whether the file name is deleted/renamed outside camera |
|
7960 // --------------------------------------------------------------------------- |
|
7961 // |
|
7962 void CCamAppUi::StartFileNameCheck() |
|
7963 { |
|
7964 PRINT( _L("Camera => CCamAppUi::StartFileNameCheck") ); |
|
7965 if( !iFileCheckAo->IsActive() ) |
|
7966 { |
|
7967 iFileCheckAo->Start(); |
|
7968 } |
|
7969 PRINT( _L("Camera <= CCamAppUi::StartFileNameCheck") ); |
|
7970 } |
|
7971 |
|
7972 |
|
7973 // --------------------------------------------------------------------------- |
|
7974 // CCamAppUi::FileCheckingComplete |
|
7975 // Handle a file checking complete event. Used to inform |
|
7976 // when filechecking active object. |
|
7977 // has finished checking existance of files. |
|
7978 // --------------------------------------------------------------------------- |
|
7979 // |
|
7980 void CCamAppUi::FileCheckingCompleteL( TInt aStatus, TInt aError ) |
|
7981 { |
|
7982 PRINT2( _L("Camera => CCamAppUi::FileCheckingComplete(), \ |
|
7983 aStatus=%d, aError=%d "), aStatus, aError ) |
|
7984 |
|
7985 if( aStatus <= 0 || KErrNone != aError ) |
|
7986 { |
|
7987 PRINT( _L("Camera <> CCamAppUi::FileCheckingComplete: \ |
|
7988 all files deleted, trying viewswitch") ); |
|
7989 iTargetViewState = ECamViewStatePreCapture; |
|
7990 TrySwitchViewL( ETrue ); |
|
7991 } |
|
7992 else if ( aStatus < iController.BurstCaptureArray()->Count() ) |
|
7993 { |
|
7994 PRINT2( _L("Camera <> CCamAppUi::FileCheckingComplete: %d < %d,\ |
|
7995 some file(s) have been deleted"), |
|
7996 aStatus, |
|
7997 iController.BurstCaptureArray()->Count() ); |
|
7998 |
|
7999 if ( iViewState == ECamViewStateBurstThumbnail || iViewState == ECamViewStatePostCapture ) |
|
8000 { |
|
8001 PRINT( _L("Camera <> CCamAppUi::FileCheckingComplete() updating thumbnail view") ); |
|
8002 CCamBurstThumbnailView* thumbnailView = |
|
8003 static_cast<CCamBurstThumbnailView*>( View( TUid::Uid( ECamViewIdBurstThumbnail ) ) ); |
|
8004 |
|
8005 if ( thumbnailView ) |
|
8006 { |
|
8007 thumbnailView->ImageFilesDeleted(); |
|
8008 } |
|
8009 |
|
8010 if ( iViewState == ECamViewStatePostCapture ) |
|
8011 { |
|
8012 // view state is post-capture, check if the image currently viewed has been deleted |
|
8013 if ( iController.BurstCaptureArray()->IsDeleted( iController.CurrentImageIndex() ) ) |
|
8014 { |
|
8015 //switch back to burst thumbnail view |
|
8016 HandleCommandL( EAknSoftkeyBack ); |
|
8017 } |
|
8018 |
|
8019 } |
|
8020 } |
|
8021 } |
|
8022 |
|
8023 //When return to video post capture view from background, we need to determine whether show the toolbar |
|
8024 if( iReturnFromBackground |
|
8025 && iViewState == ECamViewStatePostCapture |
|
8026 && iMode == ECamControllerVideo ) |
|
8027 { |
|
8028 SetToolbarVisibility(); |
|
8029 } |
|
8030 |
|
8031 PRINT( _L("Camera <= CCamAppUi::FileCheckingComplete()") ); |
|
8032 } |
|
8033 |
|
8034 // --------------------------------------------------------------------------- |
|
8035 // CCamAppUi::HandleSelfTimerEvent |
|
8036 // Handle self-timer event |
|
8037 // --------------------------------------------------------------------------- |
|
8038 // |
|
8039 void CCamAppUi::HandleSelfTimerEvent( TCamSelfTimerEvent aEvent, |
|
8040 TInt aCountDown ) |
|
8041 { |
|
8042 #if defined( CAMERAAPP_CAPI_V2_DVF ) |
|
8043 TRAP_IGNORE( HandleCommandL( ECamCmdRedrawScreen ) ); |
|
8044 #else |
|
8045 (void) aEvent; |
|
8046 (void) aCountDown; |
|
8047 #endif // CAMERAAPP_CAPI_V2_DVF |
|
8048 } |
|
8049 |
|
8050 // --------------------------------------------------------------------------- |
|
8051 // CCamAppUi::RequestedNewFileResolution |
|
8052 // Set the requested resolution for a new file |
|
8053 // --------------------------------------------------------------------------- |
|
8054 // |
|
8055 void CCamAppUi::SetRequestedNewFileResolution( |
|
8056 const TSize& aRequestedResolution ) |
|
8057 { |
|
8058 iRequestedNewFileResolution.SetSize( |
|
8059 aRequestedResolution.iWidth, |
|
8060 aRequestedResolution.iHeight ); |
|
8061 } |
|
8062 |
|
8063 // --------------------------------------------------------------------------- |
|
8064 // CCamAppUi::RequestedNewFileResolution |
|
8065 // Get the requested resolution for a new file |
|
8066 // --------------------------------------------------------------------------- |
|
8067 // |
|
8068 TSize CCamAppUi::RequestedNewFileResolution() const |
|
8069 { |
|
8070 // Default is TSize(0, 0) which interpreted as MMS quality resolution |
|
8071 return iRequestedNewFileResolution; |
|
8072 } |
|
8073 |
|
8074 // --------------------------------------------------------------------------- |
|
8075 // CCamAppUi::SetToolbarVisibility |
|
8076 // Set toolbar visibility in according to whether current view and |
|
8077 // mode are fit. When embedded camera starts up, view and mode may |
|
8078 // not be fit. |
|
8079 // --------------------------------------------------------------------------- |
|
8080 // |
|
8081 void CCamAppUi::SetToolbarVisibility() |
|
8082 { |
|
8083 // fixed toolbar is used only with touch devices |
|
8084 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
8085 if ( iController.IsTouchScreenSupported() && fixedToolbar ) |
|
8086 { |
|
8087 if ( IsEmbedded() ) |
|
8088 { |
|
8089 // Check that iMode matches iTargetMode and that the corresponding |
|
8090 // view is active. |
|
8091 if ( iMode == iTargetMode && |
|
8092 ( ( iMode == ECamControllerVideo && iView == iVideoCaptureView ) || |
|
8093 ( iMode == ECamControllerImage && iView == iStillCaptureView ) ) ) |
|
8094 { |
|
8095 fixedToolbar->SetToolbarVisibility( ETrue ); |
|
8096 } |
|
8097 else |
|
8098 { |
|
8099 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
8100 } |
|
8101 } |
|
8102 else |
|
8103 { |
|
8104 if( (iPreCaptureMode != ECamPreCapCaptureSetup) && |
|
8105 (iPreCaptureMode != ECamPreCapGenericSetting) && |
|
8106 (iPreCaptureMode != ECamPreCapSceneSetting ) ) |
|
8107 { |
|
8108 fixedToolbar->SetToolbarVisibility( ETrue ); |
|
8109 } |
|
8110 else |
|
8111 { |
|
8112 // No toolbar with the settings view |
|
8113 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
8114 } |
|
8115 } |
|
8116 } |
|
8117 } |
|
8118 |
|
8119 // --------------------------------------------------------------------------- |
|
8120 // CCamAppUi::SubmergeToolbar |
|
8121 // Hide toolbar if needed. |
|
8122 // --------------------------------------------------------------------------- |
|
8123 // |
|
8124 void CCamAppUi::SubmergeToolbar() |
|
8125 { |
|
8126 PRINT( _L("Camera => CCamAppUi::SubmergeToolbar()") ); |
|
8127 // fixed toolbar is used only with touch devices |
|
8128 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
8129 if ( iController.IsTouchScreenSupported() && fixedToolbar ) |
|
8130 { |
|
8131 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
8132 } |
|
8133 PRINT( _L("Camera <= CCamAppUi::SubmergeToolbar()") ); |
|
8134 } |
|
8135 |
|
8136 // --------------------------------------------------------------------------- |
|
8137 // Check if it's applicable to use the courtesy UI |
|
8138 // --------------------------------------------------------------------------- |
|
8139 // |
|
8140 TBool CCamAppUi::CourtesyUiApplies() const |
|
8141 { |
|
8142 return ( ECamCapturing != iController.CurrentVideoOperation() |
|
8143 && ECamPaused != iController.CurrentVideoOperation() |
|
8144 && !SelfTimerEnabled() |
|
8145 && ( ECamOrientationCamcorder == iCamOrientation || |
|
8146 ECamOrientationCamcorderLeft == iCamOrientation || |
|
8147 ECamOrientationPortrait == iCamOrientation ) ); |
|
8148 } |
|
8149 |
|
8150 // ----------------------------------------------------------------------------- |
|
8151 // CCamAppUi::IsToolBarVisible |
|
8152 // Returns whether or the tool bar has been activated |
|
8153 // Will return ETrue when when the tool bar is active |
|
8154 // ----------------------------------------------------------------------------- |
|
8155 // |
|
8156 TBool CCamAppUi::IsToolBarVisible() const |
|
8157 { |
|
8158 PRINT1( _L("Camera => CCamAppUi::IsToolBarVisible %d" ), iToolbarVisibility ) |
|
8159 return iToolbarVisibility; |
|
8160 } |
|
8161 |
|
8162 |
|
8163 // ----------------------------------------------------------------------------- |
|
8164 // CCamAppUi::SetAssumePostCaptureView |
|
8165 // Sets iAssumePostCapture flag according to aValue |
|
8166 // ----------------------------------------------------------------------------- |
|
8167 // |
|
8168 void CCamAppUi::SetAssumePostCaptureView( TBool aValue ) |
|
8169 { |
|
8170 if ( iView |
|
8171 && ( iStillCaptureView == iView || iVideoCaptureView == iView ) ) |
|
8172 { |
|
8173 static_cast<CCamPreCaptureViewBase*>( iView )->SetPostCaptureViewAsumption( aValue ); |
|
8174 } |
|
8175 } |
|
8176 |
|
8177 // --------------------------------------------------------------------------- |
|
8178 // CCamAppUi::SetDrawPreCaptureCourtesyUI |
|
8179 // Set iDrawPreCaptureCourtesyUI flag |
|
8180 // --------------------------------------------------------------------------- |
|
8181 // |
|
8182 void CCamAppUi::SetDrawPreCaptureCourtesyUI(TBool iDraw) |
|
8183 { |
|
8184 if( iDraw ) |
|
8185 { |
|
8186 iDrawPreCaptureCourtesyUI = ETrue; |
|
8187 } |
|
8188 else |
|
8189 { |
|
8190 iDrawPreCaptureCourtesyUI = EFalse; |
|
8191 } |
|
8192 } |
|
8193 |
|
8194 // ----------------------------------------------------------------------------- |
|
8195 // CCamAppUi::IsMemoryFullOrUnavailable |
|
8196 // ----------------------------------------------------------------------------- |
|
8197 // |
|
8198 TBool |
|
8199 CCamAppUi::IsMemoryFullOrUnavailable(const TCamMediaStorage |
|
8200 aStorageLocation) const |
|
8201 { |
|
8202 if(!iController.IsMemoryAvailable(aStorageLocation)) |
|
8203 return ETrue; |
|
8204 |
|
8205 if(iMode == ECamControllerImage) |
|
8206 { |
|
8207 TInt availableMemoryUnits = 0; |
|
8208 availableMemoryUnits = |
|
8209 iController.ImagesRemaining(aStorageLocation,EFalse); |
|
8210 return (availableMemoryUnits <= 0); |
|
8211 } |
|
8212 else if(iMode == ECamControllerVideo) |
|
8213 { |
|
8214 TTimeIntervalMicroSeconds timeLeft = 0; |
|
8215 TRAPD(err,timeLeft = |
|
8216 iController. |
|
8217 CalculateVideoTimeRemainingL(aStorageLocation);); |
|
8218 if(err) |
|
8219 timeLeft = 0; |
|
8220 return (timeLeft < KMemoryFullVideoRemaining); |
|
8221 } |
|
8222 return ETrue; |
|
8223 } |
|
8224 |
|
8225 // ----------------------------------------------------------------------------- |
|
8226 // CCamAppUi::AllMemoriesFullOrUnavailable |
|
8227 // ----------------------------------------------------------------------------- |
|
8228 // |
|
8229 TBool CCamAppUi::AllMemoriesFullOrUnavailable() const |
|
8230 { |
|
8231 return ( IsMemoryFullOrUnavailable(ECamMediaStoragePhone) && |
|
8232 IsMemoryFullOrUnavailable(ECamMediaStorageCard) && |
|
8233 IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage) ); |
|
8234 } |
|
8235 |
|
8236 |
|
8237 // --------------------------------------------------------- |
|
8238 // CCamAppUi::AppUIConstructCallbackL |
|
8239 // |
|
8240 // --------------------------------------------------------- |
|
8241 // |
|
8242 TInt CCamAppUi::AppUIConstructCallbackL( TAny* aAny ) |
|
8243 { |
|
8244 PRINT( _L("Camera => CCamAppUi::AppUIConstructCallbackL") ) |
|
8245 CCamAppUi* appui = static_cast<CCamAppUi*>( aAny ); |
|
8246 __ASSERT_DEBUG( appui != NULL && appui->iWaitTimer != NULL, CamPanic( ECamPanicNullPointer ) ); |
|
8247 appui->iWaitTimer->Cancel(); |
|
8248 if ( !appui->IsUiConstructionComplete() ) |
|
8249 { |
|
8250 appui->CompleteAppUIConstructionL(); |
|
8251 } |
|
8252 PRINT( _L("Camera <= CCamAppUi::AppUIConstructCallbackL") ) |
|
8253 return KErrNone; |
|
8254 } |
|
8255 |
|
8256 // --------------------------------------------------------- |
|
8257 // CCamAppUi::CompleteAppUIConstructionL |
|
8258 // |
|
8259 // --------------------------------------------------------- |
|
8260 // |
|
8261 void CCamAppUi::CompleteAppUIConstructionL() |
|
8262 { |
|
8263 PRINT( _L("Camera => CCamAppUi::CompleteAppUIConstructionL") ) |
|
8264 iUiConstructionComplete = ETrue; |
|
8265 // Load the settings model static settings |
|
8266 PRINT( _L("Camera <> call CCamAppController::LoadStaticSettingsL..") ) |
|
8267 iController.LoadStaticSettingsL( IsEmbedded() ); |
|
8268 |
|
8269 /*#ifndef __WINSCW__ |
|
8270 if ( !iSFIUtils ) |
|
8271 { |
|
8272 // Initialize SFIUtils |
|
8273 iSFIUtils = CSFIUtilsAppInterface::NewL(); |
|
8274 iSendFileInCall = EFalse; |
|
8275 PRINT( _L("iSendFileInCall = EFalse") ); |
|
8276 } |
|
8277 #endif */ |
|
8278 |
|
8279 // Create text resolver for error note text |
|
8280 iTextResolver = CTextResolver::NewL(); |
|
8281 |
|
8282 ConstructPreCaptureViewsL(); |
|
8283 |
|
8284 iSelfTimer = CCamSelfTimer::NewL( iController ); |
|
8285 #if defined( CAMERAAPP_CAPI_V2_DVF ) |
|
8286 iSelfTimer->AddObserverL( this ); |
|
8287 #endif // CAMERAAPP_CAPI_V2_DVF |
|
8288 |
|
8289 PRINT( _L("Camera <> creating navicounter model") ); |
|
8290 iNaviCounterModel = CCamNaviCounterModel::NewL( iController ); |
|
8291 PRINT( _L("Camera <> append navicounter to resourceloaders") ); |
|
8292 User::LeaveIfError( iResourceLoaders.Append(iNaviCounterModel) ); |
|
8293 |
|
8294 PRINT( _L("Camera <> creating progress bar model") ); |
|
8295 iNaviProgressBarModel = CCamNaviProgressBarModel::NewL( iController ); |
|
8296 PRINT( _L("Camera <> append progressbar to resourceloaders") ); |
|
8297 User::LeaveIfError(iResourceLoaders.Append(iNaviProgressBarModel)); |
|
8298 |
|
8299 ConstructNaviPaneL(); |
|
8300 |
|
8301 //always start in stillmode |
|
8302 SetDefaultViewL( *iStillCaptureView ); |
|
8303 |
|
8304 // pre-construct side-pane & zoom pane |
|
8305 // get whether we overlay sidepane over view-finder |
|
8306 TBool overlayViewFinder; |
|
8307 User::LeaveIfError( CamUtility::GetPsiInt( ECamPsiOverLaySidePane, overlayViewFinder ) ); |
|
8308 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL create sidepane") ); |
|
8309 iCamSidePane = CCamSidePane::NewL( iController, overlayViewFinder ); |
|
8310 User::LeaveIfError(iResourceLoaders.Append(iCamSidePane)); |
|
8311 |
|
8312 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL create zoom pane") ); |
|
8313 iCamZoomPane = CCamZoomPane::NewL( iController, overlayViewFinder ); |
|
8314 User::LeaveIfError(iResourceLoaders.Append(iCamZoomPane)); |
|
8315 |
|
8316 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL create doc handler") ); |
|
8317 iDocHandler = CDocumentHandler::NewL( CEikonEnv::Static()->Process() ); |
|
8318 |
|
8319 // Check to see if we are set to use mmc storage but the card has |
|
8320 // been removed. |
|
8321 if( iController.CheckMemoryToUseL() ) |
|
8322 { |
|
8323 // Record that we need to show the mmc removal note when the ui is |
|
8324 // ready. |
|
8325 iMMCRemoveNoteRequired = ETrue; |
|
8326 } |
|
8327 |
|
8328 // create navi-pane and navi-porgress bar for use in camcorder mode |
|
8329 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL create navicounter control") ); |
|
8330 iNaviCounterControl = CCamNaviCounterControl::NewL( *iNaviCounterModel ); |
|
8331 iNaviCounterControl->SetExtentToWholeScreen(); |
|
8332 |
|
8333 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL create progress bar control") ); |
|
8334 iNaviProgressBarControl = CCamNaviProgressBarControl::NewL( *iNaviProgressBarModel ); |
|
8335 |
|
8336 // get max num of images for burst capture |
|
8337 CamUtility::GetPsiInt( ECamPsiMaxBurstCapture, iMaxBurstCaptureNum ); |
|
8338 |
|
8339 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL create AP handler") ); |
|
8340 iActivePaletteHandler = CCamActivePaletteHandler::NewL( iController, EFalse ); |
|
8341 |
|
8342 // get coutesy UI timeout |
|
8343 TInt timeoutValue; |
|
8344 CamUtility::GetPsiInt( ECamPsiCourtesyUiTimeoutValue, timeoutValue ); |
|
8345 |
|
8346 iCourtesyTimer = CCamTimer::NewL( timeoutValue * 1000000, |
|
8347 TCallBack( CCamAppUi::CourtesyTimeout, this ) ); |
|
8348 |
|
8349 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL update navi models") ); |
|
8350 UpdateNaviModelsL(); |
|
8351 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL navi counter reload resources") ); |
|
8352 iNaviCounterModel->ReloadResourceDataL(); |
|
8353 PRINT( _L("Camera <> CCamAppUi::CompleteAppUIConstructionL navi progress bar reload resources") ); |
|
8354 iNaviProgressBarModel->ReloadResourceDataL(); |
|
8355 |
|
8356 iFileCheckAo = CCamFileCheckAo::NewL( iController, *this ); |
|
8357 iCollectionManager = new (ELeave) CCamCollectionManagerAO( *this ); |
|
8358 |
|
8359 //iStillCaptureView->Container()->MakeVisible( ETrue ); |
|
8360 ActivateLocalViewL( iStillCaptureView->Id() ); |
|
8361 |
|
8362 StartCheckingDefaultAlbumIdL(); |
|
8363 PRINT( _L("Camera <= CCamAppUi::CompleteAppUIConstructionL") ) |
|
8364 } |
|
8365 |
|
8366 // --------------------------------------------------------- |
|
8367 // CCamAppUi::IsUiConstructionComplete() |
|
8368 // |
|
8369 // --------------------------------------------------------- |
|
8370 // |
|
8371 TBool CCamAppUi::IsUiConstructionComplete() |
|
8372 { |
|
8373 return iUiConstructionComplete; |
|
8374 } |
|
8375 |
|
8376 // ----------------------------------------------------------------------------- |
|
8377 // CCamAppUi::SetLensCoverExit |
|
8378 // Sets iLensCoverExit flag according to aValue |
|
8379 // ----------------------------------------------------------------------------- |
|
8380 // |
|
8381 void CCamAppUi::SetLensCoverExit( TBool aValue ) |
|
8382 { |
|
8383 iLensCoverExit = aValue; |
|
8384 } |
|
8385 |
|
8386 // ----------------------------------------------------------------------------- |
|
8387 // CCamAppUi::SetViewFinderStoppedStatus |
|
8388 // set whether camera viewfinder stop or not |
|
8389 // @param aViewFinderStopped ETrue viewfinder is stoped,EFalse viewfinder is runing |
|
8390 // ----------------------------------------------------------------------------- |
|
8391 // |
|
8392 void CCamAppUi::SetViewFinderStoppedStatus( TBool aViewFinderStopped ) |
|
8393 { |
|
8394 iViewFinderStopped = aViewFinderStopped; |
|
8395 } |
|
8396 |
|
8397 // ----------------------------------------------------------------------------- |
|
8398 // CCamAppUi::IsViewFinderInTransit |
|
8399 // ----------------------------------------------------------------------------- |
|
8400 // |
|
8401 TBool CCamAppUi::IsViewFinderInTransit() |
|
8402 { |
|
8403 return iViewFinderInTransit; |
|
8404 } |
|
8405 |
|
8406 // ----------------------------------------------------------------------------- |
|
8407 // CCamAppUi::SetViewFinderInTransit |
|
8408 // ----------------------------------------------------------------------------- |
|
8409 // |
|
8410 void CCamAppUi::SetViewFinderInTransit(TBool aInTransit) |
|
8411 { |
|
8412 iViewFinderInTransit = aInTransit; |
|
8413 } |
|
8414 // End of File |