camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamVideoSettingsView.cpp
branchRCL_3
changeset 24 bac7acad7cb3
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     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:  Video settings view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <avkon.hrh>
       
    22 #include <aknViewAppUi.h>
       
    23 #include <akntabgrp.h>
       
    24 #include <akntitle.h>  // CAknTitlePane
       
    25 #include <eikmenup.h>
       
    26 #include <bldvariant.hrh>
       
    27 #include <barsread.h>
       
    28 #include <gscamerapluginrsc.rsg>
       
    29 #include <camerasettingsplugin.mbg>
       
    30 #include <gstabhelper.h>
       
    31 
       
    32 #include "CamAppUid.h"
       
    33 #include "GSCamcorderPlugin.h"
       
    34 #include "GSCamcorderPlugin.hrh"
       
    35 #include "Cam.hrh"
       
    36 #include "GSCamVideoSettingsView.h"
       
    37 #include "GSCamcorderSettingsBaseView.h"
       
    38 #include "GSCamcorderPlugin.h"
       
    39 #include "CamLocalViewIds.h"
       
    40 
       
    41 
       
    42 
       
    43 // ========================= MEMBER FUNCTIONS ================================
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CGSCamVideoSettingsView::CGSCamVideoSettingsView
       
    47 // C++ constructor
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CGSCamVideoSettingsView::CGSCamVideoSettingsView( CCamStaticSettingsModel& aModel )
       
    51 : CGSCamcorderSettingsBaseView( aModel, EFalse )
       
    52     {
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CGSCamVideoSettingsView::NewLC
       
    58 // Symbian OS two-phased constructor.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 CGSCamVideoSettingsView* CGSCamVideoSettingsView::NewLC(
       
    62     CCamStaticSettingsModel& aModel,
       
    63     CArrayPtrFlat<MGSTabbedView>* aTabViewArray )
       
    64     {
       
    65     CGSCamVideoSettingsView* self = 
       
    66         new ( ELeave ) CGSCamVideoSettingsView( aModel );
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL( aTabViewArray );    
       
    69     return self;
       
    70     }
       
    71 
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // CGSCamVideoSettingsView::ConstructL
       
    75 // Symbian OS 2nd phase constructor
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 void CGSCamVideoSettingsView::ConstructL( CArrayPtrFlat<MGSTabbedView>* aTabViewArray )
       
    79     {
       
    80     iTabHelper = CGSTabHelper::NewL();
       
    81     aTabViewArray->AppendL(this);
       
    82     BaseConstructL( R_CAM_SETTING_LIST_VIEW );
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CGSCamVideoSettingsView::~CGSCamVideoSettingsView()
       
    88 // Destructor
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 CGSCamVideoSettingsView::~CGSCamVideoSettingsView()
       
    92     {
       
    93     delete iTabHelper;
       
    94     iTabHelper = NULL;
       
    95     }
       
    96 
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CGSCamVideoSettingsView::Id
       
   100 // From CAknView, returns Uid of View
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 TUid CGSCamVideoSettingsView::Id() const
       
   104     {
       
   105     return KGSCamVideoSettingsViewId;
       
   106     }
       
   107 
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CGSCamVideoSettingsView::HandleCommandL
       
   111 // From MEikMenuObserver delegate commands from the menu
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void CGSCamVideoSettingsView::HandleCommandL( TInt aCommand )
       
   115     {
       
   116     const TVwsViewId KVideoPreCaptureView( TUid::Uid( KCameraappUID ),
       
   117                                            KVideoPreCaptureId );
       
   118     switch ( aCommand )
       
   119         {
       
   120         case EAknSoftkeyBack:
       
   121             {
       
   122             if ( LaunchedFromGS() )
       
   123             	{
       
   124             	AppUi()->ActivateLocalViewL( KGSCamcorderGSPluginUid );
       
   125             	}
       
   126             else
       
   127             	{
       
   128             	AppUi()->ActivateViewL( KVideoPreCaptureView,
       
   129             	                        TUid::Uid( aCommand ),
       
   130             	                        KNullDesC8 );
       
   131             	}
       
   132             break;
       
   133             }
       
   134             
       
   135         case ECamCmdInternalExit:
       
   136             {
       
   137             if ( LaunchedFromGS() )
       
   138                 {
       
   139                 AppUi()->HandleCommandL( EAknCmdExit );
       
   140                 }
       
   141             else
       
   142                 {
       
   143                 //To ensure that camera resources are released when exiting
       
   144                 //settings, we need to call internal exit here to close the
       
   145                 //camera completely
       
   146                 AppUi()->HandleCommandL( aCommand );
       
   147                 }
       
   148             break;
       
   149             }
       
   150         default:
       
   151             {
       
   152             CGSCamcorderSettingsBaseView::HandleCommandL( aCommand );
       
   153             break;
       
   154             }
       
   155         }
       
   156     }
       
   157 
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // CGSCamVideoSettingsView::DoActivateL
       
   161 // Activate this view
       
   162 // ---------------------------------------------------------------------------
       
   163 //
       
   164 void CGSCamVideoSettingsView::DoActivateL( const TVwsViewId& aPrevViewId,
       
   165                                            TUid aCustomMessageId,
       
   166                                            const TDesC8& aCustomMessage )
       
   167     { 
       
   168     
       
   169     CGSCamcorderPlugin* parent = 
       
   170           static_cast<CGSCamcorderPlugin*> ( 
       
   171               AppUi()->View( KGSCamcorderGSPluginUid ) );
       
   172           
       
   173      if ( aCustomMessageId == TUid::Uid( KGSSecondaryCameraVideoSettingsView ) )
       
   174           {
       
   175           if( parent)
       
   176               {
       
   177               parent->SetSecondaryCameraSettings( ETrue );
       
   178               }
       
   179           }
       
   180     else
       
   181           {
       
   182           if( parent )
       
   183               {
       
   184               parent->SetSecondaryCameraSettings( EFalse );
       
   185               }
       
   186           }
       
   187      
       
   188     CGSCamcorderSettingsBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   189     //StatusPane()->MakeVisible( ETrue );
       
   190  
       
   191     if( parent )
       
   192         {
       
   193         if ( LaunchedFromGS() )
       
   194             {
       
   195             iTabHelper->CreateTabGroupL( Id(), 
       
   196                 static_cast<CArrayPtrFlat<MGSTabbedView>*>
       
   197                     ( parent->TabbedViews() ) );	
       
   198             }
       
   199         } 
       
   200     }
       
   201 
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // CGSCamVideoSettingsView::DoDeactivate
       
   205 // Deactivate this view
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 void CGSCamVideoSettingsView::DoDeactivate()
       
   209     {
       
   210     CGSCamcorderSettingsBaseView::DoDeactivate();
       
   211     if ( iTabHelper )
       
   212         {
       
   213         iTabHelper->RemoveTabGroup();
       
   214         }
       
   215     }
       
   216 
       
   217 
       
   218 // ---------------------------------------------------------------------------
       
   219 // CGSCamVideoSettingsView::CreateTabIconL()
       
   220 // Creates icon for tab.
       
   221 // ---------------------------------------------------------------------------
       
   222 //    
       
   223 CGulIcon* CGSCamVideoSettingsView::CreateTabIconL()
       
   224     {
       
   225     TParse* fp = new(ELeave) TParse();
       
   226     CleanupStack::PushL( fp );
       
   227     TInt err = fp->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL); 
       
   228 
       
   229     if (err != KErrNone)
       
   230         {
       
   231         User::Leave(err);
       
   232         }
       
   233 
       
   234     TBuf<KMaxFileName> fileName = fp->FullName();
       
   235     CleanupStack::PopAndDestroy( fp );  //fp
       
   236 
       
   237     CGulIcon* icon;
       
   238        
       
   239     icon = AknsUtils::CreateGulIconL(
       
   240         AknsUtils::SkinInstance(),  
       
   241         KAknsIIDDefault, 
       
   242         fileName,
       
   243         EMbmCamerasettingspluginQgn_prop_set_mp_video_tab2,
       
   244         EMbmCamerasettingspluginQgn_prop_set_mp_video_tab2 );
       
   245     
       
   246     return icon;
       
   247     }       
       
   248         
       
   249 // End of File