|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Base class for all camera application containers* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <eikmenub.h> |
|
21 #include <aknview.h> |
|
22 #include <avkon.hrh> |
|
23 #include <AknsFrameBackgroundControlContext.h> |
|
24 #include <AknsDrawUtils.h> |
|
25 #include <AknUtils.h> |
|
26 // System includes for changing the orientation. |
|
27 #include <eikenv.h> |
|
28 #include <eikappui.h> |
|
29 |
|
30 #include <activepalette2ui.h> |
|
31 #include <cameraapp.rsg> |
|
32 #include <vgacamsettings.rsg> |
|
33 #include <aknlayoutscalable_apps.cdl.h> |
|
34 #include <layoutmetadata.cdl.h> |
|
35 #include <StringLoader.h> |
|
36 |
|
37 #include "CamContainerBase.h" |
|
38 #include "CamAppController.h" |
|
39 #include "CamLogger.h" |
|
40 #include "CamUtility.h" |
|
41 #include "CamAppUi.h" |
|
42 #include "CamNaviCounterControl.h" |
|
43 #include "CamNaviProgressBarControl.h" |
|
44 #include "CamZoomPane.h" |
|
45 #include "camactivepalettehandler.h" |
|
46 #include "CameraUiConfigManager.h" |
|
47 #include "CamViewBase.h" |
|
48 #include "cambackupcontainer.h" |
|
49 |
|
50 static const TInt KCamBurstCounterLength = 2; |
|
51 _LIT(KCamBurstCounterFormat, "%02d"); |
|
52 |
|
53 // ================= STATIC MEMBER VARIABLES ================ |
|
54 |
|
55 MActivePalette2UI* CCamContainerBase::iActivePalette = NULL; |
|
56 |
|
57 // ================= MEMBER FUNCTIONS ======================= |
|
58 |
|
59 // Destructor |
|
60 CCamContainerBase::~CCamContainerBase() |
|
61 { |
|
62 PRINT( _L("Camera => ~CCamContainerBase") ); |
|
63 delete iBgContext; |
|
64 |
|
65 |
|
66 iPrimaryZoomInKeys.Close(); |
|
67 iPrimaryZoomOutKeys.Close(); |
|
68 iSecondaryZoomInKeys.Close(); |
|
69 iSecondaryZoomOutKeys.Close(); |
|
70 |
|
71 iPrimaryCameraCaptureKeys.Close(); |
|
72 iSecondaryCameraCaptureKeys.Close(); |
|
73 |
|
74 iPrimaryCameraAFKeys.Close(); |
|
75 |
|
76 delete iProcessingText; |
|
77 delete iBurstProcessingText; |
|
78 if(iBackupContainer) |
|
79 { |
|
80 delete iBackupContainer; |
|
81 iBackupContainer = NULL; |
|
82 } |
|
83 |
|
84 PRINT( _L("Camera <= ~CCamContainerBase") ); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CCamContainerBase::CCamContainerBase |
|
89 // C++ constructor |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 CCamContainerBase::CCamContainerBase( CCamAppController& aController, |
|
93 CAknView& aView ) |
|
94 : iView( aView ), |
|
95 iController( aController ) |
|
96 { |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // CCamContainerBase::BaseConstructL |
|
101 // Symbian OS 2nd phase constructor |
|
102 // --------------------------------------------------------- |
|
103 // |
|
104 void CCamContainerBase::BaseConstructL( const TRect& aRect ) |
|
105 { |
|
106 CreateWindowL(); |
|
107 SetRect( aRect ); |
|
108 EnableDragEvents(); |
|
109 |
|
110 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->EikAppUi() ); |
|
111 iCamOrientation = appUi->CamOrientation(); |
|
112 |
|
113 // set up the skin background context |
|
114 CreateBackgroundContextL(); |
|
115 |
|
116 iBackupContainer = CCamBackupContainer::NewL(iController,iView,*this); |
|
117 |
|
118 // zoom keys |
|
119 iPrimaryZoomInKeys.Reset(); |
|
120 iPrimaryZoomOutKeys.Reset(); |
|
121 iSecondaryZoomInKeys.Reset(); |
|
122 iSecondaryZoomOutKeys.Reset(); |
|
123 |
|
124 // capture keys |
|
125 iPrimaryCameraCaptureKeys.Reset(); |
|
126 iSecondaryCameraCaptureKeys.Reset(); |
|
127 |
|
128 // AF keys |
|
129 iPrimaryCameraAFKeys.Reset(); |
|
130 |
|
131 if ( iController.UiConfigManagerPtr() ) |
|
132 { |
|
133 // Reading the zoom keys for primary and secondary camera |
|
134 iController.UiConfigManagerPtr()-> |
|
135 SupportedPrimaryCameraZoomInKeysL( iPrimaryZoomInKeys ); |
|
136 iController.UiConfigManagerPtr()-> |
|
137 SupportedPrimaryCameraZoomOutKeysL( iPrimaryZoomOutKeys ); |
|
138 |
|
139 // secondary camera zoom-in/out keys |
|
140 iController.UiConfigManagerPtr()-> |
|
141 SupportedSecondaryCameraZoomInKeysL( iSecondaryZoomInKeys ); |
|
142 iController.UiConfigManagerPtr()-> |
|
143 SupportedSecondaryCameraZoomOutKeysL( iSecondaryZoomOutKeys ); |
|
144 |
|
145 // Reading the capture keys for primary and secondary camera |
|
146 iController.UiConfigManagerPtr()-> |
|
147 SupportedPrimaryCameraCaptureKeyL( iPrimaryCameraCaptureKeys ); |
|
148 |
|
149 iController.UiConfigManagerPtr()-> |
|
150 SupportedSecondaryCameraCaptureKeyL( iSecondaryCameraCaptureKeys ); |
|
151 |
|
152 // Reading AF or half capture key press Keys |
|
153 iController.UiConfigManagerPtr()->SupportedPrimaryCameraAutoFocusKeyL( |
|
154 iPrimaryCameraAFKeys ); |
|
155 } |
|
156 if ( iPrimaryZoomInKeys.Count() <= 0 || iPrimaryZoomOutKeys.Count() <= 0 || |
|
157 iSecondaryZoomInKeys.Count() <= 0 || iSecondaryZoomOutKeys.Count() <= 0 || |
|
158 iPrimaryCameraCaptureKeys.Count() <= 0 || iSecondaryCameraCaptureKeys.Count() <= 0 || |
|
159 iPrimaryCameraAFKeys.Count() <= 0 |
|
160 ) |
|
161 { |
|
162 // Leave here, if there are no configured items so that we dont panic |
|
163 //in any container classes derived from this base class |
|
164 User::Leave( KErrNotSupported ); |
|
165 } |
|
166 } |
|
167 |
|
168 |
|
169 // --------------------------------------------------------- |
|
170 // CCamContainerBase::IsCaptureKeyL |
|
171 // Whether or not this key is considered to be a capture key |
|
172 // in the current context |
|
173 // --------------------------------------------------------- |
|
174 // |
|
175 TBool CCamContainerBase::IsCaptureKeyL( const TKeyEvent& aKeyEvent, |
|
176 TEventCode aType ) |
|
177 { |
|
178 PRINT1( _L( "Camera => CCamContainerBase::IsCaptureKey event type (%d)" ), aType ); |
|
179 |
|
180 // Find out if this key is a capture key |
|
181 TBool isCaptureKey( EFalse) ; |
|
182 |
|
183 // Repeat events are not classed as capture keys |
|
184 if ( aKeyEvent.iRepeats != 0 ) |
|
185 { |
|
186 PRINT( _L( "IsCaptureKey returning false (repeat)" ) ); |
|
187 return isCaptureKey; |
|
188 } |
|
189 |
|
190 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
191 if ( appUi && appUi->AppInBackground( ETrue ) ) |
|
192 { |
|
193 PRINT( _L("IsCaptureKey returning false (AppInBackground() = true") ); |
|
194 return isCaptureKey; |
|
195 } |
|
196 |
|
197 if ( ECamActiveCameraPrimary == iController.ActiveCamera() ) |
|
198 { |
|
199 isCaptureKey = IsPrimaryCameraCaptureKey( aKeyEvent ); |
|
200 } |
|
201 else // secondary camera |
|
202 { |
|
203 isCaptureKey = IsSecondaryCameraCaptureKey( aKeyEvent ); |
|
204 } |
|
205 |
|
206 // Each product defines which key/s are treated as capture keys. |
|
207 // Different keys can be mapped for each active camera. |
|
208 // Look for capture event or key up event (note that capture |
|
209 // event is on the EEventKey for navi-key select press) |
|
210 if ( isCaptureKey ) |
|
211 { |
|
212 if ( aType == EEventKeyDown || aType == EEventKey || aType == EEventKeyUp || aType == EEventKeyUp ) |
|
213 { |
|
214 if ( isCaptureKey && |
|
215 ( iController.UiConfigManagerPtr()->IsKeyLockWatcherSupported() && iController.IsKeyLockOn() ) ) |
|
216 { |
|
217 isCaptureKey = !iController.IsKeyLockOn(); |
|
218 } |
|
219 } |
|
220 else |
|
221 { |
|
222 // key types doesnt match so dont consider as capture key press. |
|
223 isCaptureKey = EFalse; |
|
224 } |
|
225 } |
|
226 PRINT1( _L( "IsCaptureKey returning %d" ), isCaptureKey ); |
|
227 return isCaptureKey; |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------- |
|
231 // CCamContainerBase::IsShutterKeyL |
|
232 // Whether or not this key is considered to be a shutter key |
|
233 // in the current context |
|
234 // --------------------------------------------------------- |
|
235 // |
|
236 TBool CCamContainerBase::IsShutterKeyL( const TKeyEvent& aKeyEvent, TEventCode /* aType */ ) |
|
237 { |
|
238 PRINT1( _L( "Camera => CCamContainerBase::IsShutterKeyL scancode (%d)" ), aKeyEvent.iScanCode ); |
|
239 |
|
240 if ( iController.UiConfigManagerPtr() |
|
241 && iController.UiConfigManagerPtr()->IsAutoFocusSupported() ) |
|
242 { |
|
243 #ifndef __WINS__ |
|
244 if ( aKeyEvent.iScanCode == iPrimaryCameraAFKeys[0] ) |
|
245 #else |
|
246 if ( aKeyEvent.iScanCode == EProductKeyCaptureHalf ) |
|
247 #endif |
|
248 { |
|
249 return ETrue; |
|
250 } |
|
251 } |
|
252 return EFalse; |
|
253 } |
|
254 |
|
255 |
|
256 // |
|
257 // CCamZoomPane::CheckForZoomKey |
|
258 // |
|
259 TBool CCamContainerBase::CheckForZoomKey( const TKeyEvent& aKeyEvent ) |
|
260 { |
|
261 return CheckInZoomKeyArray( aKeyEvent ); |
|
262 } |
|
263 |
|
264 |
|
265 // |
|
266 // |
|
267 // |
|
268 TBool CCamContainerBase::CheckInZoomKeyArray( const TKeyEvent& aKeyEvent ) |
|
269 { |
|
270 TCamActiveCamera camera = iController.ActiveCamera(); |
|
271 TBool zoomKeyFound ( EFalse ); |
|
272 |
|
273 if ( camera == ECamActiveCameraPrimary ) |
|
274 { |
|
275 zoomKeyFound = ( KErrNotFound != |
|
276 iPrimaryZoomInKeys.Find( aKeyEvent.iScanCode ) ); |
|
277 if ( !zoomKeyFound ) |
|
278 { |
|
279 // Its not zoom-in key, check if its zoom out key |
|
280 zoomKeyFound = ( KErrNotFound != |
|
281 iPrimaryZoomOutKeys.Find( aKeyEvent.iScanCode ) ); |
|
282 } |
|
283 } |
|
284 else if ( camera == ECamActiveCameraSecondary ) |
|
285 { |
|
286 zoomKeyFound = ( KErrNotFound != |
|
287 iSecondaryZoomInKeys.Find( aKeyEvent.iScanCode ) ); |
|
288 if ( !zoomKeyFound ) |
|
289 { |
|
290 // Its not zoom-in key, check if its zoom out key |
|
291 zoomKeyFound = ( KErrNotFound != |
|
292 iSecondaryZoomOutKeys.Find( aKeyEvent.iScanCode ) ); |
|
293 } |
|
294 } |
|
295 else |
|
296 { |
|
297 // when we reach here, it means we have no zoom keys set, we return back. |
|
298 } |
|
299 return zoomKeyFound; |
|
300 } |
|
301 |
|
302 |
|
303 // --------------------------------------------------------- |
|
304 // CCamContainerBase::IsZoomKeyL |
|
305 // Whether or not this key is considered to be a shutter key |
|
306 // in the current context |
|
307 // --------------------------------------------------------- |
|
308 // |
|
309 TBool CCamContainerBase::IsZoomKeyL( const TKeyEvent& aKeyEvent, |
|
310 TEventCode aType ) |
|
311 { |
|
312 PRINT1( _L( "Camera => CCamContainerBase::IsZoomKeyL event type (%d)" ), aType ); |
|
313 |
|
314 CCamZoomPane* zoom = static_cast<CCamAppUiBase*>( iEikonEnv->EikAppUi() )->ZoomPane(); |
|
315 |
|
316 // |
|
317 if( !ZoomAvailable() ) |
|
318 { |
|
319 return EFalse; |
|
320 } |
|
321 |
|
322 PRINT( _L( "Camera => CCamContainerBase::IsZoomKeyL " ) ); |
|
323 |
|
324 // It's a possible zoom key if it's an up OR down event, OR |
|
325 // if it's a key event AND we're currently zooming |
|
326 if ( aType == EEventKeyUp || aType == EEventKeyDown || aType == EEventUser || |
|
327 ( aType == EEventKey && |
|
328 zoom && |
|
329 zoom->IsCurrentlyZooming() ) ) |
|
330 { |
|
331 PRINT( _L( "Camera => CCamContainerBase::IsZoomKeyL A" ) ) |
|
332 return CheckForZoomKey( aKeyEvent ); |
|
333 } |
|
334 |
|
335 PRINT( _L( "Camera => CCamContainerBase::IsZoomKeyL no" ) ) |
|
336 return EFalse; |
|
337 } |
|
338 |
|
339 |
|
340 // |
|
341 // CCamContainerBase::ZoomAvailable() |
|
342 // |
|
343 TBool CCamContainerBase::ZoomAvailable() |
|
344 { |
|
345 PRINT( _L("Camera => CCamContainerBase::ZoomAvailable")) |
|
346 |
|
347 // Ignore any zoom keys that come when either capturing a burst or still |
|
348 if ( iController.SequenceCaptureInProgress() |
|
349 || ( ECamControllerImage == iController.CurrentMode() |
|
350 && ECamCapturing == iController.CurrentOperation() ) |
|
351 || ECamCompleting == iController.CurrentOperation() ) |
|
352 { |
|
353 PRINT( _L("Camera => CCamContainerBase::ZoomAvailable A false")) |
|
354 return EFalse; |
|
355 } |
|
356 PRINT( _L("Camera => CCamContainerBase::ZoomAvailable yes")) |
|
357 return ETrue; |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // Window |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 RWindow& |
|
365 CCamContainerBase::Window() const |
|
366 { |
|
367 return CCoeControl::Window(); |
|
368 } |
|
369 |
|
370 |
|
371 // ---------------------------------------------------- |
|
372 // CCamContainerBase::OfferKeyEventL |
|
373 // Handles this application view's command keys. Forwards other |
|
374 // keys to child control(s). |
|
375 // ---------------------------------------------------- |
|
376 // |
|
377 TKeyResponse |
|
378 CCamContainerBase::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
379 TEventCode aType ) |
|
380 { |
|
381 PRINT1( _L("Camera => CCamContainerBase::OfferKeyEventL scan code (%d)"), aKeyEvent.iScanCode ) |
|
382 // if the cancel softkey is pressed |
|
383 if ( aKeyEvent.iScanCode == EStdKeyDevice1 ) |
|
384 { |
|
385 iView.HandleCommandL( EAknSoftkeyCancel ); |
|
386 } |
|
387 // or if the select (OK) key is pressed |
|
388 // |
|
389 // (Note: intentionally ignoring repeat key presses here - this is a |
|
390 // work-around as the framework is passing navi-key select repeats |
|
391 // which we have to ignore) |
|
392 else if ( aType == EEventKey && |
|
393 aKeyEvent.iCode == EKeyOK && |
|
394 aKeyEvent.iRepeats == 0 ) |
|
395 { |
|
396 iView.HandleCommandL( EAknSoftkeySelect ); |
|
397 return EKeyWasConsumed; // indicate key press was processed |
|
398 } |
|
399 // stop video or sequence if get applications key press (short or long) |
|
400 // in touch also send key stops |
|
401 else if( aKeyEvent.iCode == EKeyApplication || |
|
402 ( iController.IsTouchScreenSupported() && |
|
403 aKeyEvent.iScanCode == EStdKeyYes ) ) |
|
404 { |
|
405 if ( ECamControllerVideo == iController.CurrentMode() ) |
|
406 { |
|
407 TCamCaptureOperation operation = iController.CurrentOperation(); |
|
408 if( ECamCapturing == operation |
|
409 || ECamPaused == operation ) |
|
410 { |
|
411 // Stop video |
|
412 iController.StopVideoRecording(); |
|
413 } |
|
414 } |
|
415 else if ( iController.SequenceCaptureInProgress() ) |
|
416 { |
|
417 // Stop sequence capture |
|
418 iController.StopSequenceCaptureL(); |
|
419 } |
|
420 else |
|
421 { |
|
422 // empty statement to remove Lint error, MISRA required rule 60 |
|
423 } |
|
424 } |
|
425 else |
|
426 { |
|
427 // empty statement to remove Lint error, MISRA required rule 60 |
|
428 } |
|
429 |
|
430 return EKeyWasNotConsumed; // indicate key press was not processed |
|
431 } |
|
432 |
|
433 // ---------------------------------------------------- |
|
434 // CCamContainerBase::HandleForegroundEventL |
|
435 // Called to notify of change of app fore/background state |
|
436 // ---------------------------------------------------- |
|
437 // |
|
438 void CCamContainerBase::HandleForegroundEventL( TBool /*aForeground*/ ) |
|
439 { |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------------------------- |
|
443 // CCamContainerBase::MopSupplyObject |
|
444 // Gets an object whose type is encapsulated by the specified TTypeUid object |
|
445 // Supplies the skin context to child controls using the MObjectProvider chain |
|
446 // --------------------------------------------------------------------------- |
|
447 // |
|
448 TTypeUid::Ptr CCamContainerBase::MopSupplyObject( TTypeUid aId ) |
|
449 { |
|
450 if ( aId.iUid == MAknsControlContext::ETypeId ) |
|
451 { |
|
452 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
453 } |
|
454 return CCoeControl::MopSupplyObject( aId ); |
|
455 } |
|
456 |
|
457 // ---------------------------------------------------- |
|
458 // CCamContainerBase::HandleResourceChange |
|
459 // Change Client Rect and redraw when resolution changes |
|
460 // ---------------------------------------------------- |
|
461 // |
|
462 void CCamContainerBase::HandleResourceChange( TInt aType ) |
|
463 { |
|
464 PRINT( _L("Camera => CCamContainerBase::HandleResourceChange" )) |
|
465 |
|
466 CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->EikAppUi() ); |
|
467 if ( KEikDynamicLayoutVariantSwitch == aType ) |
|
468 { |
|
469 TCamOrientation orientation = appUi->CamOrientation(); |
|
470 |
|
471 if( iCamOrientation != orientation ) |
|
472 { |
|
473 iCamOrientation = orientation; |
|
474 if( orientation == ECamOrientationCamcorder || orientation == ECamOrientationCamcorderLeft ) |
|
475 { |
|
476 PRINT( _L("Camera => CCamContainerBase::HandleResourceChange camcorder" )) |
|
477 SetRect( appUi->ApplicationRect() ); |
|
478 } |
|
479 else |
|
480 { |
|
481 PRINT( _L("Camera => CCamContainerBase::HandleResourceChange not camcorder" )) |
|
482 SetRect( appUi->ClientRect() ); |
|
483 } |
|
484 } |
|
485 } |
|
486 |
|
487 CCoeControl::HandleResourceChange( aType ); |
|
488 if ( iController.IsTouchScreenSupported() ) |
|
489 { |
|
490 // Update toolbar because HandleResourceChange might reload the default version |
|
491 // Only update toolbaricons if in precaptureview. |
|
492 if( appUi->CurrentViewState() != ECamViewStatePostCapture ) |
|
493 { |
|
494 TRAP_IGNORE( static_cast<CCamViewBase&>( iView ).UpdateToolbarIconsL() ); |
|
495 } |
|
496 } |
|
497 } |
|
498 |
|
499 |
|
500 // virtual |
|
501 void |
|
502 CCamContainerBase::HandleAppEvent( const TCamAppEvent& /*aEvent*/ ) |
|
503 { |
|
504 // No action |
|
505 } |
|
506 |
|
507 |
|
508 // --------------------------------------------------------------------------- |
|
509 // CCamContainerBase::SetPreviousViewId |
|
510 // Sets the ID of the previous view |
|
511 // --------------------------------------------------------------------------- |
|
512 // |
|
513 void CCamContainerBase::SetPreviousViewId( TCamAppViewIds aId ) |
|
514 { |
|
515 iPrevViewId = aId; |
|
516 } |
|
517 |
|
518 |
|
519 // --------------------------------------------------------- |
|
520 // CCamContainerBase::SetupNaviPanesL |
|
521 // Set up navi-pane and progress bar if required |
|
522 // --------------------------------------------------------- |
|
523 // |
|
524 void CCamContainerBase::SetupNaviPanesL( TCamActiveNaviPane aNaviPane ) |
|
525 { |
|
526 PRINT( _L("Camera => CCamContainerBase::SetupNaviPanesL" )) |
|
527 TRect rect( Rect() ); |
|
528 |
|
529 if( aNaviPane == ECamPaneCounter ) |
|
530 { |
|
531 iNaviCounterControl = |
|
532 static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() )->NaviCounterControl(); |
|
533 iNaviCounterControl->SetMopParent( this ); |
|
534 iNaviCounterControl->SetContainerWindowL( *this ); |
|
535 iNaviCounterControl->SetRect( Rect() ); |
|
536 iNaviCounterControl->MakeVisible( ETrue ); |
|
537 if ( iNaviProgressBarControl ) |
|
538 { |
|
539 iNaviProgressBarControl->MakeVisible( EFalse ); |
|
540 } |
|
541 |
|
542 iPaneInUse = ECamPaneCounter; |
|
543 } |
|
544 else if( aNaviPane == ECamPaneProgress ) |
|
545 { |
|
546 PRINT( _L("Camera => CCamContainerBase::SetupNaviPanesL progress" )) |
|
547 iNaviProgressBarControl = |
|
548 static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() )->NaviProgressBarControl(); |
|
549 iNaviProgressBarControl->SetMopParent( this ); |
|
550 iNaviProgressBarControl->SetContainerWindowL( *this ); |
|
551 iNaviProgressBarControl->SetRect( Rect() ); |
|
552 iNaviProgressBarControl->MakeVisible( ETrue ); |
|
553 if ( iNaviCounterControl ) |
|
554 { |
|
555 iNaviCounterControl->MakeVisible( EFalse ); |
|
556 } |
|
557 |
|
558 iPaneInUse = ECamPaneProgress; |
|
559 } |
|
560 else |
|
561 { |
|
562 iPaneInUse = ECamPaneUndefined; |
|
563 } |
|
564 PRINT( _L("Camera <= CCamContainerBase::SetupNaviPanesL" )) |
|
565 } |
|
566 |
|
567 // --------------------------------------------------------------------------- |
|
568 // CCamContainerBase::ShowZoomPaneWithTimer |
|
569 // Makes Zoom Pane visible for the period of the pane timer. |
|
570 // --------------------------------------------------------------------------- |
|
571 // |
|
572 void CCamContainerBase::ShowZoomPaneWithTimer() |
|
573 { |
|
574 // No implementation: only meaningful in pre-capture modes |
|
575 PRINT(_L("Camera => CCamContainerBase::ShowZoomPaneWithTimer() - No implementation!")); |
|
576 } |
|
577 |
|
578 // --------------------------------------------------------------------------- |
|
579 // CCamContainerBase::CreateActivePaletteL |
|
580 // Creates the Active Palette control |
|
581 // --------------------------------------------------------------------------- |
|
582 // |
|
583 void CCamContainerBase::CreateActivePaletteL() |
|
584 { |
|
585 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
586 appUi->APHandler()->CreateActivePaletteL( *this, this ); |
|
587 iActivePalette = appUi->ActivePalette(); |
|
588 } |
|
589 |
|
590 // --------------------------------------------------------------------------- |
|
591 // CCamContainerBase::DestroyActivePaletteL |
|
592 // Destroys the Active Palette control |
|
593 // --------------------------------------------------------------------------- |
|
594 // |
|
595 void CCamContainerBase::DestroyActivePalette() |
|
596 { |
|
597 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
598 appUi->APHandler()->DestroyActivePalette(); |
|
599 iActivePalette = NULL; |
|
600 } |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // CCamContainerBase::Redraw |
|
604 // ----------------------------------------------------------------------------- |
|
605 void CCamContainerBase::Redraw(const TRect& /*aArea*/) |
|
606 { |
|
607 // Do nothing by default; may be overridden |
|
608 } |
|
609 |
|
610 |
|
611 |
|
612 // ----------------------------------------------------------------------------- |
|
613 // CCamContainerBase::PrepareProcessingTextL |
|
614 // ----------------------------------------------------------------------------- |
|
615 // |
|
616 void CCamContainerBase::PrepareProcessingTextL( TBool aStillMode ) |
|
617 { |
|
618 TAknLayoutRect vidProgressPane; |
|
619 |
|
620 TInt cba = AknLayoutUtils::CbaLocation() == |
|
621 AknLayoutUtils::EAknCbaLocationLeft? |
|
622 AknLayoutUtils::EAknCbaLocationLeft : 0; |
|
623 |
|
624 if ( CamUtility::IsNhdDevice() ) |
|
625 { |
|
626 vidProgressPane.LayoutRect( Rect(), |
|
627 AknLayoutScalable_Apps::vid4_progress_pane( |
|
628 Layout_Meta_Data::IsLandscapeOrientation() ) ); |
|
629 |
|
630 iProcessingTextLayout.LayoutText( vidProgressPane.Rect(), |
|
631 AknLayoutScalable_Apps::vid4_progress_pane_t3()); |
|
632 } |
|
633 else |
|
634 { |
|
635 vidProgressPane.LayoutRect( Rect(), |
|
636 AknLayoutScalable_Apps::vid6_indi_pane( cba ) ); |
|
637 |
|
638 iProcessingTextLayout.LayoutText( vidProgressPane.Rect(), |
|
639 AknLayoutScalable_Apps::vid6_indi_pane_t4( 2 )); |
|
640 } |
|
641 |
|
642 // Delete old text |
|
643 if( iProcessingText ) |
|
644 { |
|
645 delete iProcessingText; |
|
646 iProcessingText = NULL; |
|
647 } |
|
648 if( aStillMode ) |
|
649 { |
|
650 iProcessingText = StringLoader::LoadL( R_QTN_PROCESSING_IMAGE_TEXT ); |
|
651 } |
|
652 /* |
|
653 else |
|
654 { |
|
655 iProcessingText = StringLoader::LoadL( R_QTN_PROCESSING_VIDEO_TEXT ); |
|
656 } |
|
657 */ |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CCamContainerBase::DismissProcessingTextL |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 void CCamContainerBase::DismissProcessingText() |
|
665 { |
|
666 delete iProcessingText; |
|
667 iProcessingText = NULL; |
|
668 } |
|
669 |
|
670 // ----------------------------------------------------------------------------- |
|
671 // CCamContainerBase::PrepareBurstProcessingTextL |
|
672 // ----------------------------------------------------------------------------- |
|
673 // |
|
674 void CCamContainerBase::PrepareBurstProcessingTextL() |
|
675 { |
|
676 PRINT( _L("Camera => CCamContainerBase::PrepareBurstProcessingTextL" )) |
|
677 TAknLayoutRect vidProgressPane; |
|
678 |
|
679 TInt cba = AknLayoutUtils::CbaLocation() == |
|
680 AknLayoutUtils::EAknCbaLocationLeft? |
|
681 AknLayoutUtils::EAknCbaLocationLeft : 0; |
|
682 |
|
683 |
|
684 if ( CamUtility::IsNhdDevice() ) |
|
685 { |
|
686 vidProgressPane.LayoutRect( |
|
687 Rect(), |
|
688 AknLayoutScalable_Apps::vid4_progress_pane( |
|
689 Layout_Meta_Data::IsLandscapeOrientation() ) ); |
|
690 |
|
691 iBurstProcessingTextLayout.LayoutText( |
|
692 vidProgressPane.Rect(), |
|
693 AknLayoutScalable_Apps::vid4_progress_pane_t3() ); |
|
694 } |
|
695 else |
|
696 { |
|
697 |
|
698 vidProgressPane.LayoutRect( |
|
699 Rect(), |
|
700 AknLayoutScalable_Apps::vid6_indi_pane( cba ) ); |
|
701 |
|
702 iBurstProcessingTextLayout.LayoutText( |
|
703 vidProgressPane.Rect(), |
|
704 AknLayoutScalable_Apps::vid6_indi_pane_t4( 2 ) ); |
|
705 |
|
706 } |
|
707 |
|
708 // Delete old text |
|
709 if( iBurstProcessingText ) |
|
710 { |
|
711 delete iBurstProcessingText; |
|
712 iBurstProcessingText = NULL; |
|
713 } |
|
714 iBurstProcessingText = StringLoader::LoadL( |
|
715 R_QTN_PROCESSING_IMAGE_TEXT ); |
|
716 PRINT( _L("Camera <= CCamContainerBase::PrepareBurstProcessingTextL" )) |
|
717 } |
|
718 |
|
719 // ----------------------------------------------------------------------------- |
|
720 // CCamContainerBase::UpdateBurstProcessingTextL |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 void CCamContainerBase::UpdateBurstProcessingTextL( TInt aHandled, TInt aTotal ) |
|
724 { |
|
725 PRINT( _L("Camera => CCamContainerBase::UpdateBurstProcessingTextL" )) |
|
726 |
|
727 // Delete old text |
|
728 if( iBurstProcessingText ) |
|
729 { |
|
730 delete iBurstProcessingText; |
|
731 iBurstProcessingText = NULL; |
|
732 } |
|
733 CDesCArrayFlat* values |
|
734 = new (ELeave) CDesCArrayFlat( 2 ); |
|
735 |
|
736 CleanupStack::PushL( values ); |
|
737 |
|
738 TBuf<KCamBurstCounterLength> handled; |
|
739 TBuf<KCamBurstCounterLength> total; |
|
740 handled.Format( KCamBurstCounterFormat, aHandled ); |
|
741 total.Format( KCamBurstCounterFormat, aTotal ); |
|
742 |
|
743 values->AppendL( handled ); |
|
744 values->AppendL( total ); |
|
745 |
|
746 #ifndef __WINS__ |
|
747 iBurstProcessingText = StringLoader::LoadL( |
|
748 R_QTN_PROCESSING_BURST_IMAGE_TEXT, *values ); |
|
749 #endif |
|
750 |
|
751 CleanupStack::PopAndDestroy( values ); |
|
752 PRINT( _L("Camera <= CCamContainerBase::UpdateBurstProcessingTextL" )) |
|
753 } |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
|
756 // CCamContainerBase::DismissBurstProcessingText |
|
757 // ----------------------------------------------------------------------------- |
|
758 // |
|
759 void CCamContainerBase::DismissBurstProcessingText() |
|
760 { |
|
761 delete iBurstProcessingText; |
|
762 iBurstProcessingText = NULL; |
|
763 } |
|
764 |
|
765 // ---------------------------------------------------- |
|
766 // CCamContainerBase::CheckForFileName |
|
767 // |
|
768 // ---------------------------------------------------- |
|
769 // |
|
770 void CCamContainerBase::CheckForFileName( TBool aDoCheck ) |
|
771 { |
|
772 } |
|
773 |
|
774 // ----------------------------------------------------------------------------- |
|
775 // CCamContainerBase::CreateBackgroundContextL |
|
776 // ----------------------------------------------------------------------------- |
|
777 // |
|
778 void CCamContainerBase::CreateBackgroundContextL() |
|
779 { |
|
780 if( iCamOrientation == ECamOrientationCamcorder || |
|
781 iCamOrientation == ECamOrientationCamcorderLeft ) |
|
782 { |
|
783 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
784 KAknsIIDQsnBgScreen, Rect(), EFalse ); |
|
785 } |
|
786 else |
|
787 { |
|
788 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
|
789 KAknsIIDQsnBgAreaMain, Rect(), EFalse ); |
|
790 } |
|
791 } |
|
792 |
|
793 // ----------------------------------------------------------------------------- |
|
794 // CCamContainerBase::ViewFinderFrameRect |
|
795 // ----------------------------------------------------------------------------- |
|
796 // |
|
797 TRect |
|
798 CCamContainerBase::ViewFinderFrameRect(TCamCameraMode aTargetMode) const |
|
799 { |
|
800 PRINT( _L("Camera => CCamContainerBase::ViewFinderFrameRect") ); |
|
801 const TCamAppViewIds viewId = static_cast<TCamAppViewIds>( iView.Id().iUid ); |
|
802 |
|
803 TCamCameraMode cameraMode = (aTargetMode != ECamControllerIdle) |
|
804 ? aTargetMode |
|
805 : iController.CurrentMode(); |
|
806 |
|
807 // In post capture view both target and current mode can be in idle mode, which |
|
808 // would cause the use of invalid viewfinder layouts |
|
809 if ( viewId == ECamViewIdVideoPostCapture && cameraMode == ECamControllerIdle ) |
|
810 { |
|
811 cameraMode = ECamControllerVideo; |
|
812 } |
|
813 else if ( viewId == ECamViewIdStillPostCapture && cameraMode == ECamControllerIdle ) |
|
814 { |
|
815 cameraMode = ECamControllerImage; |
|
816 } |
|
817 |
|
818 const TInt resolution = (cameraMode == ECamControllerVideo) |
|
819 ? iController.GetCurrentVideoResolution() |
|
820 : iController.GetCurrentImageResolution(); |
|
821 |
|
822 TRect rect = CamUtility::ViewfinderLayout( cameraMode, resolution ); |
|
823 PRINT( _L("Camera <= CCamContainerBase::ViewFinderFrameRect") ); |
|
824 return rect; |
|
825 } |
|
826 |
|
827 // ----------------------------------------------------------------------------- |
|
828 // CCamContainerBase::IsPrimaryCameraCaptureKey |
|
829 // ----------------------------------------------------------------------------- |
|
830 // |
|
831 TBool CCamContainerBase::IsPrimaryCameraCaptureKey( const TKeyEvent& aKeyEvent ) const |
|
832 { |
|
833 TBool isCapturekey( KErrNotFound != iPrimaryCameraCaptureKeys.Find( aKeyEvent.iScanCode ) ); |
|
834 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
835 if ( appUi |
|
836 && ( !appUi->IsToolBarVisible() || !appUi->DrawPreCaptureCourtesyUI() ) |
|
837 && ( aKeyEvent.iScanCode == EStdKeyDevice3 |
|
838 || aKeyEvent.iScanCode == EStdKeyEnter ) |
|
839 && !static_cast<CCamViewBase*>(&iView)->IsPostCapture() ) { |
|
840 isCapturekey = ETrue; |
|
841 } |
|
842 return isCapturekey; |
|
843 } |
|
844 |
|
845 // ----------------------------------------------------------------------------- |
|
846 // CCamContainerBase::IsSecondaryCameraCaptureKey |
|
847 // ----------------------------------------------------------------------------- |
|
848 // |
|
849 TBool CCamContainerBase::IsSecondaryCameraCaptureKey( const TKeyEvent& aKeyEvent ) const |
|
850 { |
|
851 TBool isCapturekey( KErrNotFound != iSecondaryCameraCaptureKeys.Find( aKeyEvent.iScanCode ) ); |
|
852 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
|
853 if ( appUi |
|
854 && !appUi->IsToolBarVisible() |
|
855 && ( aKeyEvent.iScanCode == EStdKeyDevice3 |
|
856 || aKeyEvent.iScanCode == EStdKeyEnter ) |
|
857 && !static_cast<CCamViewBase*>(&iView)->IsPostCapture() ) { |
|
858 isCapturekey = ETrue; |
|
859 } |
|
860 return isCapturekey; |
|
861 } |
|
862 |
|
863 // ----------------------------------------------------------------------------- |
|
864 // CCamContainerBase::CountComponentControls |
|
865 // ----------------------------------------------------------------------------- |
|
866 // |
|
867 TInt CCamContainerBase::CountComponentControls() const |
|
868 { |
|
869 TInt index = 0; |
|
870 if(iBackupContainer) |
|
871 index++; |
|
872 return index; |
|
873 } |
|
874 |
|
875 // ----------------------------------------------------------------------------- |
|
876 // CCamContainerBase::ComponentControl |
|
877 // ----------------------------------------------------------------------------- |
|
878 // |
|
879 CCoeControl* CCamContainerBase::ComponentControl(TInt aIndex) const |
|
880 { |
|
881 CCoeControl* control = NULL; |
|
882 switch(aIndex) |
|
883 { |
|
884 case 0: |
|
885 { |
|
886 control = iBackupContainer; |
|
887 } |
|
888 break; |
|
889 default: |
|
890 break; |
|
891 } |
|
892 return control; |
|
893 } |
|
894 |
|
895 // End of File |