camerauis/cameraapp/generic/src/CamStillUserSceneSetupView.cpp
changeset 0 1ddebce53859
child 7 dbec5787fa68
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Ensures that the container for the user scene setup is constructed*
       
    15 */
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "CamStillUserSceneSetupView.h"
       
    20 #include "CamUserSceneSetupContainer.h"
       
    21 #include "CamShootingModeContainer.h"
       
    22 #include "CamAppUiBase.h"
       
    23 #include "Cam.hrh"
       
    24 #include "CamAppController.h"
       
    25 #include "CamUtility.h"
       
    26 
       
    27 #include "CamAppUi.h"
       
    28 #include "CamInfoListBoxContainer.h"
       
    29 #include "CamTimeLapseUtility.h"
       
    30 #include "CameraUiConfigManager.h"
       
    31 
       
    32 #include <cameraapp.rsg>
       
    33 #include <vgacamsettings.rsg>
       
    34 
       
    35 // ================= MEMBER FUNCTIONS =======================
       
    36 // ---------------------------------------------------------------------------
       
    37 // CCamStillUserSceneSetupView::NewLC
       
    38 // Symbian OS two-phased constructor
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 CCamStillUserSceneSetupView* CCamStillUserSceneSetupView::NewLC( CCamAppController& aController )
       
    42     {
       
    43     CCamStillUserSceneSetupView* self = 
       
    44         new ( ELeave ) CCamStillUserSceneSetupView( aController );
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     return self;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CCamStillUserSceneSetupView::~CCamStillUserSceneSetupView
       
    52 // Destructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CCamStillUserSceneSetupView::~CCamStillUserSceneSetupView()
       
    56     {
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CCamStillUserSceneSetupView::Id
       
    61 // Returns the id of this view.
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 TUid CCamStillUserSceneSetupView::Id() const
       
    65     {
       
    66     return TUid::Uid( ECamViewIdPhotoUserSceneSetup );
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // CCamStillUserSceneSetupView::CreateContainerL
       
    71 // Creates the user scene setup list.
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CCamStillUserSceneSetupView::CreateContainerL()
       
    75     {
       
    76     iContainer = 
       
    77         CCamUserSceneSetupContainer::NewL( AppUi()->ClientRect(),
       
    78             R_CAM_PHOTO_USER_SCENE_SETUP_TITLE_NAME , iController, 
       
    79             *this );
       
    80     }
       
    81 
       
    82 
       
    83 
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // CCamStillUserSceneSetupView::StartViewFinder
       
    87 // Enter viewfinder mode
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CCamStillUserSceneSetupView::StartViewFinder()
       
    91     {
       
    92     iController.EnterViewfinderMode( ECamControllerImage );
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CCamStillUserSceneSetupView::StopViewFinder
       
    97 // Exit viewfinder mode
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CCamStillUserSceneSetupView::StopViewFinder()
       
   101     {
       
   102     iController.ExitViewfinderMode( ECamControllerImage );
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CCamStillUserSceneSetupView::ExitCaptureSetupModeL
       
   108 // Exit capture setup mode
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void CCamStillUserSceneSetupView::ExitCaptureSetupModeL()
       
   112     {
       
   113     static_cast<CCamUserSceneSetupContainer*> ( iContainer )->
       
   114         UpdateCurrentListItem();
       
   115     CCamUserSceneSetupViewBase::ExitCaptureSetupModeL();
       
   116     
       
   117     StatusPane()->MakeVisible(ETrue);
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CCamStillUserSceneSetupView::CCamStillUserSceneSetupView
       
   122 // C++ Constructor
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 CCamStillUserSceneSetupView::CCamStillUserSceneSetupView
       
   126 ( CCamAppController& aController )
       
   127 : CCamUserSceneSetupViewBase( aController )
       
   128     {
       
   129     }
       
   130 
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // CCamStillUserSceneSetupView::ConstructL
       
   134 // 2nd phase Constructor
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CCamStillUserSceneSetupView::ConstructL()
       
   138     {
       
   139     BaseConstructL( ROID(R_CAM_USER_SCENE_SETUP_VIEW_ID));
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CCamStillUserSceneSetupView::ExitUserSceneSetupModeL
       
   144 // Exits the user scene setup mode.
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 void CCamStillUserSceneSetupView::ExitUserSceneSetupModeL()
       
   148     {
       
   149     CCamUserSceneSetupViewBase::ExitUserSceneSetupModeL();
       
   150     AppUi()->HandleCommandL( ECamCmdSceneSettingList );
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // CCamStillUserSceneSetupView::SwitchToUserSceneSetupModeL
       
   155 // Switches to the user scene setup mode.
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 void CCamStillUserSceneSetupView::SwitchToUserSceneSetupModeL()
       
   159     {
       
   160     CCamUserSceneSetupViewBase::SwitchToUserSceneSetupModeL();
       
   161     }
       
   162 
       
   163 // ---------------------------------------------------------------------------
       
   164 // CCamStillUserSceneSetupView::SwitchToSceneSettingModeL
       
   165 // Switches the current mode to scene setting and activates a 
       
   166 // specific control.
       
   167 // ---------------------------------------------------------------------------
       
   168 //
       
   169 void CCamStillUserSceneSetupView::SwitchToSceneSettingModeL()
       
   170     {
       
   171     CCamUserSceneSetupViewBase::ExitUserSceneSetupModeL();
       
   172 
       
   173     if ( !iSceneSettingContainer )
       
   174     	{
       
   175 	    // Create the scene setting container for still mode.
       
   176 	    iSceneSettingContainer = CCamShootingModeContainer::NewL( AppUi()->ApplicationRect(),
       
   177 	                                                             *this,
       
   178 	                                                             ECamControllerImage,
       
   179 	                                                             iController,
       
   180 	                                                             ETrue );
       
   181     	}
       
   182     
       
   183     iSceneSettingContainer->DrawableWindow()->SetOrdinalPosition(-1);
       
   184 
       
   185     iSettingModeTitleResourceId = R_CAM_STILL_SCENE_SETTING_TITLE;
       
   186 
       
   187     iPreviousMenuResourceId = ROID(R_CAM_USER_SCENE_SETUP_MENUBAR_ID);
       
   188 
       
   189     // Remove the view's main container, and add the capture setup 
       
   190     // control associated with the input command to the container stack.
       
   191     CCamCaptureSetupViewBase::SwitchToSceneSettingModeL();
       
   192     }
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // CCamStillUserSceneSetupView::SwitchToInfoListBoxL
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 void CCamStillUserSceneSetupView::SwitchToInfoListBoxL( TCamInfoListBoxMode aMode )
       
   199     {   
       
   200     CCamAppUi* appUi = static_cast<CCamAppUi*>( iCoeEnv->AppUi() );  	
       
   201 
       
   202     TBool modeSelected = EFalse;
       
   203     TInt listBoxResource;
       
   204     TInt summaryResource;
       
   205     TInt initialValue;
       
   206     TInt titleResource;
       
   207 
       
   208 
       
   209     switch( aMode )
       
   210         {
       
   211         // Only ISO mode is supported for InfoListBox in user scene setup
       
   212         case EInfoListBoxModeISO:
       
   213             {
       
   214             // Light sensitivity selector initialization values	
       
   215             initialValue    = iController.IntegerSettingValue( ECamSettingItemUserSceneLightSensitivity );	
       
   216             // initialValue = 0;
       
   217 			if ( iController.UiConfigManagerPtr()->IsExtendedLightSensitivitySupported() )
       
   218 			    {
       
   219 				listBoxResource = R_CAM_CAPTURE_SETUP_LIST_EXTENDED_LIGHT_SENSITIVITY;
       
   220 				summaryResource = R_CAM_CAPTURE_SETUP_LIST_EXTENDED_LIGHT_SENSITIVITY_SUMMARY;
       
   221 			    }
       
   222 			else
       
   223 			    {
       
   224 				listBoxResource = R_CAM_CAPTURE_SETUP_LIST_LIGHT_SENSITIVITY;
       
   225 				summaryResource = R_CAM_CAPTURE_SETUP_LIST_LIGHT_SENSITIVITY_SUMMARY;
       
   226 			    }
       
   227             titleResource   = R_CAM_LIGHT_SENSITIVITY_TITLE;   					    				
       
   228             modeSelected    = ETrue;
       
   229             }
       
   230             break;
       
   231         default: 
       
   232             break;
       
   233         }    					
       
   234 
       
   235     if( modeSelected)
       
   236         {
       
   237 
       
   238 
       
   239         StatusPane()->MakeVisible( EFalse );
       
   240 
       
   241         CCamUserSceneSetupViewBase::ExitUserSceneSetupModeL();  
       
   242 
       
   243         iInfoListBoxContainer = CCamInfoListBoxContainer::NewL( AppUi()->ClientRect(),
       
   244                 *this,                                                            
       
   245                 iController,
       
   246                 listBoxResource,
       
   247                 summaryResource,
       
   248                 initialValue,
       
   249                 titleResource );		
       
   250         iInfoListBoxMode = aMode;          
       
   251         iSettingModeTitleResourceId = titleResource;                                                   										    			
       
   252 
       
   253         iPreviousMenuResourceId = ROID(R_CAM_USER_SCENE_SETUP_MENUBAR_ID);
       
   254 
       
   255         // Remove the view's main container, and add the capture setup 
       
   256         // control associated with the input command to the container stack.
       
   257         CCamCaptureSetupViewBase::SwitchToInfoListBoxL( aMode );        
       
   258         }
       
   259     }
       
   260     
       
   261 // ---------------------------------------------------------------------------
       
   262 // CCamStillUserSceneSetupView::HandleInfoListBoxSelectionL()
       
   263 // Handle selection events from InfoListBox
       
   264 // ---------------------------------------------------------------------------
       
   265 //
       
   266 void CCamStillUserSceneSetupView::HandleInfoListBoxSelectionL()
       
   267 	{            		   
       
   268 	CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() );            		   
       
   269 		
       
   270 	if( iInfoListBoxContainer->SettingValueChanged() )
       
   271 		{
       
   272 		// Store the selected setting
       
   273 		switch( iInfoListBoxMode )
       
   274 			{
       
   275 			// Only ISO mode is supported for InfoListBox in user scene setup
       
   276 			case EInfoListBoxModeISO:
       
   277 				{
       
   278 				TInt settingValue = iInfoListBoxContainer->CurrentSettingItemValue();
       
   279 				iController.SetIntegerSettingValueL( ECamSettingItemUserSceneLightSensitivity, settingValue );	
       
   280 				}            	  
       
   281 				break;
       
   282 						
       
   283 		default:
       
   284 				break;												
       
   285 			}				
       
   286 		}
       
   287     
       
   288   ExitInfoListBoxL();        	        
       
   289 	}    
       
   290 
       
   291 // ---------------------------------------------------------------------------
       
   292 // CCamStillUserSceneSetupView::ExitSceneSettingModeL
       
   293 // Exit scene setting mode
       
   294 // ---------------------------------------------------------------------------
       
   295 //
       
   296 void CCamStillUserSceneSetupView::ExitSceneSettingModeL()
       
   297   {
       
   298   static_cast<CCamUserSceneSetupContainer*>( iContainer )->
       
   299       UpdateCurrentListItem();
       
   300   CCamUserSceneSetupViewBase::ExitSceneSettingModeL();
       
   301   }
       
   302 
       
   303 
       
   304 // ---------------------------------------------------------------------------
       
   305 // CCamStillUserSceneSetupView::DynInitMenuPaneL
       
   306 // Dynamically initialise the options menu
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 void CCamStillUserSceneSetupView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   310     {
       
   311     PRINT( _L("Camera => CCamStillUserSceneSetupView::DynInitMenuPaneL"))
       
   312     if ( aResourceId != R_CAM_USER_SCENE_SETUP_MENU )
       
   313         {
       
   314         CCamCaptureSetupViewBase::DynInitMenuPaneL( aResourceId, aMenuPane );        
       
   315         }
       
   316     PRINT( _L("Camera <= CCamStillUserSceneSetupView::DynInitMenuPaneL"))
       
   317     }
       
   318 
       
   319 
       
   320 // End of File