|
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: Helper class which handles reading and storing the cr keys |
|
15 * and its values. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // Includes |
|
22 #include <StringLoader.h> |
|
23 #include <barsread.h> |
|
24 #include <e32base.h> |
|
25 #include <e32const.h> |
|
26 #include <centralrepository.h> |
|
27 #include "CameraUiConfigManagerImp.h" |
|
28 #include "CameraConfigurationCrKeys.h" |
|
29 #include "camlogging.h" |
|
30 #include "CamSettings.hrh" |
|
31 |
|
32 |
|
33 // =========================================================================== |
|
34 // Constants |
|
35 |
|
36 const TInt KCamCRStringInitialLength = 1024; |
|
37 _LIT( KItemsSeparator, "," ); |
|
38 |
|
39 |
|
40 // =========================================================================== |
|
41 |
|
42 inline TBool SettingIdMatches( const TInt* aSettingId, |
|
43 const TSupportedSettingsData& aSettingItem ) |
|
44 { |
|
45 return ( *aSettingId == aSettingItem.iSettingId ); |
|
46 }; |
|
47 |
|
48 // =========================================================================== |
|
49 |
|
50 |
|
51 // Class methods |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CCameraUiConfigManagerImp::NewL |
|
55 // Symbian OS two-phased constructor |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CCameraUiConfigManagerImp* CCameraUiConfigManagerImp::NewL() |
|
59 { |
|
60 CCameraUiConfigManagerImp* self = CCameraUiConfigManagerImp::NewLC(); |
|
61 CleanupStack::Pop( self ); |
|
62 return self; |
|
63 } |
|
64 |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CCameraUiConfigManagerImp::NewLC |
|
69 // Symbian OS two-phased constructor |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CCameraUiConfigManagerImp* CCameraUiConfigManagerImp::NewLC() |
|
73 { |
|
74 CCameraUiConfigManagerImp* self = new( ELeave ) CCameraUiConfigManagerImp(); |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CCameraUiConfigManagerImp::~CCameraUiConfigManagerImp |
|
83 // Destructor |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 CCameraUiConfigManagerImp::~CCameraUiConfigManagerImp() |
|
87 { |
|
88 for( TInt index = 0;index < iSupportedSettings.Count();index++ ) |
|
89 { |
|
90 if ( iSupportedSettings[index] ) |
|
91 { |
|
92 iSupportedSettings[index]->iSupportedSettingItems.Close(); |
|
93 } |
|
94 } |
|
95 iSupportedSettings.ResetAndDestroy(); |
|
96 iSupportedSettings.Close(); |
|
97 |
|
98 delete iRepository; |
|
99 } |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CCameraUiConfigManagerImp::ConstructL |
|
106 // Symbian OS 2nd phase constructor |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void CCameraUiConfigManagerImp::ConstructL() |
|
110 { |
|
111 iRepository = CRepository::NewL( KCameraDynamicConfigurationCrKeys ); |
|
112 LoadAllDynamicSettingsL(); |
|
113 } |
|
114 |
|
115 |
|
116 |
|
117 // ---------------------------------------------------------------------------------- |
|
118 // CCameraUiConfigManagerImp::IsFeatureSupported |
|
119 // ---------------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CCameraUiConfigManagerImp::IsFeatureSupported( |
|
122 const TCamDynamicSettings aSettingId ) const |
|
123 { |
|
124 PRINT( _L("Camera => CCameraUiConfigManagerImp::IsFeatureSupportedL" )) |
|
125 |
|
126 TInt settingIndex ( KErrNotFound ); |
|
127 TInt value(0); // setting not supported |
|
128 |
|
129 if ( iSupportedSettings.Count() > 0 ) |
|
130 { |
|
131 settingIndex = SearchInSettingsListFor( iSupportedSettings, |
|
132 static_cast<TInt>( aSettingId ) ); |
|
133 } |
|
134 else |
|
135 { |
|
136 // if there are no supported settings |
|
137 } |
|
138 |
|
139 if ( KErrNotFound != settingIndex ) |
|
140 { |
|
141 if ( iSupportedSettings[settingIndex] ) |
|
142 { |
|
143 value = iSupportedSettings[settingIndex]->iSupportedValue; |
|
144 } |
|
145 } |
|
146 else |
|
147 { |
|
148 // setting item not found; hence not supported. |
|
149 } |
|
150 PRINT1( _L("Camera <= CCameraUiConfigManagerImp::IsFeatureSupportedL = %d" ), value ); |
|
151 return value; |
|
152 } |
|
153 |
|
154 |
|
155 |
|
156 // |
|
157 //CCameraUiConfigManagerImp::SupportedSettingItemsL |
|
158 // |
|
159 void CCameraUiConfigManagerImp::SupportedSettingItemsL( |
|
160 const TCamDynamicSettings aSettingId, |
|
161 RArray<TInt>& aSupportedValues ) |
|
162 { |
|
163 PRINT( _L("Camera => CCameraUiConfigManagerImp::SupportedSettingItemsL" )) |
|
164 TInt settingIndex ( KErrNotFound ); |
|
165 aSupportedValues.Reset(); |
|
166 |
|
167 if ( iSupportedSettings.Count() > 0 ) |
|
168 { |
|
169 settingIndex = SearchInSettingsListFor( iSupportedSettings, |
|
170 static_cast<TInt>( aSettingId ) ); |
|
171 } |
|
172 else |
|
173 { |
|
174 // do nothing |
|
175 } |
|
176 if ( KErrNotFound != settingIndex ) |
|
177 { |
|
178 // if the index is valid, copy all corresponding setting items to the array |
|
179 for ( TInt i = 0; |
|
180 i < iSupportedSettings[settingIndex]->iSupportedSettingItems.Count(); |
|
181 i++ ) |
|
182 { |
|
183 if ( iSupportedSettings[settingIndex] ) |
|
184 { |
|
185 aSupportedValues.AppendL( |
|
186 iSupportedSettings[settingIndex]->iSupportedSettingItems[i] ); |
|
187 } |
|
188 } |
|
189 } |
|
190 else |
|
191 { |
|
192 User::Leave( KErrNotSupported ); |
|
193 } |
|
194 |
|
195 PRINT( _L("Camera <= CCameraUiConfigManagerImp::SupportedSettingItemsL" )) |
|
196 } |
|
197 |
|
198 |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CCameraUiConfigManager::LoadAllDynamicSettingsL |
|
202 // Load all dynamic settings |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 void CCameraUiConfigManagerImp::LoadAllDynamicSettingsL() |
|
206 { |
|
207 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadAllDynamicSettingsL()" )) |
|
208 RArray<TDynamicSettingsData> settingItemDefaultData; |
|
209 CleanupClosePushL( settingItemDefaultData ); |
|
210 |
|
211 TInt supportedValue = 0; |
|
212 TInt error = KErrNone; |
|
213 |
|
214 for( TInt settingId = ( static_cast<TInt>( ECamDynamicSettingsMin ) + 1 ); |
|
215 settingId < static_cast<TInt>( ECamDynamicSettingsMax ); |
|
216 settingId++ ) |
|
217 { |
|
218 if ( LoadCrForFeatureSupport( settingId ) ) |
|
219 { |
|
220 error = iRepository->Get( MapSettingItemToCrFeatureKeyL( settingId ), |
|
221 supportedValue ); |
|
222 } |
|
223 else |
|
224 { |
|
225 supportedValue = 1; |
|
226 } |
|
227 |
|
228 if ( error ) break; // if any error reading CenRep; do proper clean-up |
|
229 |
|
230 switch( settingId ) |
|
231 { |
|
232 case ECamDynamicSettingCaptureToneDelaySupport: |
|
233 case ECamDynamicSettingCaptureToneDelayValue: |
|
234 case ECamDynamicSettingRequiredRamMemory: |
|
235 case ECamDynamicSettingCriticalLevelRamMemory: |
|
236 case ECamDynamicSettingRequiredRamMemoryFocusGained: |
|
237 case ECamDynamicSettingCriticalLevelRamMemoryFocusGained: |
|
238 case ECamDynamicSettingPhoto: |
|
239 case ECamDynamicSettingPublishZoomState: |
|
240 case ECamDynamicSettingAutofocusSetInHyperfocalAtStartup: |
|
241 case ECamDynamicSettingLocation: |
|
242 case ECamDynamicSettingKeyLockWatcher: |
|
243 case ECamDynamicSettingSecondaryCamera: |
|
244 case ECamDynamicSettingLensCover: |
|
245 case ECamDynamicSettingXenonFlash: |
|
246 case ECamDynamicSettingLightSensitivity: |
|
247 case ECamDynamicSettingExtLightSensitivity: |
|
248 case ECamDynamicSettingFaceTracking: |
|
249 case ECamDynamicSettingOpticalJoyStick: |
|
250 case ECamDynamicSettingOneClickUpload: |
|
251 case ECamDynamicSettingVideoLight: |
|
252 case ECamDynamicSettingAutoFocus: |
|
253 case ECamDynamicSettingVideoStabilization: |
|
254 case ECamDynamicSettingOrientationSensor: |
|
255 case ECamDynamicSetting2ndCameraOrientation: |
|
256 case ECamDynamicSettingUIOrientationOverride: |
|
257 case ECamDynamicSettingThumbnailManagerAPI: |
|
258 case ECamDynamicSettingBurstMode: |
|
259 case ECamDynamicSettingContinuousAF: |
|
260 case ECamDynamicSettingBurstFileSizeEstimateFactor: |
|
261 { |
|
262 PRINT1( _L("Camera <> CCameraUiConfigManagerImp::LoadAllDynamicSettingsL() append %d" ), settingId ) |
|
263 AppendToSettingsArrayL( settingId, |
|
264 supportedValue, |
|
265 settingItemDefaultData ); |
|
266 break; |
|
267 } |
|
268 case ECamDynamicSettingVideoSceneModeNormal: |
|
269 case ECamDynamicSettingVideoSceneModeNight: |
|
270 case ECamDynamicSettingVideoSceneModeLowLight: |
|
271 case ECamDynamicSettingDSAViewFinder: |
|
272 case ECamDynamicSettingImageSceneModeAuto: |
|
273 case ECamDynamicSettingImageSceneModeUser: |
|
274 case ECamDynamicSettingImageSceneModeMacro: |
|
275 case ECamDynamicSettingImageSceneModePotrait: |
|
276 case ECamDynamicSettingImageSceneModeScenery: |
|
277 case ECamDynamicSettingImageSceneModeSports: |
|
278 case ECamDynamicSettingImageSceneModeNight: |
|
279 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
280 case ECamDynamicSettingPCCaptureKeys: |
|
281 case ECamDynamicSettingSCCaptureKeys: |
|
282 case ECamDynamicSettingPCAutoFocusKeys: |
|
283 case ECamDynamicSettingSCAutoFocusKeys: |
|
284 case ECamDynamicSettingPCZoomIn: |
|
285 case ECamDynamicSettingSCZoomIn: |
|
286 case ECamDynamicSettingPCZoomOut: |
|
287 case ECamDynamicSettingSCZoomOut: |
|
288 case ECamDynamicSettingWhiteBalance: |
|
289 case ECamDynamicSettingColorTone: |
|
290 case ECamDynamicSettingContrast: |
|
291 case ECamDynamicSettingBrightness: |
|
292 case ECamDynamicSettingEV: |
|
293 case ECamDynamicSettingSharpness: |
|
294 case ECamDynamicSettingFlashMode: |
|
295 case ECamDynamicSettingZoomLAF: |
|
296 case ECamDynamicSettingMaxOpticalZoomLimits: |
|
297 case ECamDynamicSettingMaxExtendedZoomLimits: |
|
298 case ECamDynamicSettingMaxDigitalZoomLimits: |
|
299 case ECamDynamicSettingZoomDelays: |
|
300 { |
|
301 PRINT1( _L("Camera <> CCameraUiConfigManagerImp::LoadAllDynamicSettingsL() %d" ), settingId ) |
|
302 LoadConfiguredSettingItemValuesFromCrL( settingId, |
|
303 supportedValue, |
|
304 settingItemDefaultData ); |
|
305 break; |
|
306 } |
|
307 default: |
|
308 { |
|
309 break; |
|
310 } |
|
311 |
|
312 } |
|
313 } |
|
314 CleanupStack::PopAndDestroy( &settingItemDefaultData ); |
|
315 User::LeaveIfError( error ); |
|
316 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadAllDynamicSettingsL()" )) |
|
317 } |
|
318 |
|
319 |
|
320 |
|
321 // |
|
322 //CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCr |
|
323 // |
|
324 void CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCrL( |
|
325 const TInt aSettingId, |
|
326 const TInt aSupportedValue, |
|
327 RArray<TDynamicSettingsData>& aDefaultItems ) |
|
328 { |
|
329 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCrL" )) |
|
330 // Load supported setting items only when feature is supported |
|
331 LoadDefaultSettingsDataL( aSettingId, aDefaultItems ); |
|
332 AppendToSettingsArrayL( aSettingId, |
|
333 aSupportedValue, |
|
334 aDefaultItems, |
|
335 MapSettingItemToCrItemsKeyL( aSettingId ), |
|
336 ETrue ); |
|
337 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCrL" )) |
|
338 } |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 // |
|
344 // CCameraUiConfigManagerImp::AppendToSettingsArrayL |
|
345 // |
|
346 void CCameraUiConfigManagerImp::AppendToSettingsArrayL( const TInt aItemId, |
|
347 const TInt aSupportedValue, |
|
348 RArray<TDynamicSettingsData>& aAllItems, |
|
349 TUint32 aCrItemsKey, |
|
350 TBool aLoadSettingItems ) |
|
351 { |
|
352 PRINT( _L("Camera => CCameraUiConfigManagerImp::AppendToSettingsArrayL" )) |
|
353 TSupportedSettingsData* newSetting = new( ELeave ) TSupportedSettingsData; |
|
354 CleanupStack::PushL( newSetting ); |
|
355 |
|
356 newSetting->iSettingId = aItemId; // setting id |
|
357 newSetting->iSupportedValue = aSupportedValue; // feature support |
|
358 if ( aLoadSettingItems && aSupportedValue ) |
|
359 { |
|
360 // all configured setting items from cr only if the feature is supported |
|
361 GetSupportedSettingIdsL( aAllItems, |
|
362 newSetting->iSupportedSettingItems, |
|
363 aCrItemsKey ); |
|
364 } |
|
365 |
|
366 iSupportedSettings.AppendL( newSetting ); |
|
367 CleanupStack::Pop( newSetting ); |
|
368 PRINT( _L("Camera <= CCameraUiConfigManagerImp::AppendToSettingsArrayL" )) |
|
369 } |
|
370 |
|
371 |
|
372 |
|
373 // --------------------------------------------------------------------------- |
|
374 // CCameraUiConfigManager::LoadAllDynamicSettingL |
|
375 // Load all dynamic settings |
|
376 // --------------------------------------------------------------------------- |
|
377 // |
|
378 void CCameraUiConfigManagerImp::LoadDefaultSettingsDataL( |
|
379 const TInt aSettingId, |
|
380 RArray<TDynamicSettingsData>& aDefaultItems ) |
|
381 { |
|
382 PRINT1( _L("Camera => CCameraUiConfigManagerImp::LoadDefaultSettingsDataL setting id [%d]" ), aSettingId ) |
|
383 aDefaultItems.Reset(); |
|
384 TInt i = 0; |
|
385 const TInt* settingsId = LoadSettingEnumerationArray( aSettingId ); |
|
386 const TUint16* const* stringArray = LoadSettingStringArray( aSettingId ); |
|
387 |
|
388 if ( settingsId && stringArray ) |
|
389 { |
|
390 while ( settingsId[i] != KCamLastSettingItem ) |
|
391 { |
|
392 TDynamicSettingsData data; |
|
393 data.iItemId = settingsId[i]; |
|
394 data.iText = stringArray[i]; |
|
395 aDefaultItems.AppendL( data ); |
|
396 i++; |
|
397 } |
|
398 } |
|
399 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadDefaultSettingsDataL()" ) ) |
|
400 } |
|
401 |
|
402 |
|
403 |
|
404 // |
|
405 // CCameraUiConfigManagerImp::GetSupportedSettingIdsL |
|
406 // |
|
407 void CCameraUiConfigManagerImp::GetSupportedSettingIdsL( |
|
408 RArray<TDynamicSettingsData>& aAllItems, |
|
409 RArray<TInt>& aSupportedValues, |
|
410 const TUint32 aCrKey ) |
|
411 { |
|
412 PRINT( _L("Camera => CameraUiConfigManagerImp::GetSupportedSettingIdsL" )) |
|
413 aSupportedValues.Reset(); |
|
414 |
|
415 HBufC* string; // not sure but does this need to be in cleanupstack since this can later leave? |
|
416 string = GetStringDataL( aCrKey ); |
|
417 TBool clearstring = EFalse; |
|
418 |
|
419 TPtrC data = string->Des(); |
|
420 TPtrC currentItem( KNullDesC ); |
|
421 |
|
422 while ( data.Length() > 0 ) |
|
423 { |
|
424 // Find the next instance of item separator |
|
425 const TInt separatorIndex( data.Find( KItemsSeparator ) ); |
|
426 |
|
427 if( KErrNotFound != separatorIndex ) |
|
428 { |
|
429 // There is more than one item in the string still |
|
430 // Get the current item - everything before separator |
|
431 currentItem.Set( data.Left( separatorIndex ) ); |
|
432 // The remaining data is now everything after the separator |
|
433 data.Set( data.Right( data.Length() - separatorIndex - 1 ) ); |
|
434 } |
|
435 else |
|
436 { |
|
437 // This is the last item in the string |
|
438 currentItem.Set( data ); |
|
439 data.Set( KNullDesC ); |
|
440 clearstring = ETrue; |
|
441 } |
|
442 |
|
443 // Get the item id for the current item, and if found, append to list |
|
444 TInt settingItem; |
|
445 PRINT1( _L("Camera <> settingItem: %S"), string ) |
|
446 if ( currentItem[0]-48 >= 0 && currentItem[0]-48 <= 9 || |
|
447 ( currentItem[0] == '-' && // check for negative number too |
|
448 currentItem[1]-48 >= 0 && currentItem[1]-48 <= 9 ) ) |
|
449 { |
|
450 // read the numeric value equivalent to the numeric string |
|
451 TLex lex; |
|
452 if( currentItem.Length() > 2 ) |
|
453 { |
|
454 // if it is hex value, then extract hex value |
|
455 if( currentItem[1] == 'x' || currentItem[1] == 'X' ) |
|
456 { |
|
457 lex = TLex( currentItem.Mid(2) ); |
|
458 TRadix radix = EHex; |
|
459 TUint value; |
|
460 lex.Val(value, radix); |
|
461 settingItem = value; |
|
462 } |
|
463 else // extract integer |
|
464 { |
|
465 lex = TLex( currentItem ); |
|
466 lex.Val( settingItem ); |
|
467 } |
|
468 } |
|
469 else // extract integer |
|
470 { |
|
471 lex = TLex( currentItem ); |
|
472 lex.Val( settingItem ); |
|
473 } |
|
474 } |
|
475 else |
|
476 { |
|
477 // not a numeric string, check for necessary enum equivalents. |
|
478 settingItem = SettingItemId( aAllItems, currentItem ); |
|
479 } |
|
480 |
|
481 PRINT1( _L("Camera <> settingItem: %d"), settingItem ) |
|
482 |
|
483 if( KErrNotFound != settingItem ) |
|
484 { |
|
485 aSupportedValues.AppendL( settingItem ); // here |
|
486 } |
|
487 if( clearstring ) |
|
488 { |
|
489 delete string; |
|
490 } |
|
491 } |
|
492 PRINT( _L("Camera <= CameraUiConfigManagerImp::GetSupportedSettingIdsL" )) |
|
493 } |
|
494 |
|
495 |
|
496 |
|
497 // |
|
498 // CCameraUiConfigManagerImp::SettingItemId |
|
499 // |
|
500 TInt CCameraUiConfigManagerImp::SettingItemId( |
|
501 RArray<TDynamicSettingsData>& aPossibleSettings, |
|
502 const TDesC& aItemString ) const |
|
503 { |
|
504 PRINT( _L("Camera => CameraUiConfigManagerImp::SettingItemId" )) |
|
505 for( TInt i = aPossibleSettings.Count()-1; i >= 0; i-- ) |
|
506 { |
|
507 if( aItemString == aPossibleSettings[i].iText ) |
|
508 { |
|
509 PRINT( _L("Camera <= CameraUiConfigManagerImp::SettingItemId" )) |
|
510 return aPossibleSettings[i].iItemId; |
|
511 } |
|
512 } |
|
513 |
|
514 PRINT( _L("Camera <= CameraUiConfigManagerImp::SettingItemId" )) |
|
515 // No id found for the argument string |
|
516 return KErrNotFound; |
|
517 } |
|
518 |
|
519 |
|
520 // |
|
521 // CCameraUiConfigManagerImp::GetStringDataL |
|
522 // |
|
523 HBufC* CCameraUiConfigManagerImp::GetStringDataL( const TUint32 aCrKey ) |
|
524 { |
|
525 PRINT( _L("Camera => CameraUiConfigManagerImp::GetStringDataL" )) |
|
526 HBufC* string = HBufC::NewLC( KCamCRStringInitialLength ); |
|
527 |
|
528 TPtr ptr = string->Des(); |
|
529 TInt size = 0; |
|
530 TInt status = iRepository->Get( aCrKey, ptr, size ); |
|
531 |
|
532 // Did not fit into the string, reserve more memory and try again |
|
533 if( KErrOverflow == status ) |
|
534 { |
|
535 CleanupStack::PopAndDestroy( string ); // String |
|
536 string = HBufC::NewLC( size ); |
|
537 ptr = string->Des(); |
|
538 status = iRepository->Get( aCrKey, ptr, size ); |
|
539 } |
|
540 |
|
541 CleanupStack::Pop( string ); // string |
|
542 User::LeaveIfError( status ); |
|
543 |
|
544 PRINT( _L("Camera <= CameraUiConfigManagerImp::GetStringDataL" )) |
|
545 return string; |
|
546 } |
|
547 |
|
548 |
|
549 |
|
550 // --------------------------------------------------------------------------- |
|
551 // CCameraUiConfigManager::SearchInSettingsListFor |
|
552 // Searches in a settings list for a particular setting item. |
|
553 // --------------------------------------------------------------------------- |
|
554 // |
|
555 TInt CCameraUiConfigManagerImp::SearchInSettingsListFor( |
|
556 const RPointerArray<TSupportedSettingsData>& aSettingsList, |
|
557 TInt aSettingItem ) const |
|
558 { |
|
559 return aSettingsList.Find( aSettingItem, SettingIdMatches ); |
|
560 } |
|
561 |
|
562 |
|
563 // |
|
564 //CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL |
|
565 // |
|
566 TUint32 CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL( |
|
567 const TInt aSettingItem ) const |
|
568 { |
|
569 PRINT( _L("Camera => CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL" )) |
|
570 TUint32 crKey( 0 ); |
|
571 switch ( aSettingItem ) |
|
572 { |
|
573 case ECamDynamicSettingRequiredRamMemory: |
|
574 crKey = KCamCrFeatureRequiredRamMemory; |
|
575 break; |
|
576 case ECamDynamicSettingCaptureToneDelaySupport: |
|
577 crKey = KCamCrFeatureCaptureToneDelaySupport; |
|
578 break; |
|
579 case ECamDynamicSettingCaptureToneDelayValue: |
|
580 crKey = KCamCrFeatureCaptureToneDelayValue; |
|
581 break; |
|
582 case ECamDynamicSettingCriticalLevelRamMemory: |
|
583 crKey = KCamCrFeatureCriticalLevelRamMemory; |
|
584 break; |
|
585 case ECamDynamicSettingRequiredRamMemoryFocusGained: |
|
586 crKey = KCamCrFeatureRequiredRamMemoryFocusGained; |
|
587 break; |
|
588 case ECamDynamicSettingCriticalLevelRamMemoryFocusGained: |
|
589 crKey = KCamCrFeatureCriticalLevelRamMemoryFocusGained; |
|
590 break; |
|
591 case ECamDynamicSettingPhoto: |
|
592 crKey = KCamCrFeatureKeyPhotos; |
|
593 break; |
|
594 case ECamDynamicSettingPublishZoomState: |
|
595 crKey = KCamCrFeatureKeyPublishZoomSate; |
|
596 break; |
|
597 case ECamDynamicSettingAutofocusSetInHyperfocalAtStartup: |
|
598 crKey = KCamCrFeatureKeyAFSetInHyperfocalAtStartup; |
|
599 break; |
|
600 case ECamDynamicSettingExtDigitalZoom: |
|
601 crKey = KCamCrFeatureExtDigitalZoom; |
|
602 break; |
|
603 case ECamDynamicSettingLocation: |
|
604 crKey = KCamCrFeatureLocation; |
|
605 break; |
|
606 case ECamDynamicSettingKeyLockWatcher: |
|
607 crKey = KCamCrFeatureKeyLockWatcher; |
|
608 break; |
|
609 case ECamDynamicSettingColorTone: |
|
610 crKey = KCamCrFeatureColorTone; |
|
611 break; |
|
612 case ECamDynamicSettingSharpness: |
|
613 crKey = KCamCrFeatureSharpness; |
|
614 break; |
|
615 case ECamDynamicSettingWhiteBalance: |
|
616 crKey = KCamCrFeatureWhiteBalance; |
|
617 break; |
|
618 case ECamDynamicSettingSecondaryCamera: |
|
619 crKey = KCamCrFeatureSecondaryCamera; |
|
620 break; |
|
621 case ECamDynamicSettingLensCover: |
|
622 crKey = KCamCrFeatureLensCover; |
|
623 break; |
|
624 case ECamDynamicSettingXenonFlash: |
|
625 crKey = KCamCrFeatureXenonFlash; |
|
626 break; |
|
627 case ECamDynamicSettingOneClickUpload: |
|
628 crKey = KCamCrFeatureOneClickUpLoad; |
|
629 break; |
|
630 case ECamDynamicSettingVideoLight: |
|
631 crKey = KCamCrFeatureVideoLight; |
|
632 break; |
|
633 case ECamDynamicSettingAutoFocus: |
|
634 crKey = KCamCrFeatureAutoFocus; |
|
635 break; |
|
636 case ECamDynamicSettingExtLightSensitivity: |
|
637 crKey = KCamCrFeatureExtLightSensitivity; |
|
638 break; |
|
639 case ECamDynamicSettingContrast: |
|
640 crKey = KCamCrFeatureContrast; |
|
641 break; |
|
642 case ECamDynamicSettingBrightness: |
|
643 crKey = KCamCrFeatureBrightness; |
|
644 break; |
|
645 case ECamDynamicSettingEV: |
|
646 crKey = KCamCrFeatureEV; |
|
647 break; |
|
648 case ECamDynamicSettingFlashMode: |
|
649 crKey = KCamCrFeatureFlashMode; |
|
650 break; |
|
651 case ECamDynamicSettingLightSensitivity: |
|
652 crKey = KCamCrFeatureLightSensitivity; |
|
653 break; |
|
654 case ECamDynamicSettingVideoStabilization: |
|
655 crKey = KCamCrFeatureVideoStabilization; |
|
656 break; |
|
657 case ECamDynamicSettingOrientationSensor: |
|
658 crKey = KCamCrFeatureOrientationSensor; |
|
659 break; |
|
660 case ECamDynamicSettingFaceTracking: |
|
661 crKey = KCamCrFeatureFaceTracking; |
|
662 break; |
|
663 case ECamDynamicSettingOpticalJoyStick: |
|
664 crKey = KCamCrFeatureOpticalJoyStick; |
|
665 break; |
|
666 case ECamDynamicSetting2ndCameraOrientation: |
|
667 crKey = KCamCrFeature2ndCameraOrientation; |
|
668 break; |
|
669 case ECamDynamicSettingUIOrientationOverride: |
|
670 crKey = KCamCrFeatureUIOrientationOverride; |
|
671 break; |
|
672 case ECamDynamicSettingThumbnailManagerAPI: |
|
673 crKey = KCamCrFeatureThumbnailManagerAPI; |
|
674 break; |
|
675 case ECamDynamicSettingBurstFileSizeEstimateFactor: |
|
676 crKey = KCamCrFeatureBurstFileSizeEstimateFactor; |
|
677 break; |
|
678 case ECamDynamicSettingBurstMode: |
|
679 crKey = KCamCrFeatureBurstMode; |
|
680 break; |
|
681 case ECamDynamicSettingContinuousAF: |
|
682 crKey = KCamCrFeatureContinuousAF; |
|
683 break; |
|
684 default: |
|
685 PRINT( _L("Camera <> CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL, leave!!!" ) ) |
|
686 User::Leave( KErrNotSupported ); |
|
687 } |
|
688 PRINT( _L("Camera <= CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL" ) ) |
|
689 return crKey; |
|
690 } |
|
691 |
|
692 |
|
693 |
|
694 // |
|
695 //CCameraUiConfigManagerImp::MapSettingItemToCrKeyL |
|
696 // |
|
697 TUint32 |
|
698 CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL( const TInt aSettingItem ) const |
|
699 { |
|
700 PRINT( _L("Camera => CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL" )) |
|
701 TUint32 crKey( 0 ); |
|
702 switch ( aSettingItem ) |
|
703 { |
|
704 case ECamDynamicSettingVideoSceneModeNormal: |
|
705 crKey = KCamCrFeatureVideoSceneNormal; |
|
706 break; |
|
707 case ECamDynamicSettingVideoSceneModeNight: |
|
708 crKey = KCamCrFeatureVideoSceneModeNight; |
|
709 break; |
|
710 case ECamDynamicSettingVideoSceneModeLowLight: |
|
711 crKey = KCamCrFeatureVideoSceneModeLowLight; |
|
712 break; |
|
713 case ECamDynamicSettingDSAViewFinder: |
|
714 crKey = KCamCrFeatureDSAViewFinder; |
|
715 break; |
|
716 case ECamDynamicSettingImageSceneModeAuto: |
|
717 crKey = KCamCrFeatureImageSceneModeAuto; |
|
718 break; |
|
719 case ECamDynamicSettingImageSceneModeUser: |
|
720 crKey = KCamCrFeatureImageSceneModeUser; |
|
721 break; |
|
722 case ECamDynamicSettingImageSceneModeMacro: |
|
723 crKey = KCamCrFeatureImageSceneModeMacro; |
|
724 break; |
|
725 case ECamDynamicSettingImageSceneModePotrait: |
|
726 crKey = KCamCrFeatureImageSceneModePotrait; |
|
727 break; |
|
728 case ECamDynamicSettingImageSceneModeScenery: |
|
729 crKey = KCamCrFeatureImageSceneModeScenery; |
|
730 break; |
|
731 case ECamDynamicSettingImageSceneModeSports: |
|
732 crKey = KCamCrFeatureImageSceneModeSports; |
|
733 break; |
|
734 case ECamDynamicSettingImageSceneModeNight: |
|
735 crKey = KCamCrFeatureImageSceneModeNight; |
|
736 break; |
|
737 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
738 crKey = KCamCrFeatureImageSceneModeNightPotrait; |
|
739 break; |
|
740 case ECamDynamicSettingPCCaptureKeys: |
|
741 crKey = KCamCrFeaturePCCaptureKeys; |
|
742 break; |
|
743 case ECamDynamicSettingSCCaptureKeys: |
|
744 crKey = KCamCrFeatureSCCaptureKeys; |
|
745 break; |
|
746 case ECamDynamicSettingPCAutoFocusKeys: |
|
747 crKey = KCamCrFeaturePCAutoFocusKeys; |
|
748 break; |
|
749 case ECamDynamicSettingSCAutoFocusKeys: |
|
750 crKey = KCamCrFeatureSCAutoFocusKeys; |
|
751 break; |
|
752 case ECamDynamicSettingColorTone: |
|
753 crKey = KCamCrFeatureColorToneItems; |
|
754 break; |
|
755 case ECamDynamicSettingWhiteBalance: |
|
756 crKey = KCamCrFeatureWhiteBalanceItems; |
|
757 break; |
|
758 case ECamDynamicSettingPCZoomIn: |
|
759 crKey = KCamCrFeaturePCZoomInItems; |
|
760 break; |
|
761 case ECamDynamicSettingPCZoomOut: |
|
762 crKey = KCamCrFeaturePCZoomOutItems; |
|
763 break; |
|
764 case ECamDynamicSettingSCZoomIn: |
|
765 crKey = KCamCrFeatureSCZoomInItems; |
|
766 break; |
|
767 case ECamDynamicSettingSCZoomOut: |
|
768 crKey = KCamCrFeatureSCZoomOutItems; |
|
769 break; |
|
770 case ECamDynamicSettingEV: |
|
771 crKey = KCamCrFeatureEVItems; |
|
772 break; |
|
773 case ECamDynamicSettingSharpness: |
|
774 crKey = KCamCrFeatureSharpnessItems; |
|
775 break; |
|
776 case ECamDynamicSettingFlashMode: |
|
777 crKey = KCamCrFeatureFlashModeItems; |
|
778 break; |
|
779 case ECamDynamicSettingMaxDigitalZoomLimits: |
|
780 crKey = KCamCrFeatureMaxDigitalZoomLimits; |
|
781 break; |
|
782 case ECamDynamicSettingMaxExtendedZoomLimits: |
|
783 crKey = KCamCrFeatureMaxExtendedZoomLimits; |
|
784 break; |
|
785 case ECamDynamicSettingMaxOpticalZoomLimits: |
|
786 crKey = KCamCrFeatureMaxOpticalZoomLimits; |
|
787 break; |
|
788 case ECamDynamicSettingZoomLAF: |
|
789 crKey = KCamCrFeatureZoomLAF; |
|
790 break; |
|
791 case ECamDynamicSettingContrast: |
|
792 crKey = KCamCrFeatureContrastItems; |
|
793 break; |
|
794 case ECamDynamicSettingBrightness: |
|
795 crKey = KCamCrFeatureBrightnessItems; |
|
796 break; |
|
797 case ECamDynamicSettingZoomDelays: |
|
798 crKey = KCamCrFeatureZoomDelays; |
|
799 break; |
|
800 default: |
|
801 PRINT( _L("Camera <> CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL, leave!!!" ) ) |
|
802 User::Leave( KErrNotSupported ); |
|
803 } |
|
804 PRINT( _L("Camera <= CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL" ) ) |
|
805 return crKey; |
|
806 } |
|
807 |
|
808 |
|
809 // |
|
810 //CCameraUiConfigManagerImp::LoadCrForFeatureSupport |
|
811 // |
|
812 TBool CCameraUiConfigManagerImp::LoadCrForFeatureSupport( const TInt aSettingId ) const |
|
813 { |
|
814 TBool loadFromCr( ETrue ); |
|
815 |
|
816 switch ( aSettingId ) |
|
817 { |
|
818 case ECamDynamicSettingDSAViewFinder: |
|
819 case ECamDynamicSettingPCCaptureKeys: |
|
820 case ECamDynamicSettingSCCaptureKeys: |
|
821 case ECamDynamicSettingPCAutoFocusKeys: |
|
822 case ECamDynamicSettingSCAutoFocusKeys: |
|
823 case ECamDynamicSettingPCZoomIn: |
|
824 case ECamDynamicSettingPCZoomOut: |
|
825 case ECamDynamicSettingSCZoomIn: |
|
826 case ECamDynamicSettingSCZoomOut: |
|
827 case ECamDynamicSettingMaxDigitalZoomLimits: |
|
828 case ECamDynamicSettingMaxExtendedZoomLimits: |
|
829 case ECamDynamicSettingMaxOpticalZoomLimits: |
|
830 case ECamDynamicSettingZoomLAF: |
|
831 case ECamDynamicSettingImageSceneModeAuto: |
|
832 case ECamDynamicSettingImageSceneModeUser: |
|
833 case ECamDynamicSettingImageSceneModeMacro: |
|
834 case ECamDynamicSettingImageSceneModePotrait: |
|
835 case ECamDynamicSettingImageSceneModeScenery: |
|
836 case ECamDynamicSettingImageSceneModeSports: |
|
837 case ECamDynamicSettingImageSceneModeNight: |
|
838 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
839 case ECamDynamicSettingVideoSceneModeNormal: |
|
840 case ECamDynamicSettingVideoSceneModeNight: |
|
841 case ECamDynamicSettingVideoSceneModeLowLight: |
|
842 case ECamDynamicSettingZoomDelays: |
|
843 loadFromCr = EFalse; |
|
844 break; |
|
845 default: |
|
846 break; |
|
847 } |
|
848 return loadFromCr; |
|
849 } |
|
850 |
|
851 // |
|
852 //CCameraUiConfigManagerImp::LoadSettingEnumerationArray |
|
853 // |
|
854 const TInt* CCameraUiConfigManagerImp::LoadSettingEnumerationArray( const TInt aSettingItem ) |
|
855 { |
|
856 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadSettingEnumerationArray" ) ) |
|
857 const TInt* enumArray = NULL; |
|
858 |
|
859 switch ( aSettingItem ) |
|
860 { |
|
861 case ECamDynamicSettingWhiteBalance: |
|
862 enumArray = KCamWhiteBalanceEnums; |
|
863 break; |
|
864 case ECamDynamicSettingColorTone: |
|
865 enumArray = KCamColorToneEnums; |
|
866 break; |
|
867 case ECamDynamicSettingFlashMode: |
|
868 enumArray = KCamFlashModeEnums; |
|
869 break; |
|
870 case ECamDynamicSettingImageSceneModeAuto: |
|
871 case ECamDynamicSettingImageSceneModeUser: |
|
872 case ECamDynamicSettingImageSceneModeMacro: |
|
873 case ECamDynamicSettingImageSceneModePotrait: |
|
874 case ECamDynamicSettingImageSceneModeScenery: |
|
875 case ECamDynamicSettingImageSceneModeSports: |
|
876 case ECamDynamicSettingImageSceneModeNight: |
|
877 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
878 case ECamDynamicSettingVideoSceneModeNormal: |
|
879 case ECamDynamicSettingVideoSceneModeNight: |
|
880 case ECamDynamicSettingVideoSceneModeLowLight: |
|
881 enumArray = KCamSceneModeEnums; |
|
882 break; |
|
883 default: |
|
884 PRINT( _L("Camera <> CCameraUiConfigManagerImp::LoadSettingEnumerationArray, default!!!" ) ) |
|
885 break; |
|
886 } |
|
887 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadSettingEnumerationArray" ) ) |
|
888 return enumArray; |
|
889 } |
|
890 |
|
891 |
|
892 // |
|
893 //CCameraUiConfigManagerImp::LoadSettingStringArray |
|
894 // |
|
895 const TUint16* const* CCameraUiConfigManagerImp::LoadSettingStringArray( |
|
896 const TInt aSettingItem ) |
|
897 { |
|
898 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadSettingStringArray()" ) ) |
|
899 const TUint16* const* stringArray = NULL; |
|
900 |
|
901 switch ( aSettingItem ) |
|
902 { |
|
903 case ECamDynamicSettingWhiteBalance: |
|
904 stringArray = KCamWhiteBalanceStrings; |
|
905 break; |
|
906 case ECamDynamicSettingColorTone: |
|
907 stringArray = KCamColorToneStrings; |
|
908 break; |
|
909 case ECamDynamicSettingFlashMode: |
|
910 stringArray = KCamFlashModeStrings; |
|
911 break; |
|
912 case ECamDynamicSettingImageSceneModeAuto: |
|
913 case ECamDynamicSettingImageSceneModeUser: |
|
914 case ECamDynamicSettingImageSceneModeMacro: |
|
915 case ECamDynamicSettingImageSceneModePotrait: |
|
916 case ECamDynamicSettingImageSceneModeScenery: |
|
917 case ECamDynamicSettingImageSceneModeSports: |
|
918 case ECamDynamicSettingImageSceneModeNight: |
|
919 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
920 case ECamDynamicSettingVideoSceneModeNormal: |
|
921 case ECamDynamicSettingVideoSceneModeNight: |
|
922 case ECamDynamicSettingVideoSceneModeLowLight: |
|
923 stringArray = KCamSceneModeStrings; |
|
924 break; |
|
925 default: |
|
926 break; |
|
927 } |
|
928 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadSettingStringArray()" ) ) |
|
929 return stringArray; |
|
930 } |
|
931 |
|
932 |
|
933 /* |
|
934 * Organizing CenRep data to a definite structure for scene modes. |
|
935 */ |
|
936 void CCameraUiConfigManagerImp::OrganiseSceneSettings( |
|
937 RArray<TSceneSettings>& aTargetArray, |
|
938 RArray<TInt>& aSceneSettingsArray, |
|
939 const TBool aPhotoScene ) |
|
940 { |
|
941 if ( aSceneSettingsArray.Count() > 0 ) |
|
942 { |
|
943 TSceneSettings scene; |
|
944 TInt index = 0; |
|
945 // The following is the order how we read values from CenRep |
|
946 // each time for each specific scene mode in Image & Video case. |
|
947 scene.iSupported = aSceneSettingsArray[index++]; |
|
948 scene.iIdentifier = aSceneSettingsArray[index++]; |
|
949 scene.iExposureMode = aSceneSettingsArray[index++]; |
|
950 scene.iWhiteBalance = aSceneSettingsArray[index++]; |
|
951 scene.iFlash = aSceneSettingsArray[index++]; |
|
952 scene.iContrastMode = aSceneSettingsArray[index++]; |
|
953 scene.iFocalDistance = aSceneSettingsArray[index++]; |
|
954 |
|
955 if ( aPhotoScene ) |
|
956 { |
|
957 // The following is the order how we read values from CenRep |
|
958 // each time for each specific scene mode in Image case. |
|
959 // Note: In image scene, we ignore iFrameRate as this wont be configured |
|
960 // for any of the image scenes |
|
961 scene.iSharpnessMode = aSceneSettingsArray[index++]; |
|
962 scene.iLightSensitivityMode = aSceneSettingsArray[index++]; |
|
963 scene.iExposureCompensationValue = aSceneSettingsArray[index++]; |
|
964 } |
|
965 else |
|
966 { |
|
967 // The following is the order how we read values from CenRep |
|
968 // each time for each specific scene mode in Video scene case. |
|
969 // Note: In image scene, we ignore iFrameRate as this wont be configured |
|
970 // for any of the image scenes |
|
971 scene.iFrameRate = aSceneSettingsArray[index++]; |
|
972 } |
|
973 aTargetArray.Append( scene ); |
|
974 } |
|
975 } |
|
976 // End of file |