camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamcorderSettingsContainer.cpp
changeset 0 1ddebce53859
child 27 53c8aa5d97a3
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     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 
       
   212     TKeyEvent newKeyEvent = aKeyEvent;
       
   213     if ( !iLauchedFromGS )
       
   214         {
       
   215         if ( aKeyEvent.iCode == EKeyLeftArrow )
       
   216     	    {
       
   217     	    newKeyEvent.iCode = EKeyDownArrow;
       
   218     	    }
       
   219         else if ( aKeyEvent.iCode == EKeyRightArrow )
       
   220             {
       
   221             // Listbox takes all events even if it doesn't use them
       
   222             //return EKeyWasNotConsumed; 
       
   223             newKeyEvent.iCode = EKeyUpArrow;
       
   224             }
       
   225         }
       
   226     else
       
   227         {
       
   228         if ( aKeyEvent.iCode == EKeyLeftArrow ||
       
   229              aKeyEvent.iCode == EKeyRightArrow )
       
   230             {
       
   231             // Listbox takes all events even if it doesn't use them
       
   232             return EKeyWasNotConsumed; 
       
   233             }
       
   234         }
       
   235     return iSettingsList->OfferKeyEventL( newKeyEvent, aType );
       
   236     }
       
   237 
       
   238     
       
   239    
       
   240 // ---------------------------------------------------------------------------
       
   241 // CGSCamcorderSettingsContainer::SizeChanged
       
   242 // Set the size and position of component controls.
       
   243 // ---------------------------------------------------------------------------
       
   244 //
       
   245 void CGSCamcorderSettingsContainer::SizeChanged()
       
   246     {
       
   247     if ( iSettingsList )
       
   248         {
       
   249         iSettingsList->SetRect( Rect() );
       
   250         }
       
   251     }
       
   252     
       
   253 // ---------------------------------------------------------------------------
       
   254 // CGSCamcorderSettingsContainer::HandleResourceChange
       
   255 // Handles resource changes, e.g. layout changes of screen.
       
   256 // ---------------------------------------------------------------------------
       
   257 void CGSCamcorderSettingsContainer::HandleResourceChange( TInt aType )
       
   258     {
       
   259     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   260         {
       
   261         TRect mainPaneRect;
       
   262         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   263                                            mainPaneRect);
       
   264         SetRect( mainPaneRect );
       
   265         }
       
   266     CCoeControl::HandleResourceChange( aType );
       
   267     }
       
   268     
       
   269 
       
   270 // ---------------------------------------------------------
       
   271 // CGSCamcorderSettingsContainer::FocusChanged
       
   272 // Focus changed for listbox item.
       
   273 // ---------------------------------------------------------
       
   274 //
       
   275 void CGSCamcorderSettingsContainer::FocusChanged( TDrawNow aDrawNow )
       
   276     {
       
   277     CCoeControl::FocusChanged( aDrawNow );
       
   278     if ( iSettingsList )
       
   279         {
       
   280         iSettingsList->SetFocus( IsFocused(), aDrawNow );
       
   281         }
       
   282     //CreateNaviBitmapsL();
       
   283     }
       
   284 
       
   285 // ---------------------------------------------------------------------------
       
   286 // CGSCamcorderSettingsContainer::CreateNaviBitmapsL()
       
   287 // We ask navi counter model to draw the counter and storage icon for us
       
   288 // when we are in image settings.
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 void CGSCamcorderSettingsContainer::CreateNaviBitmapsL()
       
   292     {
       
   293 	if ( !iLauchedFromGS )
       
   294         {
       
   295         CCamAppUiBase* camAppUi = (CCamAppUiBase*)iAvkonAppUiBase;
       
   296         if ( camAppUi )
       
   297             {
       
   298             camAppUi->CreateNaviBitmapsL( ETrue );
       
   299             }
       
   300          }
       
   301     }
       
   302 
       
   303 // End of File