myp990camerabaseview.cpp

来自「UIQ3 P990 Camera使用实例」· C++ 代码 · 共 103 行

CPP
103
字号
/***************************************************************************** 
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 <MyP990Camera.rsg>

#include <QikCommand.h>
#include <QikFullscreenFloatingMenu.h>


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;
  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?