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