camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamcorderSettingsContainer.cpp
branchRCL_3
changeset 24 bac7acad7cb3
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Image settings container
       
    15 *
       
    16 *  Copyright (c) 2008 Nokia Corporation.
       
    17 *  This material, including documentation and any related 
       
    18 *  computer programs, is protected by copyright controlled by 
       
    19 *  Nokia Corporation. All rights are reserved. Copying, 
       
    20 *  including reproducing, storing, adapting or translating, any 
       
    21 *  or all of this material requires the prior written consent of 
       
    22 *  Nokia Corporation. This material also contains confidential 
       
    23 *  information which may not be disclosed to others without the 
       
    24 *  prior written consent of Nokia Corporation.
       
    25 *
       
    26 *
       
    27 */
       
    28 
       
    29 
       
    30 // INCLUDE FILES
       
    31 #include <eiktxlbx.h>
       
    32 #include <aknlists.h>       // CAknSingleGraphicStyleListBox
       
    33 #include <barsread.h>       // TResourceReader
       
    34 #include <eikclbd.h>        // CColumnListBoxData
       
    35 
       
    36 #include <aknsettingitemlist.h> // CAknSettingItemList
       
    37 
       
    38 #include "CamAppUid.h"
       
    39 
       
    40 #include <csxhelp/lcam.hlp.hrh>
       
    41 #include "GSCamcorderSettingsContainer.h"
       
    42 #include "GSCamPhotoSettingsList.h"
       
    43 #include "GSCamVideoSettingsList.h"
       
    44 #include "CamAppUiBase.h"
       
    45 #include "MCamAppController.h"
       
    46 #include "CameraUiConfigManager.h"
       
    47 
       
    48 // ========================= MEMBER FUNCTIONS ================================
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CGSCamcorderSettingsContainer::ConstructL
       
    52 // Symbian OS 2nd phase constructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CGSCamcorderSettingsContainer::ConstructL( CCamStaticSettingsModel& aModel, 
       
    56                                                 TBool aLauchedFromGS,
       
    57                                                 TBool aSecondaryCameraSettings,
       
    58                                                 TBool aImageSettings )
       
    59     {
       
    60     iLauchedFromGS = aLauchedFromGS;
       
    61     iImageSettings = aImageSettings;
       
    62     if ( iImageSettings )
       
    63         {
       
    64         iSettingsList = new ( ELeave ) CGSCamPhotoSettingsList(  aModel );
       
    65         }
       
    66     else
       
    67         {
       
    68         iSettingsList = new ( ELeave ) CGSCamVideoSettingsList(  aModel );
       
    69         }
       
    70     CreateWindowL();
       
    71     
       
    72     iSettingsList->SetContainerWindowL( *this );
       
    73     if ( iImageSettings )
       
    74         {
       
    75         static_cast<CGSCamPhotoSettingsList*>( iSettingsList )->ConstructL( 
       
    76                                                aLauchedFromGS, aSecondaryCameraSettings );
       
    77         }
       
    78     else
       
    79         {
       
    80         static_cast<CGSCamVideoSettingsList*>( iSettingsList )->ConstructL( 
       
    81                                                aLauchedFromGS, aSecondaryCameraSettings );
       
    82         }
       
    83 
       
    84     if ( !iLauchedFromGS )
       
    85         {
       
    86         // read the product specific capture key from ui config manager
       
    87         RArray<TInt> primaryCaptureKeys;
       
    88         CleanupClosePushL( primaryCaptureKeys );
       
    89         if ( aModel.UiConfigManagerPtr() )
       
    90            {
       
    91            aModel.UiConfigManagerPtr()->SupportedPrimaryCameraCaptureKeyL( primaryCaptureKeys );        
       
    92            }
       
    93         iProductCaptureKey = primaryCaptureKeys[0];
       
    94         CleanupStack::PopAndDestroy( &primaryCaptureKeys );        
       
    95         }
       
    96 
       
    97     /*
       
    98     if ( !aLauchedFromGS )
       
    99         {
       
   100         // create navi pane bitmaps and add to navipane
       
   101         // only if launched from camera application.
       
   102 	    CreateNaviBitmapsL();
       
   103 	    }
       
   104     */	    
       
   105     }
       
   106 
       
   107 
       
   108 // Destructor
       
   109 CGSCamcorderSettingsContainer::~CGSCamcorderSettingsContainer()
       
   110     {
       
   111     if ( iSettingsList )
       
   112         {
       
   113         delete iSettingsList;
       
   114         iSettingsList = NULL;
       
   115         }
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CGSCamcorderSettingsContainer::EditCurrentL
       
   121 // Open setting page for currently selected setting item.
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 void CGSCamcorderSettingsContainer::EditCurrentL( TBool aCalledFromMenu /*=ETrue*/ )
       
   125     {
       
   126     TInt index = iSettingsList->SettingItemArray()->ItemIndexFromVisibleIndex(
       
   127                     iSettingsList->ListBox()->CurrentItemIndex() );
       
   128     iSettingsList->EditItemL( index, aCalledFromMenu );
       
   129     }
       
   130 
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CGSCamcorderSettingsContainer::GetHelpContext
       
   134 // Gives the help context to be displayed
       
   135 // ---------------------------------------------------------
       
   136 //
       
   137 void CGSCamcorderSettingsContainer::GetHelpContext( 
       
   138     TCoeHelpContext& aContext ) const
       
   139     {
       
   140 #ifdef __SERIES60_HELP    
       
   141     aContext.iMajor = TUid::Uid( KCameraappUID );
       
   142     if ( iImageSettings )
       
   143         {
       
   144         aContext.iContext = KLCAM_HLP_SETTINGS_PHOTO;
       
   145         }
       
   146     else
       
   147         {
       
   148         aContext.iContext = KLCAM_HLP_SETTINGS_VIDEO;
       
   149         }
       
   150 #endif    
       
   151     }
       
   152     
       
   153     
       
   154 // ---------------------------------------------------------------------------
       
   155 // CGSCamcorderSettingsContainer::CountComponentControls
       
   156 // From CCoeControl return the number of controls owned
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 TInt CGSCamcorderSettingsContainer::CountComponentControls() const
       
   160     {
       
   161     return 1;
       
   162     }
       
   163 
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // CGSCamcorderSettingsContainer::ComponentControl
       
   167 // From CCoeControl returns a control
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 CCoeControl* CGSCamcorderSettingsContainer::ComponentControl(
       
   171     TInt /* aIndex */ ) const
       
   172     {
       
   173     return iSettingsList;
       
   174     }
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // CGSCamcorderSettingsContainer::SettingsList
       
   178 // Returns a pointer to settingslist
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 CAknSettingItemList* CGSCamcorderSettingsContainer::SettingsList() const
       
   182     {
       
   183     return iSettingsList;
       
   184     }
       
   185     
       
   186 
       
   187 // ---------------------------------------------------------------------------
       
   188 // CGSCamcorderSettingsContainer::OfferKeyEventL
       
   189 // Key event handling
       
   190 // ---------------------------------------------------------------------------
       
   191 //
       
   192 TKeyResponse CGSCamcorderSettingsContainer::OfferKeyEventL(
       
   193     const TKeyEvent& aKeyEvent,
       
   194     TEventCode aType )
       
   195     {
       
   196     if ( aKeyEvent.iScanCode == iProductCaptureKey && !iLauchedFromGS )
       
   197         {
       
   198         CCamAppUiBase* camAppUi = (CCamAppUiBase*)iAvkonAppUiBase;
       
   199 
       
   200         TBool background = camAppUi->AppInBackground( EFalse );
       
   201         
       
   202         if ( background )
       
   203             {
       
   204             // Capture key pressed and camera in background.
       
   205             // Jump to foreground.
       
   206             CEikonEnv::Static()->RootWin().SetOrdinalPosition( 0, 0 );
       
   207             return EKeyWasConsumed;
       
   208             }        
       
   209         return EKeyWasNotConsumed;
       
   210         }
       
   211     if ( aKeyEvent.iCode == EKeyLeftArrow ||
       
   212             aKeyEvent.iCode == EKeyRightArrow )
       
   213         {
       
   214         // Listbox takes all events even if it doesn't use them
       
   215         return EKeyWasNotConsumed; 
       
   216         }
       
   217     return iSettingsList->OfferKeyEventL( aKeyEvent, aType );
       
   218     }
       
   219 
       
   220     
       
   221    
       
   222 // ---------------------------------------------------------------------------
       
   223 // CGSCamcorderSettingsContainer::SizeChanged
       
   224 // Set the size and position of component controls.
       
   225 // ---------------------------------------------------------------------------
       
   226 //
       
   227 void CGSCamcorderSettingsContainer::SizeChanged()
       
   228     {
       
   229     if ( iSettingsList )
       
   230         {
       
   231         iSettingsList->SetRect( Rect() );
       
   232         }
       
   233     }
       
   234     
       
   235 // ---------------------------------------------------------------------------
       
   236 // CGSCamcorderSettingsContainer::HandleResourceChange
       
   237 // Handles resource changes, e.g. layout changes of screen.
       
   238 // ---------------------------------------------------------------------------
       
   239 void CGSCamcorderSettingsContainer::HandleResourceChange( TInt aType )
       
   240     {
       
   241     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   242         {
       
   243         TRect mainPaneRect;
       
   244         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   245                                            mainPaneRect);
       
   246         SetRect( mainPaneRect );
       
   247         }
       
   248     CCoeControl::HandleResourceChange( aType );
       
   249     }
       
   250     
       
   251 
       
   252 // ---------------------------------------------------------
       
   253 // CGSCamcorderSettingsContainer::FocusChanged
       
   254 // Focus changed for listbox item.
       
   255 // ---------------------------------------------------------
       
   256 //
       
   257 void CGSCamcorderSettingsContainer::FocusChanged( TDrawNow aDrawNow )
       
   258     {
       
   259     CCoeControl::FocusChanged( aDrawNow );
       
   260     if ( iSettingsList )
       
   261         {
       
   262         iSettingsList->SetFocus( IsFocused(), aDrawNow );
       
   263         }
       
   264     //CreateNaviBitmapsL();
       
   265     }
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // CGSCamcorderSettingsContainer::CreateNaviBitmapsL()
       
   269 // We ask navi counter model to draw the counter and storage icon for us
       
   270 // when we are in image settings.
       
   271 // ---------------------------------------------------------------------------
       
   272 //
       
   273 void CGSCamcorderSettingsContainer::CreateNaviBitmapsL()
       
   274     {
       
   275 	if ( !iLauchedFromGS )
       
   276         {
       
   277         CCamAppUiBase* camAppUi = (CCamAppUiBase*)iAvkonAppUiBase;
       
   278         if ( camAppUi )
       
   279             {
       
   280             camAppUi->CreateNaviBitmapsL( ETrue );
       
   281             }
       
   282          }
       
   283     }
       
   284 
       
   285 // End of File