1 /* |
|
2 * Copyright (c) 2007-2010 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: Side Pane control* |
|
15 */ |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <aknview.h> |
|
20 |
|
21 #include <eikenv.h> |
|
22 #include <eikappui.h> // For CCoeAppUiBase |
|
23 #include <eikapp.h> // For CEikApplication |
|
24 |
|
25 #include <barsc.h> |
|
26 #include <barsread.h> |
|
27 #include <cameraapp.rsg> |
|
28 #include <vgacamsettings.rsg> |
|
29 #include <aknlayoutscalable_apps.cdl.h> |
|
30 #include <layoutmetadata.cdl.h> |
|
31 #include "CamAppUiBase.h" |
|
32 #include "CamAppUi.h" |
|
33 |
|
34 #include "CamAppController.h" |
|
35 #include "CamSidePane.h" |
|
36 |
|
37 #include "CamIndicator.h" |
|
38 #include "CamIndicatorData.h" |
|
39 #include "CamIndicatorResourceReader.h" |
|
40 #include "CamTimer.h" |
|
41 #include "CamSelfTimer.h" |
|
42 #include "CamLogger.h" |
|
43 #include "CamSettings.hrh" |
|
44 #include "CamUtility.h" |
|
45 #include "CameraUiConfigManager.h" |
|
46 #include "Cam.hrh" |
|
47 |
|
48 |
|
49 // CONSTANTS |
|
50 |
|
51 |
|
52 // ================= MEMBER FUNCTIONS ======================= |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CCamSidePane::NewL |
|
56 // Symbian OS two-phased constructor |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CCamSidePane* CCamSidePane::NewL( CCamAppController& aController, |
|
60 TBool aOverlayViewFinder ) |
|
61 { |
|
62 CCamSidePane* self = new( ELeave ) CCamSidePane( aController, |
|
63 aOverlayViewFinder ); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // Destructor |
|
71 CCamSidePane::~CCamSidePane() |
|
72 { |
|
73 PRINT( _L("Camera => ~CCamSidePane") ); |
|
74 RemoveObservers(); |
|
75 CCamSidePane::UnloadResourceData(); |
|
76 PRINT( _L("Camera <= ~CCamSidePane") ); |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------- |
|
80 // CCamSidePane::ConstructL |
|
81 // Symbian OS 2nd phase constructor |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 void CCamSidePane::ConstructL() |
|
85 { |
|
86 PRINT( _L("Camera => CCamSidePane::ConstructL") ); |
|
87 LoadResourceDataL(); |
|
88 |
|
89 // side pane is a controller, self timer and burst mode observer |
|
90 RegisterObserversL(); |
|
91 iVisible = ETrue; |
|
92 |
|
93 UpdateLayout(); |
|
94 PRINT( _L("Camera <= CCamSidePane::ConstructL") ); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CCamSidePane::LoadResourceDataL() |
|
99 // Reads in all information needed from resources |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CCamSidePane::LoadResourceDataL() |
|
103 { |
|
104 TResourceReader reader; |
|
105 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
106 eikEnv->CreateResourceReaderLC( reader, ROID(R_CAM_SIDEPANE_ID)); |
|
107 |
|
108 // create reader |
|
109 CCamIndicatorResourceReader* resourceReader = |
|
110 CCamIndicatorResourceReader::NewLC( reader ); |
|
111 // get indicator data from reader |
|
112 CArrayPtrFlat<CCamIndicatorData>& indArray = resourceReader->IndicatorData(); |
|
113 |
|
114 // set up indicator data |
|
115 TInt numindicators = indArray.Count(); // number of indicators |
|
116 TInt numbitmaps = 0; |
|
117 CCamIndicator* indicator = NULL; |
|
118 |
|
119 TInt i = 0; |
|
120 |
|
121 for ( i = 0; i < ECamIndicatorTotal; i++ ) |
|
122 { |
|
123 User::LeaveIfError( iIndicators.Append( static_cast<CCamIndicator*>(NULL) ) ); |
|
124 } |
|
125 |
|
126 for ( i = 0; i < numindicators; i++ ) |
|
127 { |
|
128 CCamIndicatorData& indData = *( indArray.At( i ) ); |
|
129 indicator = CCamIndicator::NewL( indData.IndicatorRect() ); |
|
130 CleanupStack::PushL( indicator ); |
|
131 numbitmaps = indData.IndicatorBitmapCount(); // no of bitmaps for indicator |
|
132 TInt j; |
|
133 for ( j = 0; j < numbitmaps; j++ ) |
|
134 { |
|
135 // side pane assumes that mask bitmap is defined after the |
|
136 // normal one in the resource file |
|
137 indicator->AddIconL( indData.IndicatorBitmapId( j ), // bitmap |
|
138 indData.IndicatorBitmapId( j + 1 )); // mask |
|
139 j++; // increment past the mask |
|
140 } |
|
141 iIndicators[indData.IndicatorId()] = indicator; |
|
142 CleanupStack::Pop( indicator ); |
|
143 } |
|
144 |
|
145 CleanupStack::PopAndDestroy( resourceReader ); |
|
146 CleanupStack::PopAndDestroy(); // reader |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CCamSidePane::ReloadResourceDataL() |
|
151 // Refreshes all resource-based information stored in the class |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CCamSidePane::ReloadResourceDataL() |
|
155 { |
|
156 UnloadResourceData(); |
|
157 LoadResourceDataL(); |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CCamSidePane::UnloadResourceData() |
|
162 // Frees all dynamic resources allocated in LoadResourceDataL |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CCamSidePane::UnloadResourceData() |
|
166 { |
|
167 iIndicators.ResetAndDestroy(); |
|
168 iIndicators.Close(); |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CCamSidePane::CCamSidePane |
|
173 // C++ constructor |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 CCamSidePane::CCamSidePane( CCamAppController& aController, |
|
177 TBool aOverlayViewFinder ) |
|
178 : iController( aController ), |
|
179 iOverlayViewFinder( aOverlayViewFinder ) |
|
180 { |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------- |
|
184 // CCamSidePane::HandleControllerEventL |
|
185 // Handle an event from CCamAppController. |
|
186 // --------------------------------------------------------- |
|
187 // |
|
188 void CCamSidePane::HandleControllerEventL( |
|
189 TCamControllerEvent aEvent, TInt /* aError */ ) |
|
190 { |
|
191 switch ( aEvent ) |
|
192 { |
|
193 case ECamEventFlashStateChanged: |
|
194 { |
|
195 if ( iIndicators[ECamIndicatorFlash] |
|
196 && iMode != ECamControllerVideo |
|
197 && !IsSecondaryCameraEnabled() |
|
198 ) |
|
199 { |
|
200 TCamFlashId flash = static_cast< TCamFlashId > |
|
201 ( iController.IntegerSettingValue( ECamSettingItemDynamicPhotoFlash ) ); |
|
202 switch ( flash ) |
|
203 { |
|
204 case ECamFlashAuto: |
|
205 { |
|
206 iIndicators[ECamIndicatorFlash]->SetIcon( 0 ); |
|
207 } |
|
208 break; |
|
209 case ECamFlashOff: |
|
210 { |
|
211 iIndicators[ECamIndicatorFlash]->SetIcon( 2 ); |
|
212 } |
|
213 break; |
|
214 case ECamFlashAntiRedEye: |
|
215 { |
|
216 iIndicators[ECamIndicatorFlash]->SetIcon( 4 ); |
|
217 } |
|
218 break; |
|
219 case ECamFlashForced: |
|
220 { |
|
221 iIndicators[ECamIndicatorFlash]->SetIcon( 6 ); |
|
222 } |
|
223 break; |
|
224 default: |
|
225 break; |
|
226 } |
|
227 iIndicators[ECamIndicatorFlash]->SetFlashing( EFalse ); |
|
228 } |
|
229 else |
|
230 { |
|
231 // empty statement to remove Lint error. |
|
232 } |
|
233 |
|
234 if ( iController.UiConfigManagerPtr()->IsVideoLightSupported() ) |
|
235 { |
|
236 if ( iIndicators[ECamIndicatorVideoFlash] |
|
237 && iMode == ECamControllerVideo |
|
238 && !IsSecondaryCameraEnabled() |
|
239 ) |
|
240 { |
|
241 TCamFlashId flash = static_cast< TCamFlashId > |
|
242 ( iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) ); |
|
243 switch ( flash ) |
|
244 { |
|
245 case ECamFlashOff: |
|
246 { |
|
247 iIndicators[ECamIndicatorVideoFlash]->SetIcon( 0 ); |
|
248 } |
|
249 break; |
|
250 case ECamFlashForced: |
|
251 { |
|
252 iIndicators[ECamIndicatorVideoFlash]->SetIcon( 2 ); |
|
253 } |
|
254 break; |
|
255 default: |
|
256 break; |
|
257 } |
|
258 iIndicators[ECamIndicatorVideoFlash]->SetFlashing( EFalse ); |
|
259 } |
|
260 else |
|
261 { |
|
262 // empty statement to remove Lint error. |
|
263 } |
|
264 } |
|
265 } // end case statement |
|
266 break; |
|
267 case ECamEventSceneStateChanged: |
|
268 { |
|
269 if ( iMode == ECamControllerVideo ) |
|
270 { |
|
271 SetVideoSceneIndicator(); |
|
272 } |
|
273 else |
|
274 { |
|
275 SetPhotoSceneIndicator(); |
|
276 } |
|
277 } |
|
278 break; |
|
279 |
|
280 case ECamEventCameraChanged: |
|
281 { |
|
282 if ( !IsSecondaryCameraEnabled() ) |
|
283 { |
|
284 if ( iMode == ECamControllerVideo ) |
|
285 { |
|
286 SetVideoSceneIndicator(); |
|
287 if ( !iController.UiConfigManagerPtr()->IsVideoLightSupported() ) |
|
288 { |
|
289 if ( iIndicators[ECamIndicatorFlash] ) |
|
290 { |
|
291 iIndicators[ECamIndicatorFlash]->ClearIcon(); |
|
292 } |
|
293 } |
|
294 } |
|
295 else |
|
296 { |
|
297 SetPhotoSceneIndicator(); |
|
298 if ( !iController.UiConfigManagerPtr()->IsVideoLightSupported() ) |
|
299 { |
|
300 if ( iIndicators[ECamIndicatorFlash] ) |
|
301 { |
|
302 iIndicators[ECamIndicatorFlash]->DisplayIcon(); |
|
303 } |
|
304 } |
|
305 } |
|
306 } |
|
307 } |
|
308 break; |
|
309 |
|
310 #ifdef PRODUCT_USES_GENERIC_SETUP_INDICATOR |
|
311 #ifndef PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR |
|
312 case ECamEventSetupStateChanged: |
|
313 { |
|
314 SetGenericSetupIndicator(); |
|
315 } |
|
316 break; |
|
317 #endif // !PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR |
|
318 #endif // PRODUCT_USES_GENERIC_SETUP_INDICATOR |
|
319 |
|
320 case ECamEventVideoStabChanged: |
|
321 { |
|
322 if ( iController.UiConfigManagerPtr()->IsVideoStabilizationSupported() ) |
|
323 { |
|
324 SetVideoStabilisationIndicator(); |
|
325 } |
|
326 break; |
|
327 } |
|
328 |
|
329 case ECamEventFaceTrackingStateChanged: |
|
330 { |
|
331 if ( iController.UiConfigManagerPtr()->IsFaceTrackingSupported() ) |
|
332 { |
|
333 SetFaceTrackingIndicator(); |
|
334 } |
|
335 break; |
|
336 } |
|
337 |
|
338 default: |
|
339 break; |
|
340 } |
|
341 } |
|
342 |
|
343 |
|
344 // ----------------------------------------------------------------------------- |
|
345 // CCamSidePane::IsVisible |
|
346 // Is the side pane invisible |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 TBool CCamSidePane::IsVisible() |
|
350 { |
|
351 return iVisible; |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CCamSidePane::MakeVisible |
|
356 // Makes the side pane visible |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 void CCamSidePane::MakeVisible( TBool aVisible ) |
|
360 { |
|
361 iVisible = aVisible; |
|
362 } |
|
363 |
|
364 // ---------------------------------------------------- |
|
365 // CCamSidePane::Draw |
|
366 // Draws side pane indicators |
|
367 // ---------------------------------------------------- |
|
368 // |
|
369 void CCamSidePane::Draw( CBitmapContext& aGc ) const |
|
370 { |
|
371 // if not overlaying the viewfinder then |
|
372 // just clear the side pane area |
|
373 if ( !iOverlayViewFinder ) |
|
374 { |
|
375 aGc.Clear( iRect ); |
|
376 } |
|
377 TInt numIndicators = iIndicators.Count(); |
|
378 TInt i; |
|
379 |
|
380 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
381 |
|
382 if ( appUi ) |
|
383 { |
|
384 appUi->DrawPreCaptureCourtesyUI(); |
|
385 } |
|
386 |
|
387 for ( i = 0; i < numIndicators; i++ ) |
|
388 { |
|
389 if ( iIndicators[i] ) |
|
390 { |
|
391 iIndicators[i]->Draw( aGc ); |
|
392 } |
|
393 } |
|
394 } |
|
395 |
|
396 |
|
397 // ---------------------------------------------------- |
|
398 // CCamSidePane::SetRect |
|
399 // Sets rect to draw into |
|
400 // ---------------------------------------------------- |
|
401 // |
|
402 void |
|
403 CCamSidePane::SetRect( TRect& aRect ) |
|
404 { |
|
405 iRect.SetRect( aRect.iTl, aRect.iBr ); |
|
406 } |
|
407 |
|
408 |
|
409 // ---------------------------------------------------- |
|
410 // CCamSidePane::SetCaptureMode |
|
411 // Sets rect to draw into |
|
412 // ---------------------------------------------------- |
|
413 // |
|
414 void |
|
415 CCamSidePane::SetCaptureMode( TCamCameraMode aMode ) |
|
416 { |
|
417 iMode = aMode; |
|
418 SetInitialState(); |
|
419 } |
|
420 |
|
421 // ---------------------------------------------------- |
|
422 // CCamSidePane::SetInitialState |
|
423 // Notification that the burst mode has been activated/deactivated |
|
424 // ---------------------------------------------------- |
|
425 // |
|
426 void CCamSidePane::SetInitialState() |
|
427 { |
|
428 CCamAppUiBase* appUi = |
|
429 static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() ); |
|
430 |
|
431 // set up indicator data |
|
432 TInt numindicators = iIndicators.Count(); // number of indicators |
|
433 // set initial state for each indicator |
|
434 for ( TInt i = 0; i < numindicators; i++ ) |
|
435 { |
|
436 if ( iIndicators[i] ) |
|
437 { |
|
438 switch( i ) |
|
439 { |
|
440 // ------------------------------------------------- |
|
441 // Scene indicator |
|
442 case ECamIndicatorScene: |
|
443 { |
|
444 if( ECamControllerVideo == iMode ) |
|
445 SetVideoSceneIndicator(); |
|
446 else |
|
447 SetPhotoSceneIndicator(); |
|
448 break; |
|
449 } |
|
450 // ------------------------------------------------- |
|
451 // Flash indicator |
|
452 case ECamIndicatorFlash: |
|
453 { |
|
454 // don't show the icon if in video mode or the second |
|
455 // camera is active |
|
456 // second camera doesn't support flash |
|
457 if ( ECamControllerVideo == iMode |
|
458 || IsSecondaryCameraEnabled() |
|
459 ) |
|
460 { |
|
461 iIndicators[ECamIndicatorFlash]->ClearIcon(); |
|
462 } |
|
463 else |
|
464 { |
|
465 TInt iconIndex = GetFlashIconIndex( iMode ); |
|
466 if( KErrNotFound != iconIndex ) |
|
467 { |
|
468 iIndicators[ECamIndicatorFlash]->SetIcon( iconIndex ); |
|
469 } |
|
470 } |
|
471 break; |
|
472 } |
|
473 // ------------------------------------------------- |
|
474 // Video Flash indicator |
|
475 case ECamIndicatorVideoFlash: |
|
476 { |
|
477 // don't show the icon if in video mode or the second |
|
478 // camera is active |
|
479 // second camera doesn't support flash |
|
480 if ( iController.UiConfigManagerPtr()->IsVideoLightSupported() ) |
|
481 { |
|
482 if ( ECamControllerVideo != iMode |
|
483 || IsSecondaryCameraEnabled() |
|
484 ) |
|
485 { |
|
486 iIndicators[ECamIndicatorVideoFlash]->ClearIcon(); |
|
487 } |
|
488 else |
|
489 { |
|
490 TInt iconIndex = GetFlashIconIndex( iMode ); |
|
491 if( KErrNotFound != iconIndex ) |
|
492 { |
|
493 iIndicators[ECamIndicatorVideoFlash]->SetIcon( iconIndex ); |
|
494 } |
|
495 } |
|
496 } |
|
497 break; |
|
498 } |
|
499 // ------------------------------------------------- |
|
500 // Burst mode indicator |
|
501 case ECamIndicatorBurstMode: |
|
502 { |
|
503 if ( appUi && appUi->IsBurstEnabled() ) |
|
504 { |
|
505 iIndicators[ECamIndicatorBurstMode]->SetIcon( 0 ); |
|
506 } |
|
507 else |
|
508 { |
|
509 iIndicators[ECamIndicatorBurstMode]->ClearIcon(); |
|
510 } |
|
511 break; |
|
512 } |
|
513 // ------------------------------------------------- |
|
514 // Self timer indicator |
|
515 case ECamIndicatorSelfTimer: |
|
516 { |
|
517 iIndicators[ECamIndicatorSelfTimer]->ClearIcon(); |
|
518 break; |
|
519 } |
|
520 // ------------------------------------------------- |
|
521 case ECamIndicatorVideoStabiliser: |
|
522 { |
|
523 if ( iController.UiConfigManagerPtr()->IsVideoStabilizationSupported() ) |
|
524 { |
|
525 SetVideoStabilisationIndicator(); |
|
526 } |
|
527 else |
|
528 { |
|
529 iIndicators[ECamIndicatorVideoStabiliser]->ClearIcon(); |
|
530 } |
|
531 break; |
|
532 } |
|
533 // ------------------------------------------------- |
|
534 case ECamIndicatorFaceTracking: |
|
535 { |
|
536 if ( iController.UiConfigManagerPtr()->IsFaceTrackingSupported() ) |
|
537 { |
|
538 SetFaceTrackingIndicator(); |
|
539 } |
|
540 else |
|
541 { |
|
542 iIndicators[ECamIndicatorFaceTracking]->ClearIcon(); |
|
543 } |
|
544 break; |
|
545 } |
|
546 // ------------------------------------------------- |
|
547 case ECamIndicatorCaptureMode: |
|
548 { |
|
549 if( appUi && !appUi->IsSecondCameraEnabled() || |
|
550 appUi && appUi->IsQwerty2ndCamera() ) |
|
551 { |
|
552 if ( ECamControllerVideo == iMode ) |
|
553 { |
|
554 iIndicators[ECamIndicatorCaptureMode]->SetIcon( 2 ); |
|
555 } |
|
556 else |
|
557 iIndicators[ECamIndicatorCaptureMode]->SetIcon( 0 ); |
|
558 } |
|
559 else |
|
560 iIndicators[ECamIndicatorCaptureMode]->ClearIcon(); |
|
561 |
|
562 if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() ) |
|
563 { |
|
564 iIndicators[ECamIndicatorCaptureMode]->ClearIcon(); |
|
565 } |
|
566 break; |
|
567 } |
|
568 // ------------------------------------------------- |
|
569 case ECamIndicatorTotal: |
|
570 { |
|
571 if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() ) |
|
572 { |
|
573 iIndicators[ECamIndicatorTotal]->DisplayIcon(); |
|
574 } |
|
575 break; |
|
576 } |
|
577 // ------------------------------------------------- |
|
578 // other indicators |
|
579 default: |
|
580 { |
|
581 iIndicators[i]->ClearIcon(); |
|
582 break; |
|
583 } |
|
584 // ------------------------------------------------- |
|
585 } // switch |
|
586 } |
|
587 } // for |
|
588 } |
|
589 |
|
590 |
|
591 // --------------------------------------------------------------------------- |
|
592 // GetFlashIconIndex |
|
593 // --------------------------------------------------------------------------- |
|
594 // |
|
595 TInt |
|
596 CCamSidePane::GetFlashIconIndex( const TCamCameraMode& aMode ) |
|
597 { |
|
598 TInt index( KErrNotFound ); |
|
599 if( ECamControllerVideo == aMode ) |
|
600 { |
|
601 TCamFlashId flashId = |
|
602 static_cast<TCamFlashId>( |
|
603 iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) ); |
|
604 switch ( flashId ) |
|
605 { |
|
606 case ECamFlashOff: index = 0; break; |
|
607 case ECamFlashForced: index = 2; break; |
|
608 default: break; |
|
609 } |
|
610 } |
|
611 else |
|
612 { |
|
613 TCamFlashId flashId = |
|
614 static_cast<TCamFlashId> ( |
|
615 iController.IntegerSettingValue( ECamSettingItemDynamicPhotoFlash ) ); |
|
616 |
|
617 switch ( flashId ) |
|
618 { |
|
619 case ECamFlashAuto: index = 0; break; |
|
620 case ECamFlashOff: index = 2; break; |
|
621 case ECamFlashAntiRedEye: index = 4; break; |
|
622 case ECamFlashForced: index = 6; break; |
|
623 |
|
624 default: break; |
|
625 } |
|
626 } |
|
627 return index; |
|
628 } |
|
629 |
|
630 |
|
631 // ---------------------------------------------------- |
|
632 // CCamSidePane::RegisterObserversL |
|
633 // Register with observed classes |
|
634 // ---------------------------------------------------- |
|
635 // |
|
636 void CCamSidePane::RegisterObserversL() |
|
637 { |
|
638 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
639 CCamAppUi* appUi = static_cast<CCamAppUi*>( eikEnv->AppUi() ); |
|
640 |
|
641 if ( appUi ) |
|
642 { |
|
643 // burst mode icon is displayed in either the navipane or sidepane |
|
644 #ifndef PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE |
|
645 // Register as burst mode observer |
|
646 appUi->AddBurstModeObserverL( this ); |
|
647 #endif // !PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE |
|
648 } |
|
649 // Register as controller observer |
|
650 iController.AddControllerObserverL( this ); |
|
651 } |
|
652 |
|
653 // ---------------------------------------------------- |
|
654 // CCamSidePane::RemoveObservers |
|
655 // Dergister with observed classes |
|
656 // ---------------------------------------------------- |
|
657 // |
|
658 void CCamSidePane::RemoveObservers() |
|
659 { |
|
660 iController.RemoveControllerObserver( this ); |
|
661 // if shutting down then self timer will remove the observer |
|
662 if ( !iController.IsInShutdownMode() ) |
|
663 { |
|
664 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
665 CCamAppUi* appUi = static_cast<CCamAppUi*>( eikEnv->AppUi() ); |
|
666 if ( appUi ) |
|
667 { |
|
668 // burst mode icon is displayed in either the navipane or sidepane |
|
669 #ifndef PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE |
|
670 // Deregister as burst mode observer |
|
671 appUi->RemoveBurstModeObserver( this ); |
|
672 #endif // !PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE |
|
673 } |
|
674 } |
|
675 } |
|
676 |
|
677 #ifdef PRODUCT_USES_GENERIC_SETUP_INDICATOR |
|
678 #ifndef PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR |
|
679 // ---------------------------------------------------- |
|
680 // CCamSidePane::SetDefaultSetupIndicator |
|
681 // Sets the default setup indicator depending on the |
|
682 // current setup settings. |
|
683 // ---------------------------------------------------- |
|
684 // |
|
685 void CCamSidePane::SetGenericSetupIndicator() |
|
686 { |
|
687 if ( iIndicators[ECamIndicatorGenericSetup] ) |
|
688 { |
|
689 // If the current mode is video and the video setup settings |
|
690 // are generic to the current video scene then do not show |
|
691 // the generic setup tampered indicator. |
|
692 if ( ( iMode == ECamControllerVideo ) && |
|
693 ( iController.VideoSceneDefaultsAreSet() ) ) |
|
694 { |
|
695 iIndicators[ECamIndicatorGenericSetup]->ClearIcon(); |
|
696 } |
|
697 // Otherwise, if the current mode is photo and the photo setup settings |
|
698 // are generic to the current photo scene then do not show |
|
699 // the generic setup tampered indicator. |
|
700 else if ( ( iMode != ECamControllerVideo ) && |
|
701 ( iController.PhotoSceneDefaultsAreSet() ) ) |
|
702 { |
|
703 iIndicators[ECamIndicatorGenericSetup]->ClearIcon(); |
|
704 } |
|
705 // Otherwise do not show the indicator. |
|
706 else |
|
707 { |
|
708 iIndicators[ECamIndicatorGenericSetup]->SetIcon( 0 ); |
|
709 } |
|
710 } |
|
711 } |
|
712 #endif // !PRODUCT_SUPPORTS_NAVIPANE_GENERIC_SETUP_INDICATOR |
|
713 #endif // PRODUCT_USES_GENERIC_SETUP_INDICATOR |
|
714 |
|
715 |
|
716 // ---------------------------------------------------- |
|
717 // CCamSidePane::SetVideoStabilisationIndicator |
|
718 // Sets the image stabilisation indicator for video capture mode |
|
719 // ---------------------------------------------------- |
|
720 // |
|
721 void CCamSidePane::SetVideoStabilisationIndicator() |
|
722 { |
|
723 if ( iController.UiConfigManagerPtr()->IsVideoStabilizationSupported() ) |
|
724 { |
|
725 if ( iIndicators[ECamIndicatorVideoStabiliser] ) |
|
726 { |
|
727 TCamSettingsOnOff stabilisation = static_cast< TCamSettingsOnOff > |
|
728 ( iController.IntegerSettingValue( ECamSettingItemVideoStab ) ); |
|
729 |
|
730 // If the current mode is video |
|
731 if ( stabilisation == ECamSettOn && |
|
732 iMode == ECamControllerVideo && |
|
733 !IsSecondaryCameraEnabled() ) |
|
734 { |
|
735 iIndicators[ECamIndicatorVideoStabiliser]->SetIcon( 0 ); |
|
736 } |
|
737 // Otherwise, draw nothing. |
|
738 else |
|
739 { |
|
740 iIndicators[ECamIndicatorVideoStabiliser]->ClearIcon(); |
|
741 } |
|
742 } |
|
743 } |
|
744 } |
|
745 |
|
746 // ---------------------------------------------------- |
|
747 // CCamSidePane::SetFaceTrackingIndicator |
|
748 // Sets the facetracking indicator for video capture mode |
|
749 // ---------------------------------------------------- |
|
750 // |
|
751 void CCamSidePane::SetFaceTrackingIndicator() |
|
752 { |
|
753 if ( iController.UiConfigManagerPtr()->IsFaceTrackingSupported() ) |
|
754 { |
|
755 if ( iIndicators[ECamIndicatorFaceTracking] ) |
|
756 { |
|
757 TCamSettingsOnOff facetracking = static_cast< TCamSettingsOnOff > |
|
758 ( iController.IntegerSettingValue( ECamSettingItemFaceTracking ) ); |
|
759 |
|
760 // If the current mode is still image |
|
761 if ( facetracking == ECamSettOn && iMode == ECamControllerImage && !IsSecondaryCameraEnabled() ) |
|
762 { |
|
763 iIndicators[ECamIndicatorFaceTracking]->SetIcon( 0 ); |
|
764 } |
|
765 // Otherwise, draw nothing. |
|
766 else |
|
767 { |
|
768 iIndicators[ECamIndicatorFaceTracking]->ClearIcon(); |
|
769 } |
|
770 } |
|
771 } |
|
772 } |
|
773 |
|
774 // ---------------------------------------------------- |
|
775 // CCamSidePane::SetVideoSceneIndicator |
|
776 // Set the scene indicator depending on the current video scene setting |
|
777 // ---------------------------------------------------- |
|
778 // |
|
779 void CCamSidePane::SetVideoSceneIndicator() |
|
780 { |
|
781 if ( iIndicators[ECamIndicatorScene] ) |
|
782 { |
|
783 TCamSceneId scene = static_cast< TCamSceneId > ( |
|
784 iController.IntegerSettingValue( ECamSettingItemDynamicVideoScene ) ); |
|
785 switch ( scene ) |
|
786 { |
|
787 case ECamSceneNormal: |
|
788 { |
|
789 iIndicators[ECamIndicatorScene]->SetIcon( 0 ); |
|
790 } |
|
791 break; |
|
792 case ECamSceneNight: |
|
793 { |
|
794 iIndicators[ECamIndicatorScene]->SetIcon( 2 ); |
|
795 } |
|
796 break; |
|
797 case ECamSceneUser: |
|
798 { |
|
799 iIndicators[ECamIndicatorScene]->SetIcon( 4 ); |
|
800 } |
|
801 break; |
|
802 default: |
|
803 { |
|
804 iIndicators[ECamIndicatorScene]->ClearIcon(); |
|
805 } |
|
806 break; |
|
807 } |
|
808 } |
|
809 } |
|
810 |
|
811 // ---------------------------------------------------- |
|
812 // CCamSidePane::SetPhotoSceneIndicator |
|
813 // Set the scene indicator depending on the current photo scene setting |
|
814 // ---------------------------------------------------- |
|
815 // |
|
816 void CCamSidePane::SetPhotoSceneIndicator() |
|
817 { |
|
818 if ( iIndicators[ECamIndicatorScene] ) |
|
819 { |
|
820 TCamSceneId scene = static_cast< TCamSceneId > ( |
|
821 iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) ); |
|
822 switch ( scene ) |
|
823 { |
|
824 case ECamSceneAuto: |
|
825 { |
|
826 iIndicators[ECamIndicatorScene]->SetIcon( 4 ); |
|
827 } |
|
828 break; |
|
829 case ECamSceneUser: |
|
830 { |
|
831 iIndicators[ECamIndicatorScene]->SetIcon( 6 ); |
|
832 } |
|
833 break; |
|
834 case ECamSceneMacro: |
|
835 { |
|
836 iIndicators[ECamIndicatorScene]->SetIcon( 8 ); |
|
837 } |
|
838 break; |
|
839 case ECamScenePortrait: |
|
840 { |
|
841 iIndicators[ECamIndicatorScene]->SetIcon( 10 ); |
|
842 } |
|
843 break; |
|
844 case ECamSceneScenery: |
|
845 { |
|
846 iIndicators[ECamIndicatorScene]->SetIcon( 12 ); |
|
847 } |
|
848 break; |
|
849 case ECamSceneNight: |
|
850 { |
|
851 iIndicators[ECamIndicatorScene]->SetIcon( 14 ); |
|
852 } |
|
853 break; |
|
854 case ECamSceneSports: |
|
855 { |
|
856 iIndicators[ECamIndicatorScene]->SetIcon( 16 ); |
|
857 } |
|
858 break; |
|
859 case ECamSceneNightScenery: |
|
860 { |
|
861 iIndicators[ECamIndicatorScene]->SetIcon( 22 ); |
|
862 } |
|
863 break; |
|
864 case ECamSceneNightPortrait: |
|
865 { |
|
866 iIndicators[ECamIndicatorScene]->SetIcon( 24 ); |
|
867 } |
|
868 break; |
|
869 case ECamSceneCandlelight: |
|
870 { |
|
871 iIndicators[ECamIndicatorScene]->SetIcon( 26 ); |
|
872 } |
|
873 break; |
|
874 default: |
|
875 { |
|
876 iIndicators[ECamIndicatorScene]->ClearIcon(); |
|
877 } |
|
878 break; |
|
879 } |
|
880 } |
|
881 } |
|
882 |
|
883 // ---------------------------------------------------- |
|
884 // CCamSidePane::BurstModeActiveL |
|
885 // Notification that the burst mode has been activated/deactivated |
|
886 // ---------------------------------------------------- |
|
887 // |
|
888 // Burst mode icon is displayed in either the navipane or sidepane |
|
889 #ifndef PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE |
|
890 void CCamSidePane::BurstModeActiveL( TBool aActive, TBool /*aStillModeActive*/ ) |
|
891 { |
|
892 if ( iIndicators[ECamIndicatorBurstMode] ) |
|
893 { |
|
894 // If burst mode has been activated |
|
895 if ( aActive ) |
|
896 { |
|
897 iIndicators[ECamIndicatorBurstMode]->SetIcon( 0 ); |
|
898 } |
|
899 else // otherwise, burst mode has been deactivated |
|
900 { |
|
901 iIndicators[ECamIndicatorBurstMode]->ClearIcon(); |
|
902 } |
|
903 } |
|
904 } |
|
905 #endif // !PRODUCT_SUPPORTS_NAVIPANE_SEQUENCE |
|
906 |
|
907 // ---------------------------------------------------- |
|
908 // CCamSidePane::IsSecondaryCameraEnabled |
|
909 // Checks if the secondary camera is enabled |
|
910 // ---------------------------------------------------- |
|
911 // |
|
912 TBool CCamSidePane::IsSecondaryCameraEnabled() const |
|
913 { |
|
914 return static_cast<CCamAppUiBase*>( |
|
915 CEikonEnv::Static()->AppUi() )->IsSecondCameraEnabled(); |
|
916 } |
|
917 |
|
918 // ---------------------------------------------------- |
|
919 // CCamSidePane::UpdateLayout |
|
920 // ---------------------------------------------------- |
|
921 // |
|
922 void CCamSidePane::UpdateLayout() |
|
923 { |
|
924 if ( CamUtility::IsNhdDevice() ) |
|
925 { |
|
926 TouchLayout(); |
|
927 } |
|
928 else |
|
929 { |
|
930 NonTouchLayout(); |
|
931 } |
|
932 } |
|
933 |
|
934 // ---------------------------------------------------- |
|
935 // CCamSidePane::NonTouchLayout |
|
936 // ---------------------------------------------------- |
|
937 void CCamSidePane::NonTouchLayout() const |
|
938 { |
|
939 TRect rect; |
|
940 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect ); |
|
941 TInt cba = AknLayoutUtils::CbaLocation() == |
|
942 AknLayoutUtils::EAknCbaLocationLeft; |
|
943 TAknLayoutRect parent; |
|
944 parent.LayoutRect( rect, AknLayoutScalable_Apps::cam6_mode_pane( cba ) ); |
|
945 |
|
946 // update coords for each indicator |
|
947 for ( TInt i = 0; i < iIndicators.Count(); i++ ) |
|
948 { |
|
949 TAknLayoutRect l; |
|
950 if ( iIndicators[i] ) |
|
951 { |
|
952 switch ( i ) |
|
953 { |
|
954 case ECamIndicatorCaptureMode: |
|
955 { |
|
956 l.LayoutRect( parent.Rect(), |
|
957 AknLayoutScalable_Apps::cam6_mode_pane_g1( cba ) ); |
|
958 iIndicators[i]->SetRect( l.Rect() ); |
|
959 break; |
|
960 } |
|
961 case ECamIndicatorBurstMode: |
|
962 { |
|
963 l.LayoutRect( parent.Rect(), |
|
964 AknLayoutScalable_Apps::cam6_mode_pane_g2( cba ) ); |
|
965 iIndicators[i]->SetRect( l.Rect() ); |
|
966 break; |
|
967 } |
|
968 case ECamIndicatorImageShakeWarning: |
|
969 { |
|
970 l.LayoutRect( parent.Rect(), |
|
971 AknLayoutScalable_Apps::cam6_mode_pane_g3( cba ) ); |
|
972 iIndicators[i]->SetRect( l.Rect() ); |
|
973 break; |
|
974 } |
|
975 case ECamIndicatorVideoStabiliser: |
|
976 { |
|
977 l.LayoutRect( parent.Rect(), |
|
978 AknLayoutScalable_Apps::cam6_mode_pane_g3( cba ) ); |
|
979 iIndicators[i]->SetRect( l.Rect() ); |
|
980 break; |
|
981 } |
|
982 case ECamIndicatorFaceTracking: |
|
983 { |
|
984 l.LayoutRect( parent.Rect(), |
|
985 AknLayoutScalable_Apps::cam6_mode_pane_g4( cba ) ); |
|
986 iIndicators[i]->SetRect( l.Rect() ); |
|
987 break; |
|
988 } |
|
989 default: |
|
990 { |
|
991 break; |
|
992 } |
|
993 } |
|
994 } |
|
995 } |
|
996 } |
|
997 |
|
998 // --------------------------------------------------------------------------- |
|
999 // CCamSidePane::TouchLayout |
|
1000 // --------------------------------------------------------------------------- |
|
1001 void CCamSidePane::TouchLayout() const |
|
1002 { |
|
1003 TSize screenSize; |
|
1004 AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EScreen, screenSize ); |
|
1005 TRect rect( TPoint(), screenSize ); |
|
1006 TInt variant = Layout_Meta_Data::IsLandscapeOrientation(); |
|
1007 |
|
1008 // update coords for each indicator |
|
1009 for ( TInt i = 0; i < iIndicators.Count(); i++ ) |
|
1010 { |
|
1011 TAknLayoutRect l; |
|
1012 if ( iIndicators[i] ) |
|
1013 { |
|
1014 switch ( i ) |
|
1015 { |
|
1016 case ECamIndicatorCaptureMode: |
|
1017 case ECamIndicatorTotal: |
|
1018 { |
|
1019 if ( ECamControllerVideo == iMode ) |
|
1020 { |
|
1021 l.LayoutRect( rect, |
|
1022 AknLayoutScalable_Apps::main_video4_pane_g1( variant ) ); |
|
1023 } |
|
1024 else |
|
1025 { |
|
1026 l.LayoutRect( rect, |
|
1027 AknLayoutScalable_Apps::main_camera4_pane_g1( variant ) ); |
|
1028 } |
|
1029 iIndicators[i]->SetRect( l.Rect() ); |
|
1030 if ( i == ECamIndicatorCaptureMode |
|
1031 && iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() ) |
|
1032 { |
|
1033 iIndicators[i]->ClearIcon(); |
|
1034 } |
|
1035 break; |
|
1036 } |
|
1037 case ECamIndicatorBurstMode: |
|
1038 { |
|
1039 l.LayoutRect( rect, |
|
1040 AknLayoutScalable_Apps::main_camera4_pane_g2( variant ) ); |
|
1041 iIndicators[i]->SetRect( l.Rect() ); |
|
1042 break; |
|
1043 } |
|
1044 case ECamIndicatorImageShakeWarning: |
|
1045 { |
|
1046 l.LayoutRect( rect, |
|
1047 AknLayoutScalable_Apps::main_camera4_pane_g3( variant ) ); |
|
1048 iIndicators[i]->SetRect( l.Rect() ); |
|
1049 break; |
|
1050 } |
|
1051 case ECamIndicatorVideoStabiliser: |
|
1052 { |
|
1053 l.LayoutRect( rect, |
|
1054 AknLayoutScalable_Apps::main_video4_pane_g3( variant ) ); |
|
1055 iIndicators[i]->SetRect( l.Rect() ); |
|
1056 break; |
|
1057 } |
|
1058 case ECamIndicatorFaceTracking: |
|
1059 { |
|
1060 l.LayoutRect( rect, |
|
1061 AknLayoutScalable_Apps::main_camera4_pane_g2( variant ) ); |
|
1062 iIndicators[i]->SetRect( l.Rect() ); |
|
1063 break; |
|
1064 } |
|
1065 default: |
|
1066 { |
|
1067 break; |
|
1068 } |
|
1069 } |
|
1070 } |
|
1071 } |
|
1072 } |
|
1073 |
|
1074 // --------------------------------------------------------------------------- |
|
1075 // CCamSidePane::ModeIndicatorLayoutRect |
|
1076 // --------------------------------------------------------------------------- |
|
1077 // |
|
1078 TRect CCamSidePane::ModeIndicatorLayoutRect() |
|
1079 { |
|
1080 // Mode and scene indicators use the same layout rect. |
|
1081 // Only one of these can be used at a give time. |
|
1082 return iIndicators[ECamIndicatorCaptureMode]->LayoutRect(); |
|
1083 } |
|
1084 |
|
1085 // --------------------------------------------------------------------------- |
|
1086 // CCamSidePane::DrawModeIndicator |
|
1087 // --------------------------------------------------------------------------- |
|
1088 // |
|
1089 void CCamSidePane::DrawModeIndicator( CWindowGc& aGc, TBool aDrawIcon ) |
|
1090 { |
|
1091 PRINT( _L("Camera => CCamSidePane::DrawModeIndicator") ); |
|
1092 |
|
1093 if ( iController.UiConfigManagerPtr()->IsCustomCaptureButtonSupported() ) |
|
1094 { |
|
1095 PRINT( _L("Camera <= CCamSidePane::DrawSceneIndicator - mode indicator not used") ); |
|
1096 return; |
|
1097 } |
|
1098 |
|
1099 CCamIndicator *indicator = iIndicators[ECamIndicatorCaptureMode]; |
|
1100 if ( indicator ) |
|
1101 { |
|
1102 if( aDrawIcon ) |
|
1103 { |
|
1104 indicator->DisplayIcon(); |
|
1105 } |
|
1106 else |
|
1107 { |
|
1108 indicator->ClearIcon(); |
|
1109 } |
|
1110 indicator->Draw( aGc ); |
|
1111 } |
|
1112 PRINT( _L("Camera <= CCamSidePane::DrawModeIndicator") ); |
|
1113 } |
|
1114 |
|
1115 // --------------------------------------------------------------------------- |
|
1116 // CCamSidePane::UpdateSceneIndicatorL |
|
1117 // --------------------------------------------------------------------------- |
|
1118 // |
|
1119 void CCamSidePane::UpdateSceneIndicatorL( TInt32 aBitmapId, TInt32 aMaskId ) |
|
1120 { |
|
1121 PRINT1( _L("Camera => CCamSidePane::UpdateSceneIndicatorL - count:%d"), iIndicators.Count() ); |
|
1122 |
|
1123 if ( !iIndicators.Count() ) |
|
1124 { |
|
1125 PRINT( _L("Camera <= CCamSidePane::UpdateSceneIndicatorL - indi not initialized") ); |
|
1126 return; |
|
1127 } |
|
1128 |
|
1129 // Remove previous scene icon, if present |
|
1130 if ( iIndicators.Count() == ECamIndicatorTotal + 1 ) |
|
1131 { |
|
1132 CCamIndicator *indi = iIndicators[ECamIndicatorTotal]; |
|
1133 iIndicators.Remove( ECamIndicatorTotal ); |
|
1134 delete indi; |
|
1135 } |
|
1136 |
|
1137 // Construct and append new indicator to the indicator list |
|
1138 TRect rect( iIndicators[ECamIndicatorCaptureMode]->LayoutRect() ); |
|
1139 CCamIndicator *indicator = CCamIndicator::NewL( rect ); |
|
1140 |
|
1141 CleanupStack::PushL( indicator ); |
|
1142 indicator->AddIconL( aBitmapId, aMaskId ); |
|
1143 indicator->SetRect( rect ); |
|
1144 iIndicators.Append( indicator ); |
|
1145 CleanupStack::Pop( indicator ); |
|
1146 |
|
1147 // Mode indicator disabled and |
|
1148 iIndicators[ECamIndicatorCaptureMode]->ClearIcon(); |
|
1149 iIndicators[ECamIndicatorTotal]->DisplayIcon(); |
|
1150 |
|
1151 PRINT( _L("Camera <= CCamSidePane::UpdateSceneIndicatorL") ); |
|
1152 } |
|
1153 |
|
1154 // End of File |
|