camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 7 dbec5787fa68
parent 3 8b2d6d0384b0
child 11 792dfc98fb3b
equal deleted inserted replaced
3:8b2d6d0384b0 7:dbec5787fa68
    50 #include <hal.h>
    50 #include <hal.h>
    51 #include <hal_data.h>
    51 #include <hal_data.h>
    52 #include <oommonitorsession.h>
    52 #include <oommonitorsession.h>
    53 #include <driveinfo.h>
    53 #include <driveinfo.h>
    54 #include <pathinfo.h>
    54 #include <pathinfo.h>
       
    55 #include <accmonitor.h>
    55 
    56 
    56 #ifndef __WINSCW__
    57 #ifndef __WINSCW__
    57 //#include <SFIUtilsAppInterface.h>
    58 //#include <SFIUtilsAppInterface.h>
    58 #endif
    59 #endif
    59 
    60 
  3305               {
  3306               {
  3306              if ( iController.IsTouchScreenSupported() )
  3307              if ( iController.IsTouchScreenSupported() )
  3307                  {
  3308                  {
  3308                  CAknToolbar* toolbar = CurrentFixedToolbar();
  3309                  CAknToolbar* toolbar = CurrentFixedToolbar();
  3309                  if ( toolbar )
  3310                  if ( toolbar )
  3310                       {
  3311                      {
  3311                       toolbar->SetToolbarVisibility( ETrue );
  3312                      if ( iPreCaptureMode == ECamPreCapViewfinder )
  3312                       }
  3313                          {
       
  3314                          toolbar->SetToolbarVisibility( ETrue );
       
  3315                          }
       
  3316                      else
       
  3317                          {
       
  3318                          toolbar->SetToolbarVisibility( EFalse );
       
  3319                          }
       
  3320                      }
  3313                  }
  3321                  }
  3314               }
  3322               }
  3315           break;
  3323           break;
  3316           }
  3324           }
  3317         // -----------------------------------------------------
  3325         // -----------------------------------------------------
  3809       }
  3817       }
  3810     else
  3818     else
  3811       {
  3819       {
  3812       SetViewFinderInTransit(ETrue);
  3820       SetViewFinderInTransit(ETrue);
  3813       iController.StopViewFinder();
  3821       iController.StopViewFinder();
  3814       TUid viewId = iView->Id();
  3822       if ( iView )
  3815       if(viewId == TUid::Uid( ECamViewIdStillPreCapture )
  3823         {
  3816           || viewId == TUid::Uid( ECamViewIdVideoPreCapture ))
  3824         TUid viewId = iView->Id();
  3817           {
  3825         if(viewId == TUid::Uid( ECamViewIdStillPreCapture )
  3818           CCamViewBase* view = static_cast<CCamViewBase*>(iView);
  3826            || viewId == TUid::Uid( ECamViewIdVideoPreCapture ))
  3819           CCamContainerBase* container = view->Container(); 
  3827            {
  3820           container->DrawNow();
  3828            CCamViewBase* view = static_cast<CCamViewBase*>(iView);
  3821           }
  3829            CCamContainerBase* container = view->Container(); 
       
  3830            container->DrawNow();
       
  3831            }
       
  3832         }
       
  3833       
  3822       
  3834       
  3823       }
  3835       }
  3824     PRINT( _L("Camera TrySwitchViewL E") )
  3836     PRINT( _L("Camera TrySwitchViewL E") )
  3825     TUid uid;
  3837     TUid uid;
  3826     TUid messageUid;
  3838     TUid messageUid;
  5655                 }
  5667                 }
  5656             }
  5668             }
  5657         }
  5669         }
  5658     }
  5670     }
  5659 
  5671 
       
  5672 // ---------------------------------------------------------
       
  5673 // CCamAppUi::IsHeadsetConnected
       
  5674 // Return whether headset is connected
       
  5675 // ---------------------------------------------------------
       
  5676 // 
       
  5677 TBool CCamAppUi::IsHeadsetConnected() const
       
  5678     {
       
  5679     TBool connected( EFalse );
       
  5680     
       
  5681     TRAP_IGNORE(
       
  5682         {
       
  5683         CAccMonitor* monitor = CAccMonitor::NewLC();
       
  5684         RConnectedAccessories accessories;
       
  5685         CleanupClosePushL( accessories );
       
  5686           
       
  5687         TAccMonCapability device = KAccMonNoDevice;
       
  5688             
       
  5689         monitor->GetConnectedAccessoriesL( accessories );
       
  5690         TInt count = accessories.Count();
       
  5691            
       
  5692         // loop through connected accessories
       
  5693         for ( TInt i = 0; i != count; i++ )
       
  5694             {
       
  5695             device = accessories[i]->AccDeviceType();
       
  5696             // headset device type
       
  5697             if ( device == KAccMonHeadset )
       
  5698                 {
       
  5699                 connected = ETrue;
       
  5700                 break;
       
  5701                 }
       
  5702             }
       
  5703            
       
  5704         CleanupStack::PopAndDestroy( &accessories );
       
  5705         CleanupStack::PopAndDestroy( monitor );     
       
  5706         });
       
  5707                 
       
  5708     return connected;
       
  5709     }
  5660 
  5710 
  5661 // ---------------------------------------------------------------------------
  5711 // ---------------------------------------------------------------------------
  5662 // CCamAppUi::HandleVolumeKeyEvent
  5712 // CCamAppUi::HandleVolumeKeyEvent
  5663 // 
  5713 // 
  5664 // ---------------------------------------------------------------------------
  5714 // ---------------------------------------------------------------------------
  5666 void CCamAppUi::HandleVolumeKeyEvent( TRemConCoreApiOperationId aOperationId,
  5716 void CCamAppUi::HandleVolumeKeyEvent( TRemConCoreApiOperationId aOperationId,
  5667                                   TRemConCoreApiButtonAction aButtonAct )
  5717                                   TRemConCoreApiButtonAction aButtonAct )
  5668     {
  5718     {
  5669     PRINT2( _L("Camera => CCamAppUi::HandleVolumeKeyEvent op (%d) act (%d)"), aOperationId, aButtonAct )
  5719     PRINT2( _L("Camera => CCamAppUi::HandleVolumeKeyEvent op (%d) act (%d)"), aOperationId, aButtonAct )
  5670     
  5720     
  5671     if ( !iZoomUsingVolumeKeys )
  5721     if ( !iZoomUsingVolumeKeys || IsHeadsetConnected() )
  5672         {
  5722         {
  5673         PRINT( _L("Camera <= CCamAppUi::HandleVolumeKeyEvent NOT zooming with volume keys") )
  5723         PRINT( _L("Camera <= CCamAppUi::HandleVolumeKeyEvent NOT zooming with volume keys") )
  5674         return;
  5724         return;
  5675         }
  5725         }
  5676     // only handle the shutter key if the app is
  5726     // only handle the shutter key if the app is