54
|
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: Container class for video image pre-capture view*
|
|
15 |
*/
|
|
16 |
|
|
17 |
// INCLUDE FILES
|
|
18 |
#include "CamAppUiBase.h"
|
|
19 |
#include "CamVideoPreCaptureContainer.h"
|
|
20 |
#include "CamLogger.h"
|
|
21 |
#include "CamPanic.h"
|
|
22 |
#include "CamUtility.h"
|
|
23 |
#include "CamAppUi.h"
|
|
24 |
#include "CamSidePane.h"
|
|
25 |
#include "CamNaviProgressBarControl.h"
|
|
26 |
#include "CamViewBase.h"
|
|
27 |
#include "CamIndicator.h"
|
|
28 |
#include "CamIndicatorData.h"
|
|
29 |
#include "CamIndicatorResourceReader.h"
|
|
30 |
#include "CameraUiConfigManager.h"
|
|
31 |
#include "camactivepalettehandler.h"
|
|
32 |
#include <eikenv.h>
|
|
33 |
#include <cameraapp.mbg>
|
|
34 |
#include <eikappui.h> // For CCoeAppUiBase
|
|
35 |
#include <eikapp.h> // For CEikApplication
|
|
36 |
#include <AknIconUtils.h>
|
|
37 |
#include <akntoolbar.h>
|
|
38 |
#include <akntoolbarextension.h>
|
|
39 |
#include <barsread.h>
|
|
40 |
#include <cameraapp.rsg>
|
|
41 |
#include <vgacamsettings.rsg>
|
|
42 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
43 |
#include <layoutmetadata.cdl.h>
|
|
44 |
#include <touchfeedback.h>
|
|
45 |
#include "OstTraceDefinitions.h"
|
|
46 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
47 |
#include "CamVideoPreCaptureContainerTraces.h"
|
|
48 |
#endif
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
// ================= MEMBER FUNCTIONS =======================
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// CCamVideoPreCaptureContainer::NewL
|
|
56 |
// Symbian OS two-phased constructor
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
CCamVideoPreCaptureContainer* CCamVideoPreCaptureContainer::NewL(
|
|
60 |
CCamAppController& aController,
|
|
61 |
CAknView& aView,
|
|
62 |
const TRect& aRect )
|
|
63 |
{
|
|
64 |
CCamVideoPreCaptureContainer* self = new( ELeave ) CCamVideoPreCaptureContainer(
|
|
65 |
aController, aView );
|
|
66 |
|
|
67 |
CleanupStack::PushL( self );
|
|
68 |
self->ConstructL( aRect );
|
|
69 |
CleanupStack::Pop( self );
|
|
70 |
// Return newly created CCamVideoPreCaptureContainer instance
|
|
71 |
return self;
|
|
72 |
}
|
|
73 |
|
|
74 |
// Destructor
|
|
75 |
CCamVideoPreCaptureContainer::~CCamVideoPreCaptureContainer()
|
|
76 |
{
|
|
77 |
PRINT( _L("Camera => ~CCamVideoPreCaptureContainer") );
|
|
78 |
if ( iFeedback )
|
|
79 |
{
|
|
80 |
iFeedback->RemoveFeedbackForControl( this );
|
|
81 |
}
|
|
82 |
delete iFileTypeIndicator;
|
|
83 |
PRINT( _L("Camera <= ~CCamVideoPreCaptureContainer") );
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------
|
|
87 |
// CCamVideoPreCaptureContainer::ConstructL
|
|
88 |
// Symbian OS 2nd phase constructor
|
|
89 |
// ---------------------------------------------------------
|
|
90 |
//
|
|
91 |
void CCamVideoPreCaptureContainer::ConstructL( const TRect& aRect )
|
|
92 |
{
|
|
93 |
PRINT( _L("Camera => CCamVideoPreCaptureContainer::ConstructL"))
|
|
94 |
TCamVideoResolution res = iController.GetCurrentVideoResolution();
|
|
95 |
iVFRes = iController.VideoViewFinderResourceId( res );
|
|
96 |
|
|
97 |
BaseConstructL( aRect );
|
|
98 |
iShowReticule = EFalse;
|
|
99 |
|
|
100 |
iSidePane->SetCaptureMode( ECamControllerVideo );
|
|
101 |
|
|
102 |
CreateFiletypeIndicatorL();
|
|
103 |
|
|
104 |
iRecordState = ECamNotRecording;
|
|
105 |
|
|
106 |
// Get the co-ordinates where the resolution
|
|
107 |
// icon should move to during video capture
|
|
108 |
TAknLayoutRect layoutRect;
|
|
109 |
TRect rect;
|
|
110 |
TAknLayoutRect vidProgressPane;
|
|
111 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
112 |
{
|
|
113 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
|
|
114 |
}
|
|
115 |
else
|
|
116 |
{
|
|
117 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
|
|
118 |
}
|
|
119 |
if ( CamUtility::IsNhdDevice() )
|
|
120 |
{
|
|
121 |
TInt variant = Layout_Meta_Data::IsLandscapeOrientation();
|
|
122 |
vidProgressPane.LayoutRect( rect,
|
|
123 |
AknLayoutScalable_Apps::vid4_progress_pane( variant ) );
|
|
124 |
layoutRect.LayoutRect( vidProgressPane.Rect(),
|
|
125 |
AknLayoutScalable_Apps::vid4_progress_pane_g1() );
|
|
126 |
}
|
|
127 |
else
|
|
128 |
{
|
|
129 |
TInt cba = AknLayoutUtils::CbaLocation() ==
|
|
130 |
AknLayoutUtils::EAknCbaLocationLeft;
|
|
131 |
vidProgressPane.LayoutRect( rect,
|
|
132 |
AknLayoutScalable_Apps::vid6_indi_pane( cba ) );
|
|
133 |
layoutRect.LayoutRect( vidProgressPane.Rect(),
|
|
134 |
AknLayoutScalable_Apps::vid6_indi_pane_g1( !cba ) );// quality
|
|
135 |
}
|
|
136 |
|
|
137 |
iResolutionIndicatorVidcapPosition = layoutRect.Rect();
|
|
138 |
if ( !iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() )
|
|
139 |
{
|
|
140 |
static_cast<CCamPreCaptureContainerBase*>( this )
|
|
141 |
->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
|
|
142 |
}
|
|
143 |
|
|
144 |
if ( iController.IsTouchScreenSupported() )
|
|
145 |
{
|
|
146 |
// Get pointer of touch feedback instance
|
|
147 |
iFeedback = MTouchFeedback::Instance();
|
|
148 |
if ( !iFeedback )
|
|
149 |
iFeedback = MTouchFeedback::CreateInstanceL();
|
|
150 |
}
|
|
151 |
}
|
|
152 |
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
// CCamVideoPreCaptureContainer::CCamVideoPreCaptureContainer
|
|
155 |
// C++ constructor
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
|
|
159 |
CCamVideoPreCaptureContainer::CCamVideoPreCaptureContainer(
|
|
160 |
CCamAppController& aController,
|
|
161 |
CAknView& aView )
|
|
162 |
: CCamPreCaptureContainerBase( aController, aView )
|
|
163 |
{
|
|
164 |
}
|
|
165 |
|
|
166 |
// ---------------------------------------------------------
|
|
167 |
// CCamVideoPreCaptureContainer::HandleControllerEventL
|
|
168 |
// Receives notifications about changes in recording state from the controller
|
|
169 |
// ---------------------------------------------------------
|
|
170 |
//
|
|
171 |
void
|
|
172 |
CCamVideoPreCaptureContainer
|
|
173 |
::HandleControllerEventL( TCamControllerEvent aEvent, TInt aError )
|
|
174 |
{
|
|
175 |
PRINT1( _L("Camera => CCamVideoPreCaptureContainer::HandleControllerEventL aEvent:%d"), aEvent )
|
|
176 |
switch( aEvent )
|
|
177 |
{
|
|
178 |
// ---------------------------------------------------
|
|
179 |
case ECamEventOperationStateChanged:
|
|
180 |
{
|
|
181 |
TCamCaptureOperation operation = iController.CurrentOperation();
|
|
182 |
switch( operation )
|
|
183 |
{
|
|
184 |
case ECamCapturing:
|
|
185 |
{
|
|
186 |
if ( iController.IsTouchScreenSupported() && iFeedback )
|
|
187 |
{
|
|
188 |
iFeedback->SetFeedbackEnabledForThisApp( EFalse );
|
|
189 |
}
|
|
190 |
iRecordState = ECamRecording;
|
|
191 |
iResolutionIndicators[iCurrentIndicator]->SetRect(iResolutionIndicatorVidcapPosition);
|
|
192 |
break;
|
|
193 |
}
|
|
194 |
case ECamPaused:
|
|
195 |
{
|
|
196 |
iRecordState = ECamRecordPaused;
|
|
197 |
break;
|
|
198 |
}
|
|
199 |
default:
|
|
200 |
{
|
|
201 |
iRecordState = ECamNotRecording;
|
|
202 |
break;
|
|
203 |
}
|
|
204 |
}
|
|
205 |
break;
|
|
206 |
}
|
|
207 |
// ---------------------------------------------------
|
|
208 |
case ECamEventLocationSettingChanged:
|
|
209 |
{
|
|
210 |
// If the location setting was changed on, then the indicator should be visible
|
|
211 |
SetLocationIndicatorVisibility();
|
|
212 |
}
|
|
213 |
// ---------------------------------------------------
|
|
214 |
case ECamEventCameraChanged:
|
|
215 |
{
|
|
216 |
SetFileTypeIndicator();
|
|
217 |
break;
|
|
218 |
}
|
|
219 |
// ---------------------------------------------------
|
|
220 |
case ECamEventVideoFileTypeChanged:
|
|
221 |
{
|
|
222 |
SetResolutionIndicator();
|
|
223 |
SetFileTypeIndicator();
|
|
224 |
break;
|
|
225 |
}
|
|
226 |
// ---------------------------------------------------
|
|
227 |
case ECamEventVideoQualityChanged:
|
|
228 |
{
|
|
229 |
// To get correct viewfinder resolution:
|
|
230 |
// TCamVideoResolution res = iController.GetCurrentVideoResolution();
|
|
231 |
// iVFRes = iController.VideoViewFinderResourceId( res );
|
|
232 |
SetResolutionIndicator();
|
|
233 |
}
|
|
234 |
// ---------------------------------------------------
|
|
235 |
case ECamEventRecordComplete:
|
|
236 |
{
|
|
237 |
iResolutionIndicators[iCurrentIndicator]->SetRect( ResolutionIndicatorRect() );
|
|
238 |
iFileTypeIndicator->SetRect( iFileTypeIndicatorPosition );
|
|
239 |
if ( iController.IsTouchScreenSupported() && iFeedback )
|
|
240 |
{
|
|
241 |
iFeedback->SetFeedbackEnabledForThisApp( ETrue, ETrue );
|
|
242 |
}
|
|
243 |
break;
|
|
244 |
}
|
|
245 |
// ---------------------------------------------------
|
|
246 |
case ECamEventInitReady:
|
|
247 |
{
|
|
248 |
// event only sent if UIOrientationOverride feature is supported
|
|
249 |
if ( !iController.IsTouchScreenSupported() &&
|
|
250 |
iController.CurrentMode()== ECamControllerVideo )
|
|
251 |
{
|
|
252 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
|
|
253 |
if ( appUi )
|
|
254 |
{
|
|
255 |
if ( !appUi->ActivePalette() )
|
|
256 |
{
|
|
257 |
OstTrace0( CAMERAAPP_PERFORMANCE, CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 1" );
|
|
258 |
static_cast<CCamPreCaptureContainerBase*>( this )
|
|
259 |
->SetupActivePaletteL( static_cast<CCamViewBase*>(&iView) );
|
|
260 |
OstTrace0( CAMERAAPP_PERFORMANCE, DUP1_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_SETUP 0" );
|
|
261 |
}
|
|
262 |
else
|
|
263 |
{
|
|
264 |
OstTrace0( CAMERAAPP_PERFORMANCE, DUP2_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 1" );
|
|
265 |
appUi->APHandler()->UpdateActivePaletteL();
|
|
266 |
OstTrace0( CAMERAAPP_PERFORMANCE, DUP3_CCAMVIDEOPRECAPTURECONTAINER_HANDLECONTROLLEREVENTL, "e_CAM_APP_AP_UPDATE 0" );
|
|
267 |
}
|
|
268 |
appUi->SetActivePaletteVisibility( ETrue );
|
|
269 |
}
|
|
270 |
}
|
|
271 |
break;
|
|
272 |
}
|
|
273 |
// ---------------------------------------------------
|
|
274 |
default:
|
|
275 |
{
|
|
276 |
// otherwise, do nothing
|
|
277 |
}
|
|
278 |
// ---------------------------------------------------
|
|
279 |
}
|
|
280 |
|
|
281 |
CCamPreCaptureContainerBase::HandleControllerEventL( aEvent, aError );
|
|
282 |
PRINT( _L("Camera <= CCamVideoPreCaptureContainer::HandleControllerEventL"))
|
|
283 |
}
|
|
284 |
|
|
285 |
// ---------------------------------------------------------
|
|
286 |
// CCamVideoPreCaptureContainer::HandleForegroundEventL
|
|
287 |
// Handle events sending app to foreground and background
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
|
|
290 |
void CCamVideoPreCaptureContainer::HandleForegroundEventL( TBool aForeground )
|
|
291 |
{
|
|
292 |
CCamPreCaptureContainerBase::HandleForegroundEventL( aForeground );
|
|
293 |
}
|
|
294 |
|
|
295 |
|
|
296 |
// ---------------------------------------------------------
|
|
297 |
// CCamVideoPreCaptureContainer::ViewFinderLayoutResourceIds
|
|
298 |
// Return the layout resource id for the viewfinder
|
|
299 |
// (Note: reticule not required for video viewfinder)
|
|
300 |
// ---------------------------------------------------------
|
|
301 |
//
|
|
302 |
void CCamVideoPreCaptureContainer::ViewFinderLayoutResourceIds(
|
|
303 |
TInt& aViewFinderLayoutId,
|
|
304 |
TInt& /*aReticuleLayoutId*/ ) const
|
|
305 |
{
|
|
306 |
aViewFinderLayoutId = iVFRes;
|
|
307 |
}
|
|
308 |
|
|
309 |
// ---------------------------------------------------------
|
|
310 |
// CCamVideoPreCaptureContainer::SetResolutionIndicator
|
|
311 |
// Sets the resolution indictator to the required icon
|
|
312 |
// ---------------------------------------------------------
|
|
313 |
//
|
|
314 |
void CCamVideoPreCaptureContainer::SetResolutionIndicator()
|
|
315 |
{
|
|
316 |
iCurrentIndicator = iController.IntegerSettingValue( ECamSettingItemVideoQuality );
|
|
317 |
}
|
|
318 |
|
|
319 |
// ---------------------------------------------------------
|
|
320 |
// CCamStillPreCaptureContainer::SetLocationIndicatorVisibility
|
|
321 |
// Sets the resolution indicator visibility, if it is set or not.
|
|
322 |
// Do nothing if video taken.
|
|
323 |
// ---------------------------------------------------------
|
|
324 |
//
|
|
325 |
void CCamVideoPreCaptureContainer::SetLocationIndicatorVisibility()
|
|
326 |
{
|
|
327 |
// The setting stored is an index of whether the location setting is on or off
|
|
328 |
iLocationIndicatorVisible = (/*TCamLocationId::ECamLocationOn*/1 == iController.IntegerSettingValue( ECamSettingItemRecLocation ));
|
|
329 |
}
|
|
330 |
|
|
331 |
// ----------------------------------------------------
|
|
332 |
// CCamStillPreCaptureContainer::LocationtionIndicatorRect
|
|
333 |
// Returns the rectangle defining the position and size
|
|
334 |
// of the location icon
|
|
335 |
// ----------------------------------------------------
|
|
336 |
//
|
|
337 |
TRect CCamVideoPreCaptureContainer::LocationIndicatorRect()
|
|
338 |
{
|
|
339 |
TAknLayoutRect layoutRect;
|
|
340 |
//layoutRect.LayoutRect( Rect(), ROID(R_CAM_VIDEO_PRECAP_LOCATION_ID) );
|
|
341 |
return layoutRect.Rect();
|
|
342 |
}
|
|
343 |
|
|
344 |
// ----------------------------------------------------
|
|
345 |
// CCamVideoPreCaptureContainer::IncreaseFlashSettingL
|
|
346 |
// Move up through the flash settings
|
|
347 |
// ----------------------------------------------------
|
|
348 |
//
|
|
349 |
void CCamVideoPreCaptureContainer::IncreaseFlashSettingL()
|
|
350 |
{
|
|
351 |
if ( iController.UiConfigManagerPtr()->IsVideoLightSupported() )
|
|
352 |
{
|
|
353 |
CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() );
|
|
354 |
if ( !iZoomPane->IsVisible()
|
|
355 |
&& !appUi->IsSecondCameraEnabled()
|
|
356 |
)
|
|
357 |
{
|
|
358 |
TCamFlashId flash =
|
|
359 |
static_cast< TCamFlashId >
|
|
360 |
( iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) );
|
|
361 |
if ( flash == ECamFlashForced )
|
|
362 |
{
|
|
363 |
flash = ECamFlashOff;
|
|
364 |
}
|
|
365 |
else
|
|
366 |
{
|
|
367 |
flash = ECamFlashForced;
|
|
368 |
}
|
|
369 |
iController.SetIntegerSettingValueL(ECamSettingItemDynamicVideoFlash, flash);
|
|
370 |
}
|
|
371 |
} // video light supported check
|
|
372 |
}
|
|
373 |
|
|
374 |
// ----------------------------------------------------
|
|
375 |
// CCamVideoPreCaptureContainer::DecreaseFlashSettingL
|
|
376 |
// Move down through the flash settings
|
|
377 |
// ----------------------------------------------------
|
|
378 |
//
|
|
379 |
void CCamVideoPreCaptureContainer::DecreaseFlashSettingL()
|
|
380 |
{
|
|
381 |
//Given we have two flash modes in video, Increase and Decrease are functionally equivalent
|
|
382 |
IncreaseFlashSettingL();
|
|
383 |
}
|
|
384 |
|
|
385 |
// ----------------------------------------------------
|
|
386 |
// CCamVideoPreCaptureContainer::HandleCaptureKeyEventL
|
|
387 |
// Change the current capture state
|
|
388 |
// ----------------------------------------------------
|
|
389 |
//
|
|
390 |
TKeyResponse
|
|
391 |
CCamVideoPreCaptureContainer::HandleCaptureKeyEventL( const TKeyEvent& aKeyEvent )
|
|
392 |
{
|
|
393 |
PRINT( _L("Camera => CCamVideoPreCaptureContainer::HandleCaptureKeyEventL") );
|
|
394 |
TKeyResponse keyResponse = EKeyWasNotConsumed;
|
|
395 |
|
|
396 |
// check our current operation state
|
|
397 |
TCamCaptureOperation operation = iController.CurrentOperation();
|
|
398 |
|
|
399 |
if ( (ECamCapturing == operation ) ||
|
|
400 |
(ECamPaused == operation ) )
|
|
401 |
{
|
|
402 |
// iController.StopVideoRecording();
|
|
403 |
// Stop the video recording using ECamCmdStop command,
|
|
404 |
// similarily to what happens when Stop softkey is pressed.
|
|
405 |
iView.HandleCommandL( ECamCmdStop );
|
|
406 |
}
|
|
407 |
|
|
408 |
else if ( iController.VideoRecordPending() )
|
|
409 |
{
|
|
410 |
PRINT( _L("Camera <> Video capture already pending") );
|
|
411 |
// Do nothing if already pending
|
|
412 |
keyResponse = EKeyWasConsumed;
|
|
413 |
}
|
|
414 |
else
|
|
415 |
{
|
|
416 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
|
|
417 |
|
|
418 |
if ( iController.UiConfigManagerPtr()
|
|
419 |
&& !iController.UiConfigManagerPtr()->IsAutoFocusSupported()
|
|
420 |
&& iController.IsTouchScreenSupported() )
|
|
421 |
{
|
|
422 |
CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar();
|
|
423 |
if ( fixedToolbar )
|
|
424 |
{
|
|
425 |
CAknToolbarExtension* extension = fixedToolbar->ToolbarExtension();
|
|
426 |
if ( extension )
|
|
427 |
{
|
|
428 |
extension->SetShown( EFalse );
|
|
429 |
}
|
|
430 |
}
|
|
431 |
}
|
|
432 |
// neither recording nor paused
|
|
433 |
// so attempt to start recording
|
|
434 |
PRINT( _L("Camera <> starting capture") );
|
|
435 |
keyResponse = appUi->StartCaptureL( aKeyEvent );
|
|
436 |
|
|
437 |
// Hide the toolbar if we are capturing
|
|
438 |
if( EKeyWasConsumed == keyResponse )
|
|
439 |
{
|
|
440 |
// Repeated key events (MSK) are ignored.
|
|
441 |
iController.SetDemandKeyRelease( ETrue );
|
|
442 |
|
|
443 |
// fixed toolbar is used only with touch devices
|
|
444 |
if ( iController.IsTouchScreenSupported() )
|
|
445 |
{
|
|
446 |
CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar();
|
|
447 |
if ( fixedToolbar )
|
|
448 |
{
|
|
449 |
fixedToolbar->SetToolbarVisibility( EFalse );
|
|
450 |
}
|
|
451 |
}
|
|
452 |
}
|
|
453 |
}
|
|
454 |
PRINT( _L("Camera <= CCamVideoPreCaptureContainer::HandleCaptureKeyEventL") );
|
|
455 |
return keyResponse;
|
|
456 |
}
|
|
457 |
|
|
458 |
|
|
459 |
// ----------------------------------------------------
|
|
460 |
// virtual InitVfGridL
|
|
461 |
// ----------------------------------------------------
|
|
462 |
void
|
|
463 |
CCamVideoPreCaptureContainer::InitVfGridL( const TRect& /*aRect*/ )
|
|
464 |
{
|
|
465 |
PRINT(_L("CCamVideoPreCaptureContainer::InitVfGridL -->"));
|
|
466 |
// Skip constructing vf grid drawer.
|
|
467 |
// As effect the vf grid is never drawn.
|
|
468 |
PRINT(_L("CCamVideoPreCaptureContainer::InitVfGridL <--"));
|
|
469 |
}
|
|
470 |
|
|
471 |
|
|
472 |
// ----------------------------------------------------
|
|
473 |
// CCamVideoPreCaptureContainer::BlankSoftKeysL
|
|
474 |
// Blank the softkeys
|
|
475 |
// ----------------------------------------------------
|
|
476 |
//
|
|
477 |
void CCamVideoPreCaptureContainer::BlankSoftkeysL()
|
|
478 |
{
|
|
479 |
static_cast<CCamViewBase&>(iView).SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
|
|
480 |
}
|
|
481 |
|
|
482 |
// ----------------------------------------------------
|
|
483 |
// CCamVideoPreCaptureContainer::HandleShutterKeyEventL
|
|
484 |
// Change the current capture state following shutter
|
|
485 |
// key events
|
|
486 |
// ----------------------------------------------------
|
|
487 |
//
|
|
488 |
TKeyResponse CCamVideoPreCaptureContainer::HandleShutterKeyEventL( const TKeyEvent& /*aKeyEvent*/,
|
|
489 |
TEventCode aType )
|
|
490 |
{
|
|
491 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
|
|
492 |
|
|
493 |
if ( appUi &&
|
|
494 |
appUi->CurrentViewState() == ECamViewStatePreCapture &&
|
|
495 |
aType == EEventKeyDown &&
|
|
496 |
iController.IsTouchScreenSupported() )
|
|
497 |
{
|
|
498 |
CAknToolbar* toolbar = appUi->CurrentFixedToolbar();
|
|
499 |
if ( toolbar )
|
|
500 |
{
|
|
501 |
CAknToolbarExtension* toolbarExtension =
|
|
502 |
toolbar->ToolbarExtension();
|
|
503 |
if ( toolbarExtension && toolbarExtension->IsShown() )
|
|
504 |
{
|
|
505 |
toolbarExtension->SetShown( EFalse );
|
|
506 |
return EKeyWasConsumed;
|
|
507 |
}
|
|
508 |
}
|
|
509 |
}
|
|
510 |
|
|
511 |
return EKeyWasNotConsumed;
|
|
512 |
}
|
|
513 |
|
|
514 |
// ---------------------------------------------------------
|
|
515 |
// CCamVideoPreCaptureContainer::DrawAdditionalIcons
|
|
516 |
// Draw the video file type indicator
|
|
517 |
// ---------------------------------------------------------
|
|
518 |
//
|
|
519 |
void CCamVideoPreCaptureContainer::DrawAdditionalIcons(CBitmapContext& aGc) const
|
|
520 |
{
|
|
521 |
|
|
522 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
|
|
523 |
TCamCaptureOperation videoOperation = iController.CurrentVideoOperation();
|
|
524 |
|
|
525 |
// It is essential to check, that the current view state is right.
|
|
526 |
// Draw request could still arrive to precapture view,
|
|
527 |
// when in fact video is stopped and transition to post capture
|
|
528 |
// is in progress. During that time, additional icons should
|
|
529 |
// not be drawn.
|
|
530 |
if( appUi
|
|
531 |
&& appUi->CurrentViewState() == ECamViewStatePreCapture
|
|
532 |
&& appUi->DrawPreCaptureCourtesyUI()
|
|
533 |
&& !appUi->IsSecondCameraEnabled()
|
|
534 |
&& ( CamUtility::IsNhdDevice() || videoOperation == ECamNoOperation )
|
|
535 |
)
|
|
536 |
{
|
|
537 |
iFileTypeIndicator->Draw( aGc );
|
|
538 |
}
|
|
539 |
}
|
|
540 |
|
|
541 |
// ---------------------------------------------------------
|
|
542 |
// CCamVideoPreCaptureContainer::CreateFiletypeIndicatorL
|
|
543 |
// Create the video file type indicator
|
|
544 |
// ---------------------------------------------------------
|
|
545 |
//
|
|
546 |
void CCamVideoPreCaptureContainer::CreateFiletypeIndicatorL()
|
|
547 |
{
|
|
548 |
// Create reader
|
|
549 |
TResourceReader reader;
|
|
550 |
iEikonEnv->CreateResourceReaderLC( reader, ROID(R_CAM_VIDEO_FILETYPE_PANE_ID));
|
|
551 |
CCamIndicatorResourceReader* resourceReader =
|
|
552 |
CCamIndicatorResourceReader::NewLC( reader );
|
|
553 |
|
|
554 |
// Get indicator data from reader (there will be just 1)
|
|
555 |
CCamIndicatorData& indData = *( resourceReader->IndicatorData().At( 0 ) );
|
|
556 |
iFileTypeIndicator = CCamIndicator::NewL( indData.IndicatorRect() );
|
|
557 |
TInt numbitmaps = indData.IndicatorBitmapCount(); // no of bitmaps for indicator
|
|
558 |
TInt j;
|
|
559 |
for ( j = 0; j < numbitmaps; j++ )
|
|
560 |
{
|
|
561 |
// Side pane assumes that mask bitmap is defined after the
|
|
562 |
// normal one in the resource file
|
|
563 |
iFileTypeIndicator->AddIconL(
|
|
564 |
indData.IndicatorBitmapId( j ), // bitmap
|
|
565 |
indData.IndicatorBitmapId( j + 1 )); // mask
|
|
566 |
j++;
|
|
567 |
}
|
|
568 |
|
|
569 |
CleanupStack::PopAndDestroy( resourceReader );
|
|
570 |
CleanupStack::PopAndDestroy(); // reader
|
|
571 |
|
|
572 |
TAknLayoutRect layoutRect;
|
|
573 |
TRect rect;
|
|
574 |
TAknLayoutRect vidProgressPane;
|
|
575 |
TAknLayoutRect fileTypeIconLayout;
|
|
576 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
577 |
{
|
|
578 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
|
|
579 |
}
|
|
580 |
else
|
|
581 |
{
|
|
582 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
|
|
583 |
}
|
|
584 |
if ( CamUtility::IsNhdDevice() )
|
|
585 |
{
|
|
586 |
TInt variant = Layout_Meta_Data::IsLandscapeOrientation();
|
|
587 |
vidProgressPane.LayoutRect( rect,
|
|
588 |
AknLayoutScalable_Apps::vid4_progress_pane( variant ) );
|
|
589 |
layoutRect.LayoutRect( vidProgressPane.Rect(),
|
|
590 |
AknLayoutScalable_Apps::vid4_progress_pane_g2() );
|
|
591 |
}
|
|
592 |
else
|
|
593 |
{
|
|
594 |
TInt cba = AknLayoutUtils::CbaLocation() ==
|
|
595 |
AknLayoutUtils::EAknCbaLocationLeft;
|
|
596 |
vidProgressPane.LayoutRect( rect,
|
|
597 |
AknLayoutScalable_Apps::vid6_indi_pane( cba ) );
|
|
598 |
layoutRect.LayoutRect( vidProgressPane.Rect(),
|
|
599 |
AknLayoutScalable_Apps::vid6_indi_pane_g2( cba ) );// type
|
|
600 |
fileTypeIconLayout = layoutRect;
|
|
601 |
}
|
|
602 |
|
|
603 |
iFileTypeIndicator->SetRect( layoutRect.Rect() );
|
|
604 |
iFileTypeIndicatorPosition = layoutRect.Rect();
|
|
605 |
// Initialise the indicator
|
|
606 |
SetFileTypeIndicator();
|
|
607 |
}
|
|
608 |
|
|
609 |
// ----------------------------------------------------
|
|
610 |
// CCamVideoPreCaptureContainer::SetFileTypeIndicator
|
|
611 |
// Sets the video file type indicator depending on the current
|
|
612 |
// video file type setting.
|
|
613 |
// ----------------------------------------------------
|
|
614 |
//
|
|
615 |
void CCamVideoPreCaptureContainer::SetFileTypeIndicator()
|
|
616 |
{
|
|
617 |
if ( iFileTypeIndicator )
|
|
618 |
{
|
|
619 |
// If the current mode is video then show the relevant icon
|
|
620 |
// for the current video file type.
|
|
621 |
TCamVideoFileType fileType = static_cast< TCamVideoFileType >
|
|
622 |
( iController.IntegerSettingValue( ECamSettingItemVideoFileType ) );
|
|
623 |
if ( fileType == ECamVideoMpeg4 )
|
|
624 |
{
|
|
625 |
iFileTypeIndicator->SetIcon( 0 );
|
|
626 |
}
|
|
627 |
|
|
628 |
// Otherwise display the H263 icon.
|
|
629 |
else
|
|
630 |
{
|
|
631 |
iFileTypeIndicator->SetIcon( 2 );
|
|
632 |
}
|
|
633 |
}
|
|
634 |
}
|
|
635 |
|
|
636 |
// ----------------------------------------------------
|
|
637 |
// CCamVideoPreCaptureContainer::ResolutionIndicatorIconPsiKey
|
|
638 |
// Returns the PSI key relating to the array of resolution
|
|
639 |
// indicator bitmaps.
|
|
640 |
// ----------------------------------------------------
|
|
641 |
//
|
|
642 |
TCamPsiKey CCamVideoPreCaptureContainer::ResolutionIndicatorIconPsiKey() const
|
|
643 |
{
|
|
644 |
return ECamPsiPrecapVideoQualityIconIds;
|
|
645 |
}
|
|
646 |
|
|
647 |
|
|
648 |
|
|
649 |
// ---------------------------------------------------------------------------
|
|
650 |
// virtual GetAPResourceId
|
|
651 |
// (From CCamPreCaptureContainerBase)
|
|
652 |
//
|
|
653 |
// Helper method to select the AP resource used to set AP items.
|
|
654 |
// ---------------------------------------------------------------------------
|
|
655 |
//
|
|
656 |
TInt CCamVideoPreCaptureContainer::GetAPResourceId() const
|
|
657 |
{
|
|
658 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
|
|
659 |
TBool embedded = appUi->IsEmbedded();
|
|
660 |
TInt resId = 0;
|
|
661 |
if( embedded )
|
|
662 |
{
|
|
663 |
if ( !appUi->IsSecondCameraEnabled() )
|
|
664 |
{
|
|
665 |
resId = R_CAM_EMB_VIDEO_PRE_CAPTURE_AP_ITEMS_ADVANCED;
|
|
666 |
}
|
|
667 |
}
|
|
668 |
else
|
|
669 |
{
|
|
670 |
if ( !appUi->IsSecondCameraEnabled() )
|
|
671 |
{
|
|
672 |
resId = R_CAM_VIDEO_PRE_CAPTURE_AP_ITEMS_ADVANCED;
|
|
673 |
}
|
|
674 |
else
|
|
675 |
{
|
|
676 |
resId = R_CAM_VIDEO_PRE_CAPTURE_AP_ITEMS_SECONDARY;
|
|
677 |
}
|
|
678 |
}
|
|
679 |
return resId;
|
|
680 |
}
|
|
681 |
|
|
682 |
// End of File
|