camerauis/cameraapp/generic/src/CamCaptureSetupContainer.cpp
branchRCL_3
changeset 12 8c55c525d5d7
parent 7 dbec5787fa68
child 18 51dda465e618
equal deleted inserted replaced
11:792dfc98fb3b 12:8c55c525d5d7
    45 
    45 
    46 // ===========================================================================
    46 // ===========================================================================
    47 // CONSTANTS
    47 // CONSTANTS
    48 
    48 
    49 const TUint KCameraEventInterest = ECamCameraEventClassVfData;
    49 const TUint KCameraEventInterest = ECamCameraEventClassVfData;
       
    50 const TUint32 KToolbarExtensionBgColor = 0x00000000;
       
    51 const TInt KToolBarExtensionBgAlpha = 0x7F;
    50 
    52 
    51 // ===========================================================================
    53 // ===========================================================================
    52 // MEMBER FUNCTIONS 
    54 // MEMBER FUNCTIONS 
    53 
    55 
    54 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    58 //
    60 //
    59 CCamCaptureSetupContainer* CCamCaptureSetupContainer::NewL( 
    61 CCamCaptureSetupContainer* CCamCaptureSetupContainer::NewL( 
    60                               CCamAppController& aController, 
    62                               CCamAppController& aController, 
    61                               CAknView& aView,
    63                               CAknView& aView,
    62                               CCamCaptureSetupControlHandler& aControlHandler,
    64                               CCamCaptureSetupControlHandler& aControlHandler,
    63                               const TRect& aRect )
    65                               const TRect& aRect, TBool aFullScreenVF )
    64     {
    66     {
    65     CCamCaptureSetupContainer* self = new( ELeave ) CCamCaptureSetupContainer( 
    67     CCamCaptureSetupContainer* self = new( ELeave ) CCamCaptureSetupContainer( 
    66                                                              aController, 
    68                                                              aController, 
    67                                                              aView,
    69                                                              aView,
    68                                                              aControlHandler );
    70                                                              aControlHandler,
       
    71                                                              aFullScreenVF );
    69     CleanupStack::PushL( self );
    72     CleanupStack::PushL( self );
    70     self->ConstructL( aRect );
    73     self->ConstructL( aRect );
    71     CleanupStack::Pop( self );
    74     CleanupStack::Pop( self );
    72     // return newly created CCamCaptureSetupContainer instance
    75     // return newly created CCamCaptureSetupContainer instance
    73     return self;
    76     return self;
   114             // Remove toolbar from the settings view, before drawing VF, 
   117             // Remove toolbar from the settings view, before drawing VF, 
   115             // in order to avoid flickering
   118             // in order to avoid flickering
   116             fixedToolbar->SetToolbarVisibility( EFalse );
   119             fixedToolbar->SetToolbarVisibility( EFalse );
   117             }
   120             }
   118         }
   121         }
   119     
   122     iViewFinding = iControlHandler.ControlUsesViewFinder();
   120     iCaptureSetupControl = iControlHandler.CreateCaptureSetupControlL( this );
   123     
       
   124     if( iViewFinding )
       
   125         {
       
   126         iCaptureSetupControl = iControlHandler.CreateCaptureSetupControlL( this, !iFullScreenVF );
       
   127         }
       
   128     else
       
   129         {
       
   130         iCaptureSetupControl = iControlHandler.CreateCaptureSetupControlL( this, ETrue );        
       
   131         }
   121     iCaptureSetupControl->SetContainerWindowL( *this );
   132     iCaptureSetupControl->SetContainerWindowL( *this );
   122     iViewFinding = iControlHandler.ControlUsesViewFinder();
       
   123 
   133 
   124     // If the control requires a viewfinder then add it
   134     // If the control requires a viewfinder then add it
   125     if ( iViewFinding )
   135     if ( iViewFinding )
   126         {
   136         {
   127         // <CAMERAAPP_CAPI_V2_MIGRATION>
   137         // <CAMERAAPP_CAPI_V2_MIGRATION>
   249 // ---------------------------------------------------------------------------
   259 // ---------------------------------------------------------------------------
   250 //
   260 //
   251 CCamCaptureSetupContainer::CCamCaptureSetupContainer( 
   261 CCamCaptureSetupContainer::CCamCaptureSetupContainer( 
   252                              CCamAppController& aController, 
   262                              CCamAppController& aController, 
   253                              CAknView& aView,
   263                              CAknView& aView,
   254                              CCamCaptureSetupControlHandler& aControlHandler )
   264                              CCamCaptureSetupControlHandler& aControlHandler,
       
   265                              TBool aFullScreenVF )
   255 : CCamContainerBase( aController, aView ), 
   266 : CCamContainerBase( aController, aView ), 
   256 iControlHandler( aControlHandler ),
   267 iControlHandler( aControlHandler ),
   257 iActivateOnTouchRelease(EFalse)
   268 iActivateOnTouchRelease(EFalse),
       
   269 iFullScreenVF(aFullScreenVF)
   258     {
   270     {
   259     }
   271     }
   260 
   272 
   261 // ---------------------------------------------------------
   273 // ---------------------------------------------------------
   262 // CCamCaptureSetupContainer::CountComponentControls 
   274 // CCamCaptureSetupContainer::CountComponentControls 
   301         gc.SetPenStyle( CGraphicsContext::ENullPen );
   313         gc.SetPenStyle( CGraphicsContext::ENullPen );
   302       
   314       
   303         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   315         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   304         gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   316         gc.SetBrushColor( TRgb::Color16MA( 0 ) );
   305         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   317         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   318         if( iFullScreenVF )
       
   319             {
       
   320             gc.DrawRect( aRect );
       
   321             }
       
   322         else
       
   323             {
   306         gc.DrawRect( iViewFinderRectLayout.Rect() );
   324         gc.DrawRect( iViewFinderRectLayout.Rect() );
       
   325             }
   307         
   326         
   308         // Reset the brush after use (otherwise anything drawn
   327         // Reset the brush after use (otherwise anything drawn
   309         // after the viewfinder will also show viewfinder frames)
   328         // after the viewfinder will also show viewfinder frames)
   310         gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   329         gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   311         }
   330         }
   314     TRgb color;
   333     TRgb color;
   315     AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
   334     AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
   316                                             EAknsCIQsnTextColorsCG6 );
   335                                             EAknsCIQsnTextColorsCG6 );
   317     if ( CamUtility::IsNhdDevice() )
   336     if ( CamUtility::IsNhdDevice() )
   318         {
   337         {
   319         iTitleTextRectLayout.DrawText( gc, *iTitleText, ETrue, color );
   338         if( appUi->IsDirectViewfinderActive() &&
       
   339             iViewFinding && iFullScreenVF )
       
   340             {
       
   341             gc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) );            
       
   342             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   343             gc.DrawRect( TRect( iLayoutAreaRect.iTl.iX,
       
   344                                 iLayoutAreaRect.iTl.iY,
       
   345                                 iLayoutAreaRect.iBr.iX,
       
   346                                 iTitleTextRectLayout.TextRect().iBr.iY ) );
       
   347             
       
   348             gc.SetBrushStyle( CGraphicsContext::ENullBrush );
       
   349             
       
   350             color=TRgb( KRgbWhite );
       
   351             iTitleTextRectLayout.DrawText( gc, *iTitleText, ETrue, color );
       
   352             }
       
   353         else
       
   354             {
       
   355             iTitleTextRectLayout.DrawText( gc, *iTitleText, ETrue, color );
       
   356             }
   320         }
   357         }
   321     else
   358     else
   322         { 
   359         { 
   323         TRAP_IGNORE( appUi->SetTitleL( *iTitleText ));     
   360         TRAP_IGNORE( appUi->SetTitleL( *iTitleText ));     
   324         }
   361         }
   730 
   767 
   731         }
   768         }
   732     }
   769     }
   733 */
   770 */
   734 
   771 
   735 // ---------------------------------------------------------
       
   736 // CCamCaptureSetupContainer::ReserveAndStartVF
       
   737 // ---------------------------------------------------------
       
   738 //
       
   739 void CCamCaptureSetupContainer::ReserveAndStartVF()
       
   740     {
       
   741     PRINT ( _L("Camera => CCamCaptureSetupContainer::ReserveAndStartVF") );
       
   742     TCamCameraMode mode = iController.CurrentMode();
       
   743     if(iController.IsAppUiAvailable())
       
   744         {
       
   745         TVwsViewId currentViewId;
       
   746         CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() );
       
   747         appUi->GetActiveViewId( currentViewId );
       
   748         switch ( currentViewId.iViewUid.iUid )
       
   749             {
       
   750             case ECamViewIdPhotoUserSceneSetup:
       
   751             case ECamViewIdStillPreCapture:
       
   752                 {
       
   753                 mode = ECamControllerImage;
       
   754                 }
       
   755                 break;
       
   756             case ECamViewIdVideoPreCapture:
       
   757                 {
       
   758                 mode = ECamControllerVideo;
       
   759                 }
       
   760                 break;
       
   761             default:
       
   762                 {
       
   763                 //Assume imagemode if view cannot be determined.
       
   764                 if(mode==ECamControllerIdle)
       
   765                     {
       
   766                     mode = ECamControllerImage;                
       
   767                     }
       
   768                 }
       
   769                 break;
       
   770             }
       
   771         }
       
   772     //Don't reserve camera and start viewfinder if shutting down.
       
   773     if(mode!=ECamControllerShutdown)
       
   774         {
       
   775         iController.EnterViewfinderMode( mode );
       
   776         iController.StartIdleTimer();
       
   777         }
       
   778     PRINT ( _L("Camera <= CCamCaptureSetupContainer::ReserveAndStartVF") );        
       
   779     }
       
   780 // </CAMERAAPP_CAPI_V2_MIGRATION>
   772 // </CAMERAAPP_CAPI_V2_MIGRATION>
   781 
   773 
   782 // End of File  
   774 // End of File