camerauis/cameraapp/generic/src/CamSettingsModel.cpp
branchRCL_3
changeset 10 8c55c525d5d7
parent 2 e8773a61782d
child 11 d486e5e3cc9a
equal deleted inserted replaced
9:792dfc98fb3b 10:8c55c525d5d7
   135         {
   135         {
   136         iStaticModel->ResetSettingItem( KCamCrUserSceneLightSensitivity );
   136         iStaticModel->ResetSettingItem( KCamCrUserSceneLightSensitivity );
   137         }
   137         }
   138     iStaticModel->ResetSettingItem( KCamCrUserSceneContrast );
   138     iStaticModel->ResetSettingItem( KCamCrUserSceneContrast );
   139     iStaticModel->ResetSettingItem( KCamCrUserSceneImageSharpness );
   139     iStaticModel->ResetSettingItem( KCamCrUserSceneImageSharpness );
       
   140     iStaticModel->ResetSettingItem( KCamCrUserSceneDefault ); 
   140 
   141 
   141     // Reload the static user scene settings
   142     // Reload the static user scene settings
   142     iUserSceneSettings.ResetAndDestroy();
   143     iUserSceneSettings.ResetAndDestroy();
   143     iStaticModel->ReadFromCenRepL(
   144     iStaticModel->ReadFromCenRepL(
   144                     static_cast<TInt>( ECamSettingItemUserSceneRangeMin ),
   145                     static_cast<TInt>( ECamSettingItemUserSceneRangeMin ),
   395     SaveStaticSettingL( settingId );
   396     SaveStaticSettingL( settingId );
   396     
   397     
   397     // If there is only one setting changed other than scene mode setting 
   398     // If there is only one setting changed other than scene mode setting 
   398     // and if the Dynamic Scene mode is "User Scene" we update the new setting
   399     // and if the Dynamic Scene mode is "User Scene" we update the new setting
   399     // value to the camera dynamic settings
   400     // value to the camera dynamic settings
   400     if ( !userSceneModeSettingChanged )
   401     if ( !userSceneModeSettingChanged && settingId != ECamSettingItemUserSceneDefault ) 
   401       {
   402       {
   402       TInt scene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
   403       TInt scene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
   403       // If user scene is the currently active photo scene then activate the
   404       // If user scene is the currently active photo scene then activate the
   404       // new user scene settings.
   405       // new user scene settings.
   405       if ( ECamSceneUser == scene )
   406       if ( ECamSceneUser == scene )
   731     // The model needs to register as an observer of changes in burst mode
   732     // The model needs to register as an observer of changes in burst mode
   732     // activation, as burst mode limits some settings values.
   733     // activation, as burst mode limits some settings values.
   733     // The model registers with the AppUi which is created after the model.
   734     // The model registers with the AppUi which is created after the model.
   734     // Registration is done here so we can guarantee that the AppUi has 
   735     // Registration is done here so we can guarantee that the AppUi has 
   735     // been created.
   736     // been created.
   736     CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>
   737     
   737                                             ( iEnv->AppUi() );
   738     CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); 
   738     appUi->AddBurstModeObserverL(  this );
   739     appUi->AddBurstModeObserverL( this );
   739 
   740 
   740     // Free all memory currently used by the static settings.
   741     // Free all memory currently used by the static settings.
   741     UnloadStaticSettings();
   742     UnloadStaticSettings();
   742     
   743     
   743     iStaticModel->ReadFromCenRepL(
   744     iStaticModel->ReadFromCenRepL(
   744                     static_cast<TInt>( ECamSettingItemUserSceneRangeMin ),
   745                     static_cast<TInt>( ECamSettingItemUserSceneRangeMin ),
   745                     static_cast<TInt>( ECamSettingItemUserSceneRangeMax ),
   746                     static_cast<TInt>( ECamSettingItemUserSceneRangeMax ),
   746                     iUserSceneSettings
   747                     iUserSceneSettings
   747                    );
   748                    );
   748     iStaticModel->LoadStaticSettingsL( aIsEmbedded );
   749     iStaticModel->LoadStaticSettingsL( aIsEmbedded );
       
   750     if ( appUi->ReturningFromPretendExit() || appUi->IsFirstBoot() )
       
   751       {
       
   752       SetUserSceneDefault(); 
       
   753       }
   749 
   754 
   750     PRINT(_L("Camera <= CCamSettingsModel::LoadStaticSettingsL" ))
   755     PRINT(_L("Camera <= CCamSettingsModel::LoadStaticSettingsL" ))
   751 
   756 
   752     }
   757     }
   753 
   758 
  1287         TInt contrast = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneContrast );
  1292         TInt contrast = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneContrast );
  1288         SetIntegerSettingValueL( ECamSettingItemDynamicPhotoBrightness, contrast );
  1293         SetIntegerSettingValueL( ECamSettingItemDynamicPhotoBrightness, contrast );
  1289                  
  1294                  
  1290 	    if ( iUiConfigManager->IsFaceTrackingSupported() ) // FT supported
  1295 	    if ( iUiConfigManager->IsFaceTrackingSupported() ) // FT supported
  1291          {      
  1296          {      
  1292          if ( ECamSceneScenery == aSceneId || ECamSceneSports == aSceneId )
  1297          if ( ECamSceneScenery == aSceneId ||
       
  1298               ECamSceneSports == aSceneId ||
       
  1299               ECamSceneMacro == aSceneId)
  1293             {
  1300             {
  1294             if ( ECamSceneScenery != iPreviousSceneMode && ECamSceneSports != iPreviousSceneMode ) // <- DATAMAKE
  1301             if ( ECamSceneScenery != iPreviousSceneMode && 
       
  1302                  ECamSceneSports != iPreviousSceneMode &&
       
  1303                  ECamSceneMacro != iPreviousSceneMode )
  1295                {	
  1304                {	
  1296                iPreviousFaceTrack = TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) );	
  1305                iPreviousFaceTrack = TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) );	
  1297                }
  1306                }
  1298             SetIntegerSettingValueL( ECamSettingItemFaceTracking, ECamSettOff );	
  1307             SetIntegerSettingValueL( ECamSettingItemFaceTracking, ECamSettOff );	
  1299             }
  1308             }
  1300          else if ( ( ECamSceneScenery == iPreviousSceneMode ||
  1309          else if ( ( ECamSceneScenery == iPreviousSceneMode ||
  1301                      ECamSceneSports == iPreviousSceneMode ) &&
  1310                      ECamSceneSports == iPreviousSceneMode ||
       
  1311                      ECamSceneMacro == iPreviousSceneMode ) &&
  1302                    ( ECamSettOff == TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) ) ) )
  1312                    ( ECamSettOff == TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) ) ) )
  1303              {
  1313              {
  1304              SetIntegerSettingValueL( ECamSettingItemFaceTracking, iPreviousFaceTrack );
  1314              SetIntegerSettingValueL( ECamSettingItemFaceTracking, iPreviousFaceTrack );
  1305              iPreviousFaceTrack = TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) );
  1315              iPreviousFaceTrack = TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) );
  1306              CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEnv->AppUi() );
  1316              CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEnv->AppUi() );
  2303       {
  2313       {
  2304       PRINT( _L("Camera <= CCamSettingsModel::StoreFaceTrackingValue(), FT _not_ supported" ) )	
  2314       PRINT( _L("Camera <= CCamSettingsModel::StoreFaceTrackingValue(), FT _not_ supported" ) )	
  2305       return;	
  2315       return;	
  2306       }
  2316       }
  2307    TInt activeScene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );	
  2317    TInt activeScene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );	
  2308    if ( ECamSceneScenery == activeScene || ECamSceneSports == activeScene ) 	
  2318    if ( ECamSceneScenery == activeScene ||
       
  2319         ECamSceneSports == activeScene ||
       
  2320         ECamSceneMacro == activeScene) 	
  2309       {
  2321       {
  2310       PRINT( _L("Camera <> CCamSettingsModel::StoreFaceTrackingValue(), Scenery or Sports mode" ) )		      	      	
  2322       PRINT( _L("Camera <> CCamSettingsModel::StoreFaceTrackingValue(), Scenery or Sports mode" ) )		      	      	
  2311       if ( iPreviousFaceTrack != TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) ) )
  2323       if ( iPreviousFaceTrack != TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) ) )
  2312          {	
  2324          {	
  2313          PRINT1( _L("Camera <> CCamSettingsModel::StoreFaceTrackingValue(), iPreviousFaceTrack [%d]" ), iPreviousFaceTrack )		      	      		
  2325          PRINT1( _L("Camera <> CCamSettingsModel::StoreFaceTrackingValue(), iPreviousFaceTrack [%d]" ), iPreviousFaceTrack )		      	      		
  2372 void CCamSettingsModel::StoreUserSceneSettingsL()
  2384 void CCamSettingsModel::StoreUserSceneSettingsL()
  2373     {
  2385     {
  2374     CopySettingsL(iUserSceneSettings, iUserSceneSettingsBackup);   
  2386     CopySettingsL(iUserSceneSettings, iUserSceneSettingsBackup);   
  2375     }
  2387     }
  2376 
  2388 
       
  2389 // ---------------------------------------------------------------------------
       
  2390 // CCamSettingsModel::SetUserSceneDefault
       
  2391 //
       
  2392 // Set userScene as default 
       
  2393 // ---------------------------------------------------------------------------
       
  2394 // 
       
  2395 void CCamSettingsModel::SetUserSceneDefault()
       
  2396     {
       
  2397     PRINT( _L("Camera => CCamSettingsModel::SetUserSceneDefault ") );
       
  2398     TInt settingsCount = iDynamicPhotoIntSettings.Count();
       
  2399     TInt userVal;
       
  2400     for ( TInt i = 0; i < settingsCount; ++i )
       
  2401        {
       
  2402        if ( iDynamicPhotoIntSettings[i]->iItemId == ECamSettingItemDynamicPhotoScene )
       
  2403          {
       
  2404          TInt sceneSetCount = iUserSceneSettings.Count();
       
  2405          for ( TInt j = 0; j < sceneSetCount; ++j )
       
  2406              {
       
  2407              if ( iUserSceneSettings[j]->iItemId == ECamSettingItemUserSceneDefault )
       
  2408                  {
       
  2409                  userVal = iUserSceneSettings[j]->iValueId;
       
  2410                  }
       
  2411              }
       
  2412          if ( userVal )
       
  2413              {
       
  2414              PRINT1( _L("Camera <> CCamSettingsModel::SetUserSceneDefault set userVal= %d"), userVal);
       
  2415              iDynamicPhotoIntSettings[i]->iValueId = ECamSceneUser;
       
  2416              ActivateUserSceneSettingsL();
       
  2417              }
       
  2418          
       
  2419          }
       
  2420        }
       
  2421     
       
  2422     PRINT( _L("Camera <= CCamSettingsModel::SetUserSceneDefault ") );
       
  2423     }
  2377 // ===========================================================================
  2424 // ===========================================================================
  2378 // end of File  
  2425 // end of File