camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamcorderSettingsBaseView.cpp
branchRCL_3
changeset 54 bac7acad7cb3
parent 0 1ddebce53859
child 57 2c87b2808fd7
equal deleted inserted replaced
53:61bc0f252b2b 54: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 view
       
    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 
       
    32 #include <avkon.hrh>
       
    33 #include <aknViewAppUi.h>
       
    34 #include <eikapp.h>
       
    35 #include <apparc.h>
       
    36 #include <akntabgrp.h>
       
    37 #include <akntitle.h>  // CAknTitlePane
       
    38 #include <featmgr.h>
       
    39 #include <eikmenup.h>
       
    40 #include <bldvariant.hrh>
       
    41 #include <barsread.h>
       
    42 #include <gscamerapluginrsc.rsg>
       
    43 #include <camerasettingsplugin.mbg>
       
    44 #include <hlplch.h>             // For HlpLauncher
       
    45 
       
    46 #include <aknsettingitemlist.h> // CAknSettingItemList
       
    47 
       
    48 #include "CamAppUid.h"
       
    49 
       
    50 #include "GSCamcorderPlugin.h"
       
    51 #include "GSCamcorderPlugin.hrh"
       
    52 #include "Cam.hrh"
       
    53 #include "GSCamcorderSettingsBaseView.h"
       
    54 #include "GSCamcorderSettingsContainer.h"
       
    55 #include "GSCamcorderPlugin.h"
       
    56 #include "MCamAppController.h"
       
    57 #include "CamAppUiBase.h"
       
    58 
       
    59 
       
    60 // ========================= MEMBER FUNCTIONS ================================
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CGSCamcorderSettingsBaseView::CGSCamcorderSettingsBaseView
       
    64 // C++ constructor
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CGSCamcorderSettingsBaseView::CGSCamcorderSettingsBaseView( CCamStaticSettingsModel& aModel,
       
    68                                                             TBool aPhotoSettings )
       
    69 : iModel( aModel ),
       
    70   iSecondaryCameraSettings( EFalse )
       
    71     {
       
    72     iPhotoSettings = aPhotoSettings;
       
    73     }
       
    74 
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CGSCamcorderSettingsBaseView::~CGSCamcorderSettingsBaseView
       
    78 // Destructor
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 CGSCamcorderSettingsBaseView::~CGSCamcorderSettingsBaseView()
       
    82     {
       
    83     if ( iContainer )
       
    84         {
       
    85         AppUi()->RemoveFromStack( iContainer );
       
    86         delete iContainer;
       
    87         }
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CGSCamcorderSettingsBaseView::LaunchedFromGS
       
    92 // For variating the construction of the setting items
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 TBool CGSCamcorderSettingsBaseView::LaunchedFromGS() const
       
    96     {
       
    97     return AppUi()->Application()->AppDllUid().iUid != KCameraappUID;
       
    98     }
       
    99 
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CGSCamcorderSettingsBaseView::HandleCommandL
       
   103 // From MEikMenuObserver delegate commands from the menu
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 void CGSCamcorderSettingsBaseView::HandleCommandL( TInt aCommand )
       
   107     {
       
   108     switch ( aCommand )
       
   109         {
       
   110         case ECamMSKCmdAppChange:
       
   111         	 static_cast<CGSCamcorderSettingsContainer*> ( iContainer )->EditCurrentL( EFalse );
       
   112         	 break;
       
   113         case EAknCmdHelp:
       
   114 #ifdef __SERIES60_HELP
       
   115             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   116                 {
       
   117                 HlpLauncher::LaunchHelpApplicationL(
       
   118                     iEikonEnv->WsSession(), AppUi()->AppHelpContextL() );
       
   119                 }
       
   120 #endif
       
   121             break;
       
   122         case EAknCmdOpen: // MSK change 
       
   123             { 
       
   124             TKeyEvent key;
       
   125             key.iRepeats = 0;
       
   126             key.iCode = EKeyEnter;
       
   127             key.iModifiers = 0;
       
   128             iEikonEnv->SimulateKeyEventL( key, EEventKey );
       
   129             break;
       
   130             }
       
   131         default:
       
   132             {
       
   133             AppUi()->HandleCommandL( aCommand );
       
   134             break;
       
   135             }
       
   136         }
       
   137     }
       
   138 
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // CGSCamcorderSettingsBaseView::DoActivateL
       
   142 // Activate this view
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 void CGSCamcorderSettingsBaseView::DoActivateL( const TVwsViewId& /* aPrevViewId */,
       
   146                                              TUid /*aCustomMessageId*/,
       
   147                                              const TDesC8& /*aCustomMessage*/ )
       
   148     {
       
   149     SetNaviPaneL();
       
   150     StatusPane()->MakeVisible( ETrue );	 
       
   151     if( iContainer )
       
   152         {
       
   153         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   154         delete iContainer;
       
   155         iContainer = NULL;
       
   156         }
       
   157     CGSCamcorderPlugin* parent = 
       
   158         static_cast<CGSCamcorderPlugin*> ( 
       
   159             AppUi()->View( KGSCamcorderGSPluginUid ) );
       
   160     iSecondaryCameraSettings = parent->IsSecondaryCameraSettings();
       
   161     CreateContainerL();
       
   162     AppUi()->AddToViewStackL( *this, iContainer );
       
   163 
       
   164     iContainer->SetRect( ClientRect() );   
       
   165     iContainer->ActivateL();
       
   166     }
       
   167 
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // CGSCamcorderSettingsBaseView::DoDeactivate
       
   171 // Deactivate this view
       
   172 // ---------------------------------------------------------------------------
       
   173 //
       
   174 void CGSCamcorderSettingsBaseView::DoDeactivate()
       
   175     {
       
   176     if ( iContainer )
       
   177         {        
       
   178         AppUi()->RemoveFromStack( iContainer );
       
   179         delete iContainer;
       
   180         iContainer = NULL;
       
   181         }
       
   182     }
       
   183 
       
   184 
       
   185 // ---------------------------------------------------------------------------
       
   186 // CGSCamcorderSettingsBaseView::Container
       
   187 // Returns network container item
       
   188 // ---------------------------------------------------------------------------
       
   189 //
       
   190 CGSCamcorderSettingsContainer* CGSCamcorderSettingsBaseView::Container()
       
   191     {
       
   192     return static_cast <CGSCamcorderSettingsContainer*> ( iContainer );
       
   193     }
       
   194 
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // CGSCamcorderSettingsBaseView::DynInitMenuPaneL
       
   198 // Dynamically customize menu items
       
   199 // ---------------------------------------------------------------------------
       
   200 //
       
   201 void CGSCamcorderSettingsBaseView::DynInitMenuPaneL( TInt aResourceId,
       
   202                                                CEikMenuPane* aMenuPane )
       
   203     {
       
   204     if ( aResourceId == R_GS_CAM_SETTINGS_MENU )
       
   205         {
       
   206 #ifdef __SERIES60_HELP
       
   207         if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   208             {
       
   209             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   210             }
       
   211 #endif
       
   212         }
       
   213     }
       
   214     
       
   215 // ---------------------------------------------------------------------------
       
   216 // CGSCamcorderSettingsBaseView::NewContainerL()
       
   217 // Creates new iContainer.
       
   218 // ---------------------------------------------------------------------------
       
   219 void CGSCamcorderSettingsBaseView::NewContainerL()
       
   220     {
       
   221     iContainer = new (ELeave) CGSCamcorderSettingsContainer;
       
   222     }
       
   223 
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CGSCamcorderSettingsBaseView::HandleClientRectChange
       
   227 // Handle screen size change.
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CGSCamcorderSettingsBaseView::HandleClientRectChange()
       
   231     {
       
   232     if ( iContainer )
       
   233         {
       
   234         iContainer->SetRect( ClientRect() );
       
   235         } 
       
   236     }
       
   237 
       
   238 
       
   239 // ---------------------------------------------------------------------------
       
   240 // CGSCamcorderSettingsBaseView::HandleListBoxEventL
       
   241 // 
       
   242 // ---------------------------------------------------------------------------
       
   243 //
       
   244 void CGSCamcorderSettingsBaseView::HandleListBoxEventL( CEikListBox* /*aListBox*/, 
       
   245                                             TListBoxEvent aEventType )
       
   246    {
       
   247     switch ( aEventType )
       
   248         {
       
   249         case EEventEnterKeyPressed:
       
   250         case EEventItemDoubleClicked:
       
   251         case EEventItemSingleClicked:
       
   252             if( iContainer )
       
   253                 {
       
   254                 iContainer->EditCurrentL();
       
   255                 }
       
   256             break;
       
   257         default:
       
   258            break;
       
   259         }
       
   260     }
       
   261 
       
   262 
       
   263 // ---------------------------------------------------------------------------
       
   264 // CGSCamcorderSettingsBaseView::CreateContainerL()
       
   265 // Creates new iContainer.
       
   266 // ---------------------------------------------------------------------------
       
   267 //
       
   268 void CGSCamcorderSettingsBaseView::CreateContainerL()
       
   269     {        
       
   270     NewContainerL();
       
   271     iContainer->SetMopParent( this );
       
   272 
       
   273     TRAPD( error, iContainer->ConstructL( iModel, 
       
   274                                           LaunchedFromGS(),
       
   275                                           iSecondaryCameraSettings,
       
   276                                           iPhotoSettings ) );
       
   277 
       
   278     if ( error )
       
   279         {
       
   280         delete iContainer;
       
   281         iContainer = NULL;
       
   282         User::Leave( error );
       
   283         }
       
   284     }
       
   285 
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CGSCamcorderSettingsBaseView::SetNaviPaneL
       
   289 // Sets Navipane texts.
       
   290 // ---------------------------------------------------------------------------
       
   291 //
       
   292 void CGSCamcorderSettingsBaseView::SetNaviPaneL()
       
   293     {
       
   294     CEikStatusPane* sp = AppUi()->StatusPane();
       
   295     CAknTitlePane* title = static_cast<CAknTitlePane*> 
       
   296         ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   297     
       
   298     TInt resId = R_CAM_PHOTO_SETTINGS_TITLE_NAME;
       
   299     if ( !iPhotoSettings )
       
   300         {
       
   301         resId = R_CAM_VIDEO_SETTINGS_TITLE_NAME;
       
   302         }
       
   303     // Set view title from resource:
       
   304     TResourceReader rReader;
       
   305     iCoeEnv->CreateResourceReaderLC( rReader, resId );
       
   306     title->SetFromResourceL( rReader );
       
   307     CleanupStack::PopAndDestroy(); //rReader 
       
   308     }
       
   309     
       
   310 // End of File