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 case ECamDynamicSettingScreenModes: |
|
301 { |
|
302 PRINT1( _L("Camera <> CCameraUiConfigManagerImp::LoadAllDynamicSettingsL() %d" ), settingId ) |
|
303 LoadConfiguredSettingItemValuesFromCrL( settingId, |
|
304 supportedValue, |
|
305 settingItemDefaultData ); |
|
306 break; |
|
307 } |
|
308 default: |
|
309 { |
|
310 break; |
|
311 } |
|
312 |
|
313 } |
|
314 } |
|
315 CleanupStack::PopAndDestroy( &settingItemDefaultData ); |
|
316 User::LeaveIfError( error ); |
|
317 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadAllDynamicSettingsL()" )) |
|
318 } |
|
319 |
|
320 |
|
321 |
|
322 // |
|
323 //CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCr |
|
324 // |
|
325 void CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCrL( |
|
326 const TInt aSettingId, |
|
327 const TInt aSupportedValue, |
|
328 RArray<TDynamicSettingsData>& aDefaultItems ) |
|
329 { |
|
330 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCrL" )) |
|
331 // Load supported setting items only when feature is supported |
|
332 LoadDefaultSettingsDataL( aSettingId, aDefaultItems ); |
|
333 AppendToSettingsArrayL( aSettingId, |
|
334 aSupportedValue, |
|
335 aDefaultItems, |
|
336 MapSettingItemToCrItemsKeyL( aSettingId ), |
|
337 ETrue ); |
|
338 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadConfiguredSettingItemValuesFromCrL" )) |
|
339 } |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 // |
|
345 // CCameraUiConfigManagerImp::AppendToSettingsArrayL |
|
346 // |
|
347 void CCameraUiConfigManagerImp::AppendToSettingsArrayL( const TInt aItemId, |
|
348 const TInt aSupportedValue, |
|
349 RArray<TDynamicSettingsData>& aAllItems, |
|
350 TUint32 aCrItemsKey, |
|
351 TBool aLoadSettingItems ) |
|
352 { |
|
353 PRINT( _L("Camera => CCameraUiConfigManagerImp::AppendToSettingsArrayL" )) |
|
354 TSupportedSettingsData* newSetting = new( ELeave ) TSupportedSettingsData; |
|
355 CleanupStack::PushL( newSetting ); |
|
356 |
|
357 newSetting->iSettingId = aItemId; // setting id |
|
358 newSetting->iSupportedValue = aSupportedValue; // feature support |
|
359 if ( aLoadSettingItems && aSupportedValue ) |
|
360 { |
|
361 // all configured setting items from cr only if the feature is supported |
|
362 GetSupportedSettingIdsL( aAllItems, |
|
363 newSetting->iSupportedSettingItems, |
|
364 aCrItemsKey ); |
|
365 } |
|
366 |
|
367 iSupportedSettings.AppendL( newSetting ); |
|
368 CleanupStack::Pop( newSetting ); |
|
369 PRINT( _L("Camera <= CCameraUiConfigManagerImp::AppendToSettingsArrayL" )) |
|
370 } |
|
371 |
|
372 |
|
373 |
|
374 // --------------------------------------------------------------------------- |
|
375 // CCameraUiConfigManager::LoadAllDynamicSettingL |
|
376 // Load all dynamic settings |
|
377 // --------------------------------------------------------------------------- |
|
378 // |
|
379 void CCameraUiConfigManagerImp::LoadDefaultSettingsDataL( |
|
380 const TInt aSettingId, |
|
381 RArray<TDynamicSettingsData>& aDefaultItems ) |
|
382 { |
|
383 PRINT1( _L("Camera => CCameraUiConfigManagerImp::LoadDefaultSettingsDataL setting id [%d]" ), aSettingId ) |
|
384 aDefaultItems.Reset(); |
|
385 TInt i = 0; |
|
386 const TInt* settingsId = LoadSettingEnumerationArray( aSettingId ); |
|
387 const TUint16* const* stringArray = LoadSettingStringArray( aSettingId ); |
|
388 |
|
389 if ( settingsId && stringArray ) |
|
390 { |
|
391 while ( settingsId[i] != KCamLastSettingItem ) |
|
392 { |
|
393 TDynamicSettingsData data; |
|
394 data.iItemId = settingsId[i]; |
|
395 data.iText = stringArray[i]; |
|
396 aDefaultItems.AppendL( data ); |
|
397 i++; |
|
398 } |
|
399 } |
|
400 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadDefaultSettingsDataL()" ) ) |
|
401 } |
|
402 |
|
403 |
|
404 |
|
405 // |
|
406 // CCameraUiConfigManagerImp::GetSupportedSettingIdsL |
|
407 // |
|
408 void CCameraUiConfigManagerImp::GetSupportedSettingIdsL( |
|
409 RArray<TDynamicSettingsData>& aAllItems, |
|
410 RArray<TInt>& aSupportedValues, |
|
411 const TUint32 aCrKey ) |
|
412 { |
|
413 PRINT( _L("Camera => CameraUiConfigManagerImp::GetSupportedSettingIdsL" )) |
|
414 aSupportedValues.Reset(); |
|
415 |
|
416 HBufC* string; // not sure but does this need to be in cleanupstack since this can later leave? |
|
417 string = GetStringDataL( aCrKey ); |
|
418 TBool clearstring = EFalse; |
|
419 |
|
420 TPtrC data = string->Des(); |
|
421 TPtrC currentItem( KNullDesC ); |
|
422 |
|
423 while ( data.Length() > 0 ) |
|
424 { |
|
425 // Find the next instance of item separator |
|
426 const TInt separatorIndex( data.Find( KItemsSeparator ) ); |
|
427 |
|
428 if( KErrNotFound != separatorIndex ) |
|
429 { |
|
430 // There is more than one item in the string still |
|
431 // Get the current item - everything before separator |
|
432 currentItem.Set( data.Left( separatorIndex ) ); |
|
433 // The remaining data is now everything after the separator |
|
434 data.Set( data.Right( data.Length() - separatorIndex - 1 ) ); |
|
435 } |
|
436 else |
|
437 { |
|
438 // This is the last item in the string |
|
439 currentItem.Set( data ); |
|
440 data.Set( KNullDesC ); |
|
441 clearstring = ETrue; |
|
442 } |
|
443 |
|
444 // Get the item id for the current item, and if found, append to list |
|
445 TInt settingItem; |
|
446 PRINT1( _L("Camera <> settingItem: %S"), string ) |
|
447 if ( currentItem[0]-48 >= 0 && currentItem[0]-48 <= 9 || |
|
448 ( currentItem[0] == '-' && // check for negative number too |
|
449 currentItem[1]-48 >= 0 && currentItem[1]-48 <= 9 ) ) |
|
450 { |
|
451 // read the numeric value equivalent to the numeric string |
|
452 TLex lex; |
|
453 if( currentItem.Length() > 2 ) |
|
454 { |
|
455 // if it is hex value, then extract hex value |
|
456 if( currentItem[1] == 'x' || currentItem[1] == 'X' ) |
|
457 { |
|
458 lex = TLex( currentItem.Mid(2) ); |
|
459 TRadix radix = EHex; |
|
460 TUint value; |
|
461 lex.Val(value, radix); |
|
462 settingItem = value; |
|
463 } |
|
464 else // extract integer |
|
465 { |
|
466 lex = TLex( currentItem ); |
|
467 lex.Val( settingItem ); |
|
468 } |
|
469 } |
|
470 else // extract integer |
|
471 { |
|
472 lex = TLex( currentItem ); |
|
473 lex.Val( settingItem ); |
|
474 } |
|
475 } |
|
476 else |
|
477 { |
|
478 // not a numeric string, check for necessary enum equivalents. |
|
479 settingItem = SettingItemId( aAllItems, currentItem ); |
|
480 } |
|
481 |
|
482 PRINT1( _L("Camera <> settingItem: %d"), settingItem ) |
|
483 |
|
484 if( KErrNotFound != settingItem ) |
|
485 { |
|
486 aSupportedValues.AppendL( settingItem ); // here |
|
487 } |
|
488 if( clearstring ) |
|
489 { |
|
490 delete string; |
|
491 } |
|
492 } |
|
493 PRINT( _L("Camera <= CameraUiConfigManagerImp::GetSupportedSettingIdsL" )) |
|
494 } |
|
495 |
|
496 |
|
497 |
|
498 // |
|
499 // CCameraUiConfigManagerImp::SettingItemId |
|
500 // |
|
501 TInt CCameraUiConfigManagerImp::SettingItemId( |
|
502 RArray<TDynamicSettingsData>& aPossibleSettings, |
|
503 const TDesC& aItemString ) const |
|
504 { |
|
505 PRINT( _L("Camera => CameraUiConfigManagerImp::SettingItemId" )) |
|
506 for( TInt i = aPossibleSettings.Count()-1; i >= 0; i-- ) |
|
507 { |
|
508 if( aItemString == aPossibleSettings[i].iText ) |
|
509 { |
|
510 PRINT( _L("Camera <= CameraUiConfigManagerImp::SettingItemId" )) |
|
511 return aPossibleSettings[i].iItemId; |
|
512 } |
|
513 } |
|
514 |
|
515 PRINT( _L("Camera <= CameraUiConfigManagerImp::SettingItemId" )) |
|
516 // No id found for the argument string |
|
517 return KErrNotFound; |
|
518 } |
|
519 |
|
520 |
|
521 // |
|
522 // CCameraUiConfigManagerImp::GetStringDataL |
|
523 // |
|
524 HBufC* CCameraUiConfigManagerImp::GetStringDataL( const TUint32 aCrKey ) |
|
525 { |
|
526 PRINT( _L("Camera => CameraUiConfigManagerImp::GetStringDataL" )) |
|
527 HBufC* string = HBufC::NewLC( KCamCRStringInitialLength ); |
|
528 |
|
529 TPtr ptr = string->Des(); |
|
530 TInt size = 0; |
|
531 TInt status = iRepository->Get( aCrKey, ptr, size ); |
|
532 |
|
533 // Did not fit into the string, reserve more memory and try again |
|
534 if( KErrOverflow == status ) |
|
535 { |
|
536 CleanupStack::PopAndDestroy( string ); // String |
|
537 string = HBufC::NewLC( size ); |
|
538 ptr = string->Des(); |
|
539 status = iRepository->Get( aCrKey, ptr, size ); |
|
540 } |
|
541 |
|
542 CleanupStack::Pop( string ); // string |
|
543 User::LeaveIfError( status ); |
|
544 |
|
545 PRINT( _L("Camera <= CameraUiConfigManagerImp::GetStringDataL" )) |
|
546 return string; |
|
547 } |
|
548 |
|
549 |
|
550 |
|
551 // --------------------------------------------------------------------------- |
|
552 // CCameraUiConfigManager::SearchInSettingsListFor |
|
553 // Searches in a settings list for a particular setting item. |
|
554 // --------------------------------------------------------------------------- |
|
555 // |
|
556 TInt CCameraUiConfigManagerImp::SearchInSettingsListFor( |
|
557 const RPointerArray<TSupportedSettingsData>& aSettingsList, |
|
558 TInt aSettingItem ) const |
|
559 { |
|
560 return aSettingsList.Find( aSettingItem, SettingIdMatches ); |
|
561 } |
|
562 |
|
563 |
|
564 // |
|
565 //CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL |
|
566 // |
|
567 TUint32 CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL( |
|
568 const TInt aSettingItem ) const |
|
569 { |
|
570 PRINT( _L("Camera => CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL" )) |
|
571 TUint32 crKey( 0 ); |
|
572 switch ( aSettingItem ) |
|
573 { |
|
574 case ECamDynamicSettingRequiredRamMemory: |
|
575 crKey = KCamCrFeatureRequiredRamMemory; |
|
576 break; |
|
577 case ECamDynamicSettingCaptureToneDelaySupport: |
|
578 crKey = KCamCrFeatureCaptureToneDelaySupport; |
|
579 break; |
|
580 case ECamDynamicSettingCaptureToneDelayValue: |
|
581 crKey = KCamCrFeatureCaptureToneDelayValue; |
|
582 break; |
|
583 case ECamDynamicSettingCriticalLevelRamMemory: |
|
584 crKey = KCamCrFeatureCriticalLevelRamMemory; |
|
585 break; |
|
586 case ECamDynamicSettingRequiredRamMemoryFocusGained: |
|
587 crKey = KCamCrFeatureRequiredRamMemoryFocusGained; |
|
588 break; |
|
589 case ECamDynamicSettingCriticalLevelRamMemoryFocusGained: |
|
590 crKey = KCamCrFeatureCriticalLevelRamMemoryFocusGained; |
|
591 break; |
|
592 case ECamDynamicSettingPhoto: |
|
593 crKey = KCamCrFeatureKeyPhotos; |
|
594 break; |
|
595 case ECamDynamicSettingPublishZoomState: |
|
596 crKey = KCamCrFeatureKeyPublishZoomSate; |
|
597 break; |
|
598 case ECamDynamicSettingAutofocusSetInHyperfocalAtStartup: |
|
599 crKey = KCamCrFeatureKeyAFSetInHyperfocalAtStartup; |
|
600 break; |
|
601 case ECamDynamicSettingExtDigitalZoom: |
|
602 crKey = KCamCrFeatureExtDigitalZoom; |
|
603 break; |
|
604 case ECamDynamicSettingLocation: |
|
605 crKey = KCamCrFeatureLocation; |
|
606 break; |
|
607 case ECamDynamicSettingKeyLockWatcher: |
|
608 crKey = KCamCrFeatureKeyLockWatcher; |
|
609 break; |
|
610 case ECamDynamicSettingColorTone: |
|
611 crKey = KCamCrFeatureColorTone; |
|
612 break; |
|
613 case ECamDynamicSettingSharpness: |
|
614 crKey = KCamCrFeatureSharpness; |
|
615 break; |
|
616 case ECamDynamicSettingWhiteBalance: |
|
617 crKey = KCamCrFeatureWhiteBalance; |
|
618 break; |
|
619 case ECamDynamicSettingSecondaryCamera: |
|
620 crKey = KCamCrFeatureSecondaryCamera; |
|
621 break; |
|
622 case ECamDynamicSettingLensCover: |
|
623 crKey = KCamCrFeatureLensCover; |
|
624 break; |
|
625 case ECamDynamicSettingXenonFlash: |
|
626 crKey = KCamCrFeatureXenonFlash; |
|
627 break; |
|
628 case ECamDynamicSettingOneClickUpload: |
|
629 crKey = KCamCrFeatureOneClickUpLoad; |
|
630 break; |
|
631 case ECamDynamicSettingVideoLight: |
|
632 crKey = KCamCrFeatureVideoLight; |
|
633 break; |
|
634 case ECamDynamicSettingAutoFocus: |
|
635 crKey = KCamCrFeatureAutoFocus; |
|
636 break; |
|
637 case ECamDynamicSettingExtLightSensitivity: |
|
638 crKey = KCamCrFeatureExtLightSensitivity; |
|
639 break; |
|
640 case ECamDynamicSettingContrast: |
|
641 crKey = KCamCrFeatureContrast; |
|
642 break; |
|
643 case ECamDynamicSettingBrightness: |
|
644 crKey = KCamCrFeatureBrightness; |
|
645 break; |
|
646 case ECamDynamicSettingEV: |
|
647 crKey = KCamCrFeatureEV; |
|
648 break; |
|
649 case ECamDynamicSettingFlashMode: |
|
650 crKey = KCamCrFeatureFlashMode; |
|
651 break; |
|
652 case ECamDynamicSettingLightSensitivity: |
|
653 crKey = KCamCrFeatureLightSensitivity; |
|
654 break; |
|
655 case ECamDynamicSettingVideoStabilization: |
|
656 crKey = KCamCrFeatureVideoStabilization; |
|
657 break; |
|
658 case ECamDynamicSettingOrientationSensor: |
|
659 crKey = KCamCrFeatureOrientationSensor; |
|
660 break; |
|
661 case ECamDynamicSettingFaceTracking: |
|
662 crKey = KCamCrFeatureFaceTracking; |
|
663 break; |
|
664 case ECamDynamicSettingOpticalJoyStick: |
|
665 crKey = KCamCrFeatureOpticalJoyStick; |
|
666 break; |
|
667 case ECamDynamicSetting2ndCameraOrientation: |
|
668 crKey = KCamCrFeature2ndCameraOrientation; |
|
669 break; |
|
670 case ECamDynamicSettingUIOrientationOverride: |
|
671 crKey = KCamCrFeatureUIOrientationOverride; |
|
672 break; |
|
673 case ECamDynamicSettingThumbnailManagerAPI: |
|
674 crKey = KCamCrFeatureThumbnailManagerAPI; |
|
675 break; |
|
676 case ECamDynamicSettingBurstFileSizeEstimateFactor: |
|
677 crKey = KCamCrFeatureBurstFileSizeEstimateFactor; |
|
678 break; |
|
679 case ECamDynamicSettingBurstMode: |
|
680 crKey = KCamCrFeatureBurstMode; |
|
681 break; |
|
682 case ECamDynamicSettingContinuousAF: |
|
683 crKey = KCamCrFeatureContinuousAF; |
|
684 break; |
|
685 default: |
|
686 PRINT( _L("Camera <> CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL, leave!!!" ) ) |
|
687 User::Leave( KErrNotSupported ); |
|
688 } |
|
689 PRINT( _L("Camera <= CCameraUiConfigManagerImp::MapSettingItemToCrFeatureKeyL" ) ) |
|
690 return crKey; |
|
691 } |
|
692 |
|
693 |
|
694 |
|
695 // |
|
696 //CCameraUiConfigManagerImp::MapSettingItemToCrKeyL |
|
697 // |
|
698 TUint32 |
|
699 CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL( const TInt aSettingItem ) const |
|
700 { |
|
701 PRINT( _L("Camera => CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL" )) |
|
702 TUint32 crKey( 0 ); |
|
703 switch ( aSettingItem ) |
|
704 { |
|
705 case ECamDynamicSettingVideoSceneModeNormal: |
|
706 crKey = KCamCrFeatureVideoSceneNormal; |
|
707 break; |
|
708 case ECamDynamicSettingVideoSceneModeNight: |
|
709 crKey = KCamCrFeatureVideoSceneModeNight; |
|
710 break; |
|
711 case ECamDynamicSettingVideoSceneModeLowLight: |
|
712 crKey = KCamCrFeatureVideoSceneModeLowLight; |
|
713 break; |
|
714 case ECamDynamicSettingDSAViewFinder: |
|
715 crKey = KCamCrFeatureDSAViewFinder; |
|
716 break; |
|
717 case ECamDynamicSettingImageSceneModeAuto: |
|
718 crKey = KCamCrFeatureImageSceneModeAuto; |
|
719 break; |
|
720 case ECamDynamicSettingImageSceneModeUser: |
|
721 crKey = KCamCrFeatureImageSceneModeUser; |
|
722 break; |
|
723 case ECamDynamicSettingImageSceneModeMacro: |
|
724 crKey = KCamCrFeatureImageSceneModeMacro; |
|
725 break; |
|
726 case ECamDynamicSettingImageSceneModePotrait: |
|
727 crKey = KCamCrFeatureImageSceneModePotrait; |
|
728 break; |
|
729 case ECamDynamicSettingImageSceneModeScenery: |
|
730 crKey = KCamCrFeatureImageSceneModeScenery; |
|
731 break; |
|
732 case ECamDynamicSettingImageSceneModeSports: |
|
733 crKey = KCamCrFeatureImageSceneModeSports; |
|
734 break; |
|
735 case ECamDynamicSettingImageSceneModeNight: |
|
736 crKey = KCamCrFeatureImageSceneModeNight; |
|
737 break; |
|
738 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
739 crKey = KCamCrFeatureImageSceneModeNightPotrait; |
|
740 break; |
|
741 case ECamDynamicSettingPCCaptureKeys: |
|
742 crKey = KCamCrFeaturePCCaptureKeys; |
|
743 break; |
|
744 case ECamDynamicSettingSCCaptureKeys: |
|
745 crKey = KCamCrFeatureSCCaptureKeys; |
|
746 break; |
|
747 case ECamDynamicSettingPCAutoFocusKeys: |
|
748 crKey = KCamCrFeaturePCAutoFocusKeys; |
|
749 break; |
|
750 case ECamDynamicSettingSCAutoFocusKeys: |
|
751 crKey = KCamCrFeatureSCAutoFocusKeys; |
|
752 break; |
|
753 case ECamDynamicSettingColorTone: |
|
754 crKey = KCamCrFeatureColorToneItems; |
|
755 break; |
|
756 case ECamDynamicSettingWhiteBalance: |
|
757 crKey = KCamCrFeatureWhiteBalanceItems; |
|
758 break; |
|
759 case ECamDynamicSettingPCZoomIn: |
|
760 crKey = KCamCrFeaturePCZoomInItems; |
|
761 break; |
|
762 case ECamDynamicSettingPCZoomOut: |
|
763 crKey = KCamCrFeaturePCZoomOutItems; |
|
764 break; |
|
765 case ECamDynamicSettingSCZoomIn: |
|
766 crKey = KCamCrFeatureSCZoomInItems; |
|
767 break; |
|
768 case ECamDynamicSettingSCZoomOut: |
|
769 crKey = KCamCrFeatureSCZoomOutItems; |
|
770 break; |
|
771 case ECamDynamicSettingEV: |
|
772 crKey = KCamCrFeatureEVItems; |
|
773 break; |
|
774 case ECamDynamicSettingSharpness: |
|
775 crKey = KCamCrFeatureSharpnessItems; |
|
776 break; |
|
777 case ECamDynamicSettingFlashMode: |
|
778 crKey = KCamCrFeatureFlashModeItems; |
|
779 break; |
|
780 case ECamDynamicSettingMaxDigitalZoomLimits: |
|
781 crKey = KCamCrFeatureMaxDigitalZoomLimits; |
|
782 break; |
|
783 case ECamDynamicSettingMaxExtendedZoomLimits: |
|
784 crKey = KCamCrFeatureMaxExtendedZoomLimits; |
|
785 break; |
|
786 case ECamDynamicSettingMaxOpticalZoomLimits: |
|
787 crKey = KCamCrFeatureMaxOpticalZoomLimits; |
|
788 break; |
|
789 case ECamDynamicSettingZoomLAF: |
|
790 crKey = KCamCrFeatureZoomLAF; |
|
791 break; |
|
792 case ECamDynamicSettingContrast: |
|
793 crKey = KCamCrFeatureContrastItems; |
|
794 break; |
|
795 case ECamDynamicSettingBrightness: |
|
796 crKey = KCamCrFeatureBrightnessItems; |
|
797 break; |
|
798 case ECamDynamicSettingZoomDelays: |
|
799 crKey = KCamCrFeatureZoomDelays; |
|
800 break; |
|
801 case ECamDynamicSettingScreenModes: |
|
802 crKey = KCamCrFeatureScreenModes; |
|
803 break; |
|
804 default: |
|
805 PRINT( _L("Camera <> CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL, leave!!!" ) ) |
|
806 User::Leave( KErrNotSupported ); |
|
807 } |
|
808 PRINT( _L("Camera <= CCameraUiConfigManagerImp::MapSettingItemToCrItemsKeyL" ) ) |
|
809 return crKey; |
|
810 } |
|
811 |
|
812 |
|
813 // |
|
814 //CCameraUiConfigManagerImp::LoadCrForFeatureSupport |
|
815 // |
|
816 TBool CCameraUiConfigManagerImp::LoadCrForFeatureSupport( const TInt aSettingId ) const |
|
817 { |
|
818 TBool loadFromCr( ETrue ); |
|
819 |
|
820 switch ( aSettingId ) |
|
821 { |
|
822 case ECamDynamicSettingDSAViewFinder: |
|
823 case ECamDynamicSettingPCCaptureKeys: |
|
824 case ECamDynamicSettingSCCaptureKeys: |
|
825 case ECamDynamicSettingPCAutoFocusKeys: |
|
826 case ECamDynamicSettingSCAutoFocusKeys: |
|
827 case ECamDynamicSettingPCZoomIn: |
|
828 case ECamDynamicSettingPCZoomOut: |
|
829 case ECamDynamicSettingSCZoomIn: |
|
830 case ECamDynamicSettingSCZoomOut: |
|
831 case ECamDynamicSettingMaxDigitalZoomLimits: |
|
832 case ECamDynamicSettingMaxExtendedZoomLimits: |
|
833 case ECamDynamicSettingMaxOpticalZoomLimits: |
|
834 case ECamDynamicSettingZoomLAF: |
|
835 case ECamDynamicSettingImageSceneModeAuto: |
|
836 case ECamDynamicSettingImageSceneModeUser: |
|
837 case ECamDynamicSettingImageSceneModeMacro: |
|
838 case ECamDynamicSettingImageSceneModePotrait: |
|
839 case ECamDynamicSettingImageSceneModeScenery: |
|
840 case ECamDynamicSettingImageSceneModeSports: |
|
841 case ECamDynamicSettingImageSceneModeNight: |
|
842 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
843 case ECamDynamicSettingVideoSceneModeNormal: |
|
844 case ECamDynamicSettingVideoSceneModeNight: |
|
845 case ECamDynamicSettingVideoSceneModeLowLight: |
|
846 case ECamDynamicSettingZoomDelays: |
|
847 case ECamDynamicSettingScreenModes: |
|
848 loadFromCr = EFalse; |
|
849 break; |
|
850 default: |
|
851 break; |
|
852 } |
|
853 return loadFromCr; |
|
854 } |
|
855 |
|
856 // |
|
857 //CCameraUiConfigManagerImp::LoadSettingEnumerationArray |
|
858 // |
|
859 const TInt* CCameraUiConfigManagerImp::LoadSettingEnumerationArray( const TInt aSettingItem ) |
|
860 { |
|
861 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadSettingEnumerationArray" ) ) |
|
862 const TInt* enumArray = NULL; |
|
863 |
|
864 switch ( aSettingItem ) |
|
865 { |
|
866 case ECamDynamicSettingWhiteBalance: |
|
867 enumArray = KCamWhiteBalanceEnums; |
|
868 break; |
|
869 case ECamDynamicSettingColorTone: |
|
870 enumArray = KCamColorToneEnums; |
|
871 break; |
|
872 case ECamDynamicSettingFlashMode: |
|
873 enumArray = KCamFlashModeEnums; |
|
874 break; |
|
875 case ECamDynamicSettingImageSceneModeAuto: |
|
876 case ECamDynamicSettingImageSceneModeUser: |
|
877 case ECamDynamicSettingImageSceneModeMacro: |
|
878 case ECamDynamicSettingImageSceneModePotrait: |
|
879 case ECamDynamicSettingImageSceneModeScenery: |
|
880 case ECamDynamicSettingImageSceneModeSports: |
|
881 case ECamDynamicSettingImageSceneModeNight: |
|
882 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
883 case ECamDynamicSettingVideoSceneModeNormal: |
|
884 case ECamDynamicSettingVideoSceneModeNight: |
|
885 case ECamDynamicSettingVideoSceneModeLowLight: |
|
886 enumArray = KCamSceneModeEnums; |
|
887 break; |
|
888 default: |
|
889 PRINT( _L("Camera <> CCameraUiConfigManagerImp::LoadSettingEnumerationArray, default!!!" ) ) |
|
890 break; |
|
891 } |
|
892 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadSettingEnumerationArray" ) ) |
|
893 return enumArray; |
|
894 } |
|
895 |
|
896 |
|
897 // |
|
898 //CCameraUiConfigManagerImp::LoadSettingStringArray |
|
899 // |
|
900 const TUint16* const* CCameraUiConfigManagerImp::LoadSettingStringArray( |
|
901 const TInt aSettingItem ) |
|
902 { |
|
903 PRINT( _L("Camera => CCameraUiConfigManagerImp::LoadSettingStringArray()" ) ) |
|
904 const TUint16* const* stringArray = NULL; |
|
905 |
|
906 switch ( aSettingItem ) |
|
907 { |
|
908 case ECamDynamicSettingWhiteBalance: |
|
909 stringArray = KCamWhiteBalanceStrings; |
|
910 break; |
|
911 case ECamDynamicSettingColorTone: |
|
912 stringArray = KCamColorToneStrings; |
|
913 break; |
|
914 case ECamDynamicSettingFlashMode: |
|
915 stringArray = KCamFlashModeStrings; |
|
916 break; |
|
917 case ECamDynamicSettingImageSceneModeAuto: |
|
918 case ECamDynamicSettingImageSceneModeUser: |
|
919 case ECamDynamicSettingImageSceneModeMacro: |
|
920 case ECamDynamicSettingImageSceneModePotrait: |
|
921 case ECamDynamicSettingImageSceneModeScenery: |
|
922 case ECamDynamicSettingImageSceneModeSports: |
|
923 case ECamDynamicSettingImageSceneModeNight: |
|
924 case ECamDynamicSettingImageSceneModeNightPotrait: |
|
925 case ECamDynamicSettingVideoSceneModeNormal: |
|
926 case ECamDynamicSettingVideoSceneModeNight: |
|
927 case ECamDynamicSettingVideoSceneModeLowLight: |
|
928 stringArray = KCamSceneModeStrings; |
|
929 break; |
|
930 default: |
|
931 break; |
|
932 } |
|
933 PRINT( _L("Camera <= CCameraUiConfigManagerImp::LoadSettingStringArray()" ) ) |
|
934 return stringArray; |
|
935 } |
|
936 |
|
937 |
|
938 /* |
|
939 * Organizing CenRep data to a definite structure for scene modes. |
|
940 */ |
|
941 void CCameraUiConfigManagerImp::OrganiseSceneSettings( |
|
942 RArray<TSceneSettings>& aTargetArray, |
|
943 RArray<TInt>& aSceneSettingsArray, |
|
944 const TBool aPhotoScene ) |
|
945 { |
|
946 if ( aSceneSettingsArray.Count() > 0 ) |
|
947 { |
|
948 TSceneSettings scene; |
|
949 TInt index = 0; |
|
950 // The following is the order how we read values from CenRep |
|
951 // each time for each specific scene mode in Image & Video case. |
|
952 scene.iSupported = aSceneSettingsArray[index++]; |
|
953 scene.iIdentifier = aSceneSettingsArray[index++]; |
|
954 scene.iExposureMode = aSceneSettingsArray[index++]; |
|
955 scene.iWhiteBalance = aSceneSettingsArray[index++]; |
|
956 scene.iFlash = aSceneSettingsArray[index++]; |
|
957 scene.iContrastMode = aSceneSettingsArray[index++]; |
|
958 scene.iFocalDistance = aSceneSettingsArray[index++]; |
|
959 |
|
960 if ( aPhotoScene ) |
|
961 { |
|
962 // The following is the order how we read values from CenRep |
|
963 // each time for each specific scene mode in Image case. |
|
964 // Note: In image scene, we ignore iFrameRate as this wont be configured |
|
965 // for any of the image scenes |
|
966 scene.iSharpnessMode = aSceneSettingsArray[index++]; |
|
967 scene.iLightSensitivityMode = aSceneSettingsArray[index++]; |
|
968 scene.iExposureCompensationValue = aSceneSettingsArray[index++]; |
|
969 } |
|
970 else |
|
971 { |
|
972 // The following is the order how we read values from CenRep |
|
973 // each time for each specific scene mode in Video scene case. |
|
974 // Note: In image scene, we ignore iFrameRate as this wont be configured |
|
975 // for any of the image scenes |
|
976 scene.iFrameRate = aSceneSettingsArray[index++]; |
|
977 } |
|
978 aTargetArray.Append( scene ); |
|
979 } |
|
980 } |
|
981 // End of file |
|