www.pudn.com > MyP990Camera.zip > MyP990CameraBaseView.cpp


/*****************************************************************************  
COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2006.  
The software is the copyrighted work of Sony Ericsson Mobile Communications AB.  
The use of the software is subject to the terms of use or of the end-user license  
agreement which accompanies or is included with the software. The software is  
provided "as is" and Sony Ericsson specifically disclaim any warranty or  
condition whatsoever regarding merchantability or fitness for a specific  
purpose, title or non-infringement. No warranty of any kind is made in  
relation to the condition, suitability, availability, accuracy, reliability,  
merchantability and/or non-infringement of the software provided herein.  
*****************************************************************************/ 
 
// MyP990CameraBaseView.cpp 
 
#include "MyP990CameraBaseView.h" 
#include "MyFileHandler.h" 
#include "MyCameraHandler.h" 
#include "MyP990CameraGlobals.h" 
#include  
 
#include  
#include  
 
 
CMyP990CameraBaseView* CMyP990CameraBaseView::NewLC(CQikAppUi& aAppUi, 
                                                    CMyFileHandler& aFileHandler, 
                                                    CMyCameraHandler& aCameraHandler) 
  { 
  CMyP990CameraBaseView* self = new (ELeave) CMyP990CameraBaseView(aAppUi, aFileHandler, aCameraHandler); 
  CleanupStack::PushL(self); 
  self->ConstructL(); 
  return self; 
  } 
 
void CMyP990CameraBaseView::MySetViewMode(TQikViewMode aViewMode) 
  { 
  SetViewModeL(aViewMode); 
  } 
 
TVwsViewId CMyP990CameraBaseView::ViewId() const 
  { 
  return TVwsViewId(KUidMyP990CameraID, KUidMyP990CameraBaseViewID); 
  } 
 
void CMyP990CameraBaseView::ViewConstructL() 
  { 
  ViewConstructFromResourceL(R_MYP990CAMERA_BASEVIEW_UI_CONFIGURATIONS, 0); 
 
  InitComponentArrayL(); 
 
  // floating menu icon, displayed i.e. in full screen mode 
  iFloatingMenu = CQikFullscreenFloatingMenu::NewL(*this); 
  AddControlLC(iFloatingMenu); 
  CQikCommandManager::Static(*iCoeEnv).AddCustomOperatorL(*this,*iFloatingMenu); 
  CleanupStack::Pop(iFloatingMenu); 
  } 
 
CMyP990CameraBaseView::~CMyP990CameraBaseView() 
  { 
  } 
 
CMyP990CameraBaseView::CMyP990CameraBaseView(CQikAppUi& aAppUi, 
                                             CMyFileHandler& aFileHandler, 
                                             CMyCameraHandler& aCameraHandler) 
  : CQikViewBase(aAppUi, KNullViewId), 
  iFileHandler(aFileHandler), iCameraHandler(aCameraHandler), 
  iTakingPicture(EFalse) 
  { 
  } 
 
void CMyP990CameraBaseView::ConstructL() 
  { 
  BaseConstructL(); 
  } 
 
void CMyP990CameraBaseView::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
  { 
  if(aPointerEvent.iType == TPointerEvent::EButton1Down) 
    { 
    // try catching camera picture 
    TInt camRes = iCameraHandler.ShootPicture(&iFileHandler); 
    if(camRes == KErrNone) 
      iTakingPicture = ETrue; 
    else 
      User::InfoPrint(_L("Camera not ready")); 
    } 
  } 
 
TKeyResponse CMyP990CameraBaseView::OfferKeyEventL(const TKeyEvent &aKeyEvent, 
                                                   TEventCode aType) 
  { 
  if(aType == EEventKeyDown) 
    { 
    // autofocus on key A in FO/FC 
    if(aKeyEvent.iScanCode == 'A' || aKeyEvent.iScanCode == 50) 
      { 
      iCameraHandler.DoAutoFocus(); 
      } 
    } 
  return EKeyWasConsumed; 
  }