1 /* |
|
2 * Copyright (c) 2007 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: Implements the quality slider for image and video settings* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <gscamerapluginrsc.rsg> |
|
21 #include <cameraapp.mbg> |
|
22 #include <barsread.h> |
|
23 #include <AknQueryValue.h> |
|
24 #include <AknIconUtils.h> |
|
25 #include <StringLoader.h> |
|
26 #include <AknsUtils.h> |
|
27 #include <AknsDrawUtils.h> |
|
28 #include <aknlayoutscalable_apps.cdl.h> |
|
29 #include <akniconconfig.h> |
|
30 #include <akntitle.h> // CAknTitlePane |
|
31 #include <aknappui.h> |
|
32 #include <touchfeedback.h> |
|
33 |
|
34 #include "CamAppUiBase.h" |
|
35 #include "GSCamQualitySettingContainer.h" |
|
36 #include "GSCamQualitySettingSlider.h" |
|
37 #include "CamUtility.h" |
|
38 #include "camuiconstants.h" |
|
39 #include "MCamAppController.h" |
|
40 #include "CamControllerObservers.h" |
|
41 #include "MCamStaticSettings.h" |
|
42 |
|
43 #include "camconfiguration.h" |
|
44 |
|
45 // CONSTANTS |
|
46 const TUint KMaxRemainingImagesShown = 9999; |
|
47 |
|
48 _LIT( KRemainingImagesNumberFormat, "%04d" ); |
|
49 |
|
50 // MACROS |
|
51 |
|
52 |
|
53 // ============================ MEMBER FUNCTIONS =============================== |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CGSCamQualitySettingContainer::CGSCamQualitySettingContainer |
|
57 // C++ default constructor can NOT contain any code, that |
|
58 // might leave. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CGSCamQualitySettingContainer::CGSCamQualitySettingContainer( |
|
62 MCamAppController& aController, |
|
63 TCamCameraMode aMode, |
|
64 CCoeControl* aParent ) |
|
65 : iController( aController ), |
|
66 iParent( aParent ), |
|
67 iMode ( aMode ) |
|
68 { |
|
69 TInt key = (ECamControllerVideo == iMode) |
|
70 ? ECamSettingItemVideoMediaStorage |
|
71 : ECamSettingItemPhotoMediaStorage; |
|
72 // Get the total remaining record time from the controller |
|
73 iStorageLocation = |
|
74 static_cast<TCamMediaStorage>( iController.IntegerSettingValue( key ) ); |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CGSCamQualitySettingContainer::ConstructL |
|
79 // Symbian 2nd phase constructor can leave. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CGSCamQualitySettingContainer::ConstructL() |
|
83 { |
|
84 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( CCoeEnv::Static()->AppUi() ); |
|
85 MCamStaticSettings& model = appUi->StaticSettingsModel(); |
|
86 iController.AddControllerObserverL( this ); |
|
87 |
|
88 TCamSettingItemIds settingType = ( ECamControllerVideo == iMode ) |
|
89 ? ECamSettingItemVideoQuality |
|
90 : ECamSettingItemPhotoQuality; |
|
91 |
|
92 iSlider = CGSCamQualitySettingSlider::NewL( iParent, this, settingType, 0, |
|
93 &(model.Configuration()) ); |
|
94 |
|
95 |
|
96 iSelectedQuality = model.IntegerSettingValue( settingType ); |
|
97 |
|
98 iTimeFormat = ( ECamControllerVideo == iMode ) |
|
99 ? iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_LONG ) |
|
100 : KRemainingImagesNumberFormat().AllocL(); |
|
101 |
|
102 TFileName resFileName; |
|
103 CamUtility::ResourceFileName( resFileName ); |
|
104 TPtrC resname = resFileName; |
|
105 |
|
106 // ...phone memory icon |
|
107 AknIconUtils::CreateIconL( iPhoneIcon, |
|
108 iPhoneIconMask, |
|
109 resname, |
|
110 EMbmCameraappQgn_indi_cam4_memory_phone, |
|
111 EMbmCameraappQgn_indi_cam4_memory_phone_mask ); |
|
112 |
|
113 // ...mmc icon |
|
114 AknIconUtils::CreateIconL( iMMCIcon, |
|
115 iMMCIconMask, |
|
116 resname, |
|
117 EMbmCameraappQgn_indi_cam4_memory_mmc, |
|
118 EMbmCameraappQgn_indi_cam4_memory_mmc_mask ); |
|
119 |
|
120 // ...mass storage icon |
|
121 AknIconUtils::CreateIconL( iMassStorageIcon, |
|
122 iMassStorageIconMask, |
|
123 resname, |
|
124 EMbmCameraappQgn_indi_cam4_memory_mass, |
|
125 EMbmCameraappQgn_indi_cam4_memory_mass_mask ); |
|
126 |
|
127 UpdateRemainingTextL(); |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CGSCamQualitySettingContainer::NewL |
|
132 // Two-phased constructor. |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 CGSCamQualitySettingContainer* |
|
136 CGSCamQualitySettingContainer::NewL( MCamAppController& aController, |
|
137 TCamCameraMode aMode, |
|
138 CCoeControl* aParent ) |
|
139 { |
|
140 CGSCamQualitySettingContainer* self = |
|
141 new( ELeave ) CGSCamQualitySettingContainer( aController, aMode, aParent ); |
|
142 CleanupStack::PushL( self ); |
|
143 self->ConstructL(); |
|
144 CleanupStack::Pop(); |
|
145 return self; |
|
146 } |
|
147 |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CGSCamQualitySettingContainer::~CGSCamQualitySettingContainer |
|
151 // Destructor |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 CGSCamQualitySettingContainer::~CGSCamQualitySettingContainer() |
|
155 { |
|
156 PRINT( _L("Camera => ~CGSCamQualitySettingContainer") ); |
|
157 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() ); |
|
158 if ( appUi ) |
|
159 { |
|
160 TInt resId = ( ECamControllerVideo == iMode ) |
|
161 ? R_CAM_VIDEO_SETTINGS_TITLE_NAME |
|
162 : R_CAM_PHOTO_SETTINGS_TITLE_NAME; |
|
163 |
|
164 TRAP_IGNORE( appUi->SetTitleL( resId ) ); |
|
165 } |
|
166 iController.RemoveControllerObserver( this ); |
|
167 delete iPhoneIcon; |
|
168 delete iPhoneIconMask; |
|
169 delete iMMCIcon; |
|
170 delete iMMCIconMask; |
|
171 delete iMassStorageIcon; |
|
172 delete iMassStorageIconMask; |
|
173 |
|
174 delete iTimeFormat; |
|
175 |
|
176 // delete descriptors from arrays |
|
177 if ( iTitleArray ) |
|
178 { |
|
179 iTitleArray->Reset(); |
|
180 delete iTitleArray; |
|
181 } |
|
182 if ( iDescArray ) |
|
183 { |
|
184 iDescArray->Reset(); |
|
185 delete iDescArray; |
|
186 } |
|
187 if ( iCurrentDescLineArray ) |
|
188 { |
|
189 iCurrentDescLineArray->Reset(); |
|
190 delete iCurrentDescLineArray; |
|
191 } |
|
192 |
|
193 iLayoutSettingDescLines.Reset(); |
|
194 iEnumArray.Reset(); |
|
195 if ( iFeedback ) |
|
196 { |
|
197 iFeedback->RemoveFeedbackForControl( iSlider ); |
|
198 } |
|
199 delete iSlider; |
|
200 delete iTextTitle; |
|
201 delete iTextTopSubtitle; |
|
202 delete iTextBottomSubtitle; |
|
203 delete iTextRemainingTitle; |
|
204 |
|
205 iSupportedQualitiesArray.Close(); |
|
206 PRINT( _L("Camera <= ~CGSCamQualitySettingContainer") ); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CGSCamQualitySettingContainer::SelectedQuality |
|
211 // Returns the quality selected by the slider |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 TInt CGSCamQualitySettingContainer::SelectedQuality() const |
|
215 { |
|
216 return iSelectedQuality; |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CGSCamQualitySettingContainer::ConstructFromResourceL |
|
221 // Constructs the container from the resource |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 void CGSCamQualitySettingContainer::ConstructFromResourceL( TResourceReader& aReader ) |
|
225 { |
|
226 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() ); |
|
227 // set up the container windows here as setting page window |
|
228 // isn't created until CAknSettingPage::ConstructFromResourceL is called |
|
229 SetContainerWindowL( *iParent ); |
|
230 iSlider->SetContainerWindowL( *iParent ); |
|
231 |
|
232 // read the texts from the resource file |
|
233 iTextTitle = aReader.ReadHBufCL(); |
|
234 appUi->SetTitleL( iTextTitle->Des() ); |
|
235 iTextTopSubtitle = aReader.ReadHBufCL(); |
|
236 iTextBottomSubtitle = aReader.ReadHBufCL(); |
|
237 iTextRemainingTitle = aReader.ReadHBufCL(); |
|
238 |
|
239 TCamPsiKey key = ( ECamControllerVideo == iMode ) |
|
240 ? ECamPsiSupportedVideoQualities |
|
241 : ECamPsiSupportedStillQualities; |
|
242 |
|
243 |
|
244 iConfiguration = &(appUi->StaticSettingsModel().Configuration()); |
|
245 iConfiguration->GetPsiIntArrayL( key, iSupportedQualitiesArray ); |
|
246 |
|
247 iTitleArray = new( ELeave ) CDesCArrayFlat( 1 ); |
|
248 iDescArray = new( ELeave ) CDesCArrayFlat( 1 ); |
|
249 |
|
250 // read the descriptive text and split the text into 3 lines |
|
251 ReadInTextArrayL( aReader, *iTitleArray ); |
|
252 ReadInTextArrayL( aReader, *iDescArray ); |
|
253 |
|
254 // Read the setting enums that match with the text arrays. |
|
255 TInt count = aReader.ReadInt16(); |
|
256 TInt suppCount = iSupportedQualitiesArray.Count(); |
|
257 |
|
258 TInt i = 0; |
|
259 TInt j = 0; |
|
260 |
|
261 for ( i = 0; i < count && j < suppCount ; i++ ) |
|
262 { |
|
263 TInt val = aReader.ReadInt16(); |
|
264 |
|
265 // check if it's a supported quality level |
|
266 if ( i == iSupportedQualitiesArray[j] ) |
|
267 { |
|
268 if ( ECamControllerVideo == iMode ) |
|
269 { |
|
270 User::LeaveIfError( iEnumArray.Append( static_cast<TCamVideoQualitySettings>( val ) ) ); |
|
271 } |
|
272 else |
|
273 { |
|
274 User::LeaveIfError( iEnumArray.Append( static_cast<TCamImageQualitySetting>( val ) ) ); |
|
275 } |
|
276 j++; |
|
277 } |
|
278 } |
|
279 |
|
280 // TCamImageQualitySetting enum starts with highest quality == 0 |
|
281 // so convert this to value the slider understands i.e. 0 == lowest |
|
282 TInt sliderValue = iEnumArray.Count() - 1 - iSelectedQuality; |
|
283 |
|
284 iSlider->InitializeL( sliderValue, iTextTopSubtitle, iTextBottomSubtitle ); |
|
285 |
|
286 // Set the new range of values |
|
287 iSlider->SetRange( 0, iEnumArray.Count() - 1 ); |
|
288 |
|
289 iCurrentDescLineArray = new( ELeave ) CArrayFixFlat<TPtrC>( 3 ); |
|
290 // Use the layout info from the first line for width and font |
|
291 TAknLayoutText layout = iLayoutSettingDescLines[0]; |
|
292 AknTextUtils::WrapToArrayL( ( *iDescArray )[iSelectedQuality], |
|
293 layout.TextRect().Width(), |
|
294 *( layout.Font() ), |
|
295 *iCurrentDescLineArray ); |
|
296 iFeedback = MTouchFeedback::Instance(); |
|
297 if ( iFeedback ) |
|
298 { |
|
299 iFeedback->SetFeedbackArea( iSlider, 0, iSlider->Rect(), |
|
300 ETouchFeedbackBasic, ETouchEventStylusDown ); |
|
301 } |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CGSCamQualitySettingContainer::CountComponentControls |
|
306 // return the number of component controls |
|
307 // ----------------------------------------------------------------------------- |
|
308 // |
|
309 TInt CGSCamQualitySettingContainer::CountComponentControls() const |
|
310 { |
|
311 return 1; // the slider |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CGSCamQualitySettingContainer::ComponentControl |
|
316 // return the control at a given index |
|
317 // ----------------------------------------------------------------------------- |
|
318 // |
|
319 CCoeControl* CGSCamQualitySettingContainer::ComponentControl( TInt /*aIndex*/ ) const |
|
320 { |
|
321 return iSlider; |
|
322 } |
|
323 |
|
324 // ----------------------------------------------------------------------------- |
|
325 // CGSCamQualitySettingContainer::Draw |
|
326 // Draws the container |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 void CGSCamQualitySettingContainer::Draw( const TRect& /*aRect*/ ) const |
|
330 { |
|
331 PRINT( _L("Camera => CGSCamQualitySettingContainer::Draw") ); |
|
332 CWindowGc& gc = SystemGc(); |
|
333 |
|
334 // Draw skin background |
|
335 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
336 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
337 AknsDrawUtils::Background( skin, cc, gc, Rect() ); |
|
338 |
|
339 // draw the title text |
|
340 TRgb color; |
|
341 AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
342 EAknsCIQsnTextColorsCG6 ); |
|
343 |
|
344 // draw the quality description text |
|
345 DrawQualityTexts( gc, color ); |
|
346 |
|
347 // draw the remaining images/remaining video time |
|
348 iLayoutRemainingTitle.DrawText( gc, iTextRemainingTitle->Des(), ETrue, color ); |
|
349 |
|
350 // draw the remaining images/remaining video time |
|
351 TBufC<40> Buf( iTextRemaining ); |
|
352 TPtr Pointer = Buf.Des(); |
|
353 AknTextUtils::LanguageSpecificNumberConversion( Pointer ); |
|
354 iLayoutRemainingText.DrawText( gc, /*iTextRemaining*/Buf, ETrue, color ); |
|
355 |
|
356 // draw the current location icon |
|
357 DrawStorageIcon( gc ); |
|
358 |
|
359 PRINT( _L("Camera <= CGSCamQualitySettingContainer::Draw") ); |
|
360 } |
|
361 |
|
362 // ----------------------------------------------------------------------------- |
|
363 // CGSCamQualitySettingContainer::SizeChanged |
|
364 // Handles a change in the size of the control |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 void CGSCamQualitySettingContainer::SizeChanged() |
|
368 { |
|
369 TRAP_IGNORE( ReadLayoutL() ); |
|
370 } |
|
371 |
|
372 // ----------------------------------------------------------------------------- |
|
373 // CGSCamQualitySettingContainer::OfferKeyEventL |
|
374 // Handles key events |
|
375 // ----------------------------------------------------------------------------- |
|
376 // |
|
377 TKeyResponse CGSCamQualitySettingContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
378 TEventCode aType ) |
|
379 { |
|
380 TKeyResponse keyResponse = iSlider->OfferKeyEventL( aKeyEvent, aType ); |
|
381 if ( keyResponse == EKeyWasConsumed ) |
|
382 { |
|
383 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
384 } |
|
385 return keyResponse; |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // CGSCamQualitySettingContainer::HandleSettingValueUpdateL |
|
390 // Handles a change to the setting value of the slider |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CGSCamQualitySettingContainer::HandleSettingValueUpdateL( TInt aNewValue ) |
|
394 { |
|
395 ASSERT ( aNewValue >= 0 && |
|
396 aNewValue < iEnumArray.Count() ); |
|
397 |
|
398 // The slider values range from Max at the top (eg 5) to Min at the bottom (0). |
|
399 // For quality settings enum (0 is Max, 4 is Min) need to invert this |
|
400 TInt index = iSlider->MaxValue() - aNewValue; |
|
401 if ( ECamControllerVideo == iMode ) |
|
402 { |
|
403 iSelectedQuality = index; |
|
404 } |
|
405 else |
|
406 { |
|
407 iSelectedQuality = index; |
|
408 } |
|
409 |
|
410 // remove the old lines |
|
411 iCurrentDescLineArray->Reset(); |
|
412 // Use the layout info from the first line for width and font |
|
413 TAknLayoutText layout = iLayoutSettingDescLines[0]; |
|
414 AknTextUtils::WrapToArrayL( ( *iDescArray )[iSelectedQuality], |
|
415 layout.TextRect().Width(), |
|
416 *( layout.Font() ), |
|
417 *iCurrentDescLineArray ); |
|
418 |
|
419 /* - |
|
420 // Update the number of images remaining |
|
421 UpdateRemainingTextL(); |
|
422 */ |
|
423 // + |
|
424 ResetRemainingTextL(); |
|
425 |
|
426 // Results in a call to CCamQualitySettingPage::UpdateSettingL() |
|
427 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
428 |
|
429 /*ActivateGc(); |
|
430 Window().Invalidate( iLayoutDescRect.Rect() ); |
|
431 DeactivateGc();*/ |
|
432 DrawNow(); |
|
433 } |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // CGSCamQualitySettingContainer::HandleControllerEventL |
|
437 // Handles a change in the controller |
|
438 // ----------------------------------------------------------------------------- |
|
439 // |
|
440 |
|
441 void CGSCamQualitySettingContainer::HandleControllerEventL( |
|
442 TCamControllerEvent aEvent, TInt /*aError*/ ) |
|
443 |
|
444 { |
|
445 PRINT( _L("Camera => CGSCamQualitySettingContainer::HandleControllerEventL") ); |
|
446 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEikonEnv->AppUi() ); |
|
447 TBool redrawNeeded = EFalse; |
|
448 // If this is a capture complete event, or the image quality or save |
|
449 // location has changed... |
|
450 if ( aEvent == ECamEventImageQualityChanged || |
|
451 aEvent == ECamEventSaveLocationChanged || |
|
452 aEvent == ECamEventVideoQualityChanged ) |
|
453 { |
|
454 UpdateRemainingTextL(); |
|
455 |
|
456 if ( aEvent == ECamEventSaveLocationChanged ) |
|
457 { |
|
458 /*TCamSettingItemIds storageLocation = ( ECamControllerVideo == iMode) |
|
459 ? ECamSettingItemVideoMediaStorage |
|
460 : ECamSettingItemPhotoMediaStorage;*/ |
|
461 // update location |
|
462 /*if ( static_cast<CCamAppUi*>( iEikonEnv->AppUi() )->IsMMCRemovedNotePending() ) |
|
463 { |
|
464 iStorageLocation = static_cast< TCamMediaStorage > |
|
465 ( iController.IntegerSettingValueUnfiltered( storageLocation ) ); |
|
466 } |
|
467 else |
|
468 { |
|
469 iStorageLocation = static_cast< TCamMediaStorage > |
|
470 ( iController.IntegerSettingValue( storageLocation ) ); |
|
471 }*/ |
|
472 } |
|
473 |
|
474 redrawNeeded = ETrue; |
|
475 } |
|
476 else |
|
477 { |
|
478 // Other events: no action |
|
479 } |
|
480 |
|
481 |
|
482 if ( redrawNeeded ) |
|
483 { |
|
484 DrawNow(); |
|
485 } |
|
486 PRINT( _L("Camera <= CGSCamQualitySettingContainer::HandleControllerEventL") ); |
|
487 } |
|
488 |
|
489 |
|
490 // ----------------------------------------------------------------------------- |
|
491 // CGSCamQualitySettingContainer::ReadLayoutL |
|
492 // Reads the layout information from the resource file |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CGSCamQualitySettingContainer::ReadLayoutL() |
|
496 { |
|
497 TAknLayoutRect settingLayout; |
|
498 settingLayout.LayoutRect( Rect(), AknLayoutScalable_Apps::main_cam_set_pane( 0 ) ); |
|
499 TRect settingRect( settingLayout.Rect() ); |
|
500 |
|
501 AknLayoutUtils::LayoutControl( iSlider, settingRect, AknLayoutScalable_Apps::main_cset_slider_pane( 2 ) ); |
|
502 |
|
503 // set the layouts for the rects |
|
504 // containing the descriptions |
|
505 TRect infoboxRect; |
|
506 iLayoutDescRect.LayoutRect( settingRect, AknLayoutScalable_Apps::main_cset_text_pane( 0 ) ); |
|
507 infoboxRect = iLayoutDescRect.Rect(); |
|
508 |
|
509 // set quality setting title layout |
|
510 iLayoutSettingTitle.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t1( 0 ) ); |
|
511 |
|
512 // set layouts for 3 lines of descriptive text |
|
513 iLayoutSettingDescLines.Reset(); |
|
514 TAknLayoutText layout; |
|
515 layout.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t2( 0 ) ); |
|
516 User::LeaveIfError( iLayoutSettingDescLines.Append( layout ) ); |
|
517 layout.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t3( 0 ) ); |
|
518 User::LeaveIfError( iLayoutSettingDescLines.Append( layout ) ); |
|
519 layout.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t4( 0 ) ); |
|
520 User::LeaveIfError( iLayoutSettingDescLines.Append( layout ) ); |
|
521 |
|
522 // set remaining text layouts |
|
523 iLayoutRemainingTitle.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t6( 0 ) ); |
|
524 iLayoutRemainingText.LayoutText( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_t7( 0 ) ); |
|
525 // read the storage icon layout |
|
526 iLayoutIcon.LayoutRect( infoboxRect, AknLayoutScalable_Apps::main_cset_text_pane_g1( 0 ) ); |
|
527 |
|
528 // set size for different memory type icons |
|
529 TSize iconSize ( iLayoutIcon.Rect().Size() ); |
|
530 AknIconUtils::SetSize( iPhoneIcon, iconSize, EAspectRatioPreserved ); |
|
531 AknIconUtils::SetSize( iMMCIcon, iconSize, EAspectRatioPreserved ); |
|
532 AknIconUtils::SetSize( iMassStorageIcon, iconSize, EAspectRatioPreserved ); |
|
533 } |
|
534 |
|
535 // ----------------------------------------------------------------------------- |
|
536 // CGSCamQualitySettingContainer::DrawQualityTexts |
|
537 // Draws the quality information texts |
|
538 // ----------------------------------------------------------------------------- |
|
539 // |
|
540 void CGSCamQualitySettingContainer::DrawQualityTexts( CWindowGc& aGc, TRgb aColor ) const |
|
541 { |
|
542 // Set the brushstyle to ENullBrush in order to not show the |
|
543 // text background box. Otherwise it would show slightly from |
|
544 // beneath the shaded background |
|
545 //aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
546 iLayoutSettingTitle.DrawText |
|
547 ( aGc, ( *iTitleArray )[iSelectedQuality], ETrue, aColor ); |
|
548 |
|
549 TInt count = Min( iCurrentDescLineArray->Count(), iLayoutSettingDescLines.Count() ); |
|
550 |
|
551 for ( TInt i = 0; i < count; i++ ) |
|
552 { |
|
553 if ( i < count ) |
|
554 { |
|
555 iLayoutSettingDescLines[i]. |
|
556 DrawText( aGc, ( *iCurrentDescLineArray )[i], ETrue, aColor ); |
|
557 } |
|
558 } |
|
559 } |
|
560 |
|
561 // --------------------------------------------------------- |
|
562 // CGSCamQualitySettingContainer::DrawStorageIcon |
|
563 // Draw the icon for the media storage location |
|
564 // --------------------------------------------------------- |
|
565 // |
|
566 void CGSCamQualitySettingContainer::DrawStorageIcon( CWindowGc& aGc ) const |
|
567 { |
|
568 CFbsBitmap* icon = NULL; |
|
569 CFbsBitmap* mask = NULL; |
|
570 if ( iStorageLocation == ECamMediaStoragePhone ) |
|
571 { |
|
572 icon = iPhoneIcon; |
|
573 mask = iPhoneIconMask; |
|
574 } |
|
575 else if ( iStorageLocation == ECamMediaStorageMassStorage ) |
|
576 { |
|
577 icon = iMassStorageIcon; |
|
578 mask = iMassStorageIconMask; |
|
579 } |
|
580 else |
|
581 { |
|
582 icon = iMMCIcon; |
|
583 mask = iMMCIconMask; |
|
584 } |
|
585 |
|
586 iLayoutIcon.DrawImage( aGc, icon, mask ); |
|
587 } |
|
588 |
|
589 // --------------------------------------------------------- |
|
590 // CGSCamQualitySettingContainer::DrawRemainingText |
|
591 // Draw the remaining image count/video time |
|
592 // --------------------------------------------------------- |
|
593 // |
|
594 void CGSCamQualitySettingContainer::DrawRemainingText( CWindowGc& aGc ) const |
|
595 { |
|
596 // Set the brushstyle to ENullBrush in order to not show the |
|
597 // text background box. Otherwise it would show slightly from |
|
598 // beneath the shaded background |
|
599 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
600 aGc.Clear( iLayoutRemainingText.TextRect() ); |
|
601 iLayoutRemainingText.DrawText( aGc, iTextRemaining ); |
|
602 } |
|
603 |
|
604 // --------------------------------------------------------- |
|
605 // CGSCamQualitySettingContainer::UpdateRemainingTextL |
|
606 // Update the remaining image count/video time remaining |
|
607 // --------------------------------------------------------- |
|
608 // |
|
609 void CGSCamQualitySettingContainer::UpdateRemainingTextL() |
|
610 { |
|
611 PRINT( _L("Camera => CGSCamQualitySettingContainer::UpdateRemainingTextL") ); |
|
612 |
|
613 if ( ECamControllerVideo == iMode ) |
|
614 { |
|
615 // Get the total remaining record time from the controller |
|
616 TTime time ( iController.RecordTimeRemaining().Int64() ); |
|
617 /* - |
|
618 HBufC* timeFormat = |
|
619 iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO ); |
|
620 time.FormatL( iTextRemaining, *timeFormat ); |
|
621 CleanupStack::PopAndDestroy( timeFormat ); |
|
622 */ |
|
623 // + |
|
624 time.FormatL( iTextRemaining, *iTimeFormat ); |
|
625 } |
|
626 else |
|
627 { |
|
628 // use the stored image resolution to calculated the remaining images |
|
629 TBool burstActive = static_cast<CCamAppUiBase*> |
|
630 ( iEikonEnv->AppUi() )->IsBurstEnabled(); |
|
631 |
|
632 TInt imagesLeft = iController.ImagesRemaining( ECamMediaStorageCurrent, |
|
633 burstActive, |
|
634 iSelectedQuality ); |
|
635 TInt showLeft = Min( imagesLeft, KMaxRemainingImagesShown ); |
|
636 // - |
|
637 // iTextRemaining.Format( KRemainingImagesNumberFormat, showLeft ); |
|
638 // + |
|
639 iTextRemaining.Format( *iTimeFormat, showLeft ); |
|
640 } |
|
641 |
|
642 PRINT( _L("Camera <= CGSCamQualitySettingContainer::UpdateRemainingTextL") ); |
|
643 } |
|
644 |
|
645 // --------------------------------------------------------- |
|
646 // ResetRemainingTextL |
|
647 // --------------------------------------------------------- |
|
648 // |
|
649 void |
|
650 CGSCamQualitySettingContainer::ResetRemainingTextL() |
|
651 { |
|
652 /* mm: Disabled for now. Below code sets to 00:00. |
|
653 Proposed --:-- for video, no action for image (too fast). |
|
654 if ( ECamControllerVideo == iMode ) |
|
655 { |
|
656 TTime time( TInt64( 0 ) ); |
|
657 time.FormatL( iTextRemaining, *iTimeFormat ); |
|
658 } |
|
659 else |
|
660 { |
|
661 } |
|
662 */ |
|
663 } |
|
664 |
|
665 // --------------------------------------------------------- |
|
666 // CGSCamQualitySettingContainer::ReadInTextArrayL |
|
667 // Populate a text array from the resource definition of available |
|
668 // quality texts using the supported quality values |
|
669 // --------------------------------------------------------- |
|
670 // |
|
671 void CGSCamQualitySettingContainer::ReadInTextArrayL( TResourceReader& aReader, CDesCArrayFlat& aArray ) |
|
672 { |
|
673 CDesCArrayFlat* tempArray; |
|
674 tempArray = aReader.ReadDesC16ArrayL(); |
|
675 |
|
676 TInt descCount = tempArray->Count(); |
|
677 TInt suppCount = iSupportedQualitiesArray.Count(); |
|
678 |
|
679 TInt i = 0; |
|
680 |
|
681 for ( i = 0; i < suppCount; i++ ) |
|
682 { |
|
683 TInt descriptionIndex = |
|
684 iConfiguration->MapSupportedQualityToQualityDescriptor( |
|
685 iMode == ECamControllerVideo, |
|
686 iSupportedQualitiesArray[i] ); |
|
687 |
|
688 if ( descriptionIndex >= 0 |
|
689 && descriptionIndex < descCount ) |
|
690 { |
|
691 aArray.AppendL( ( *tempArray )[descriptionIndex] ); |
|
692 } |
|
693 } |
|
694 tempArray->Reset(); |
|
695 delete tempArray; |
|
696 tempArray = NULL; |
|
697 } |
|
698 |
|
699 // End of File |
|