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