javauis/mmapi_akn/baseline/src/cmmacamerawindow.cpp
changeset 23 98ccebc37403
parent 21 2a9601315dfc
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
   204         iDrawRect = aRect;
   204         iDrawRect = aRect;
   205 
   205 
   206         // Stop and start ViewFinder to update position
   206         // Stop and start ViewFinder to update position
   207         ResetViewFinder();
   207         ResetViewFinder();
   208     }
   208     }
   209 
       
   210 }
   209 }
   211 
   210 
   212 
   211 
   213 // ---------------------------------------------------------------------------
   212 // ---------------------------------------------------------------------------
   214 // From class MMMADisplayWindow
   213 // From class MMMADisplayWindow
   309         {
   308         {
   310             iDisplay->UIGetCallback(
   309             iDisplay->UIGetCallback(
   311                 *this, CMMACameraWindow::EResetViewFinder);
   310                 *this, CMMACameraWindow::EResetViewFinder);
   312         }
   311         }
   313     }
   312     }
   314 
       
   315 
       
   316 }
   313 }
   317 
   314 
   318 
   315 
   319 // ---------------------------------------------------------------------------
   316 // ---------------------------------------------------------------------------
   320 // From class MMMADisplayWindow
   317 // From class MMMADisplayWindow
   614 
   611 
   615         if (iUICamera->ViewFinderActive())
   612         if (iUICamera->ViewFinderActive())
   616         {
   613         {
   617             iUICamera->StopViewFinder();
   614             iUICamera->StopViewFinder();
   618         }
   615         }
   619         if (iDirectAccess->IsActive())
       
   620         {
       
   621             iDirectAccess->Cancel();
       
   622         }
       
   623 
   616 
   624         iViewFinderVisible = EFalse;
   617         iViewFinderVisible = EFalse;
   625     }
   618     }
   626 }
   619 }
   627 
   620 
   715     {
   708     {
   716         DEBUG("MMA::CMMACameraWindow::StartViewFinder - Start OK");
   709         DEBUG("MMA::CMMACameraWindow::StartViewFinder - Start OK");
   717     }
   710     }
   718     else
   711     else
   719     {
   712     {
   720         DEBUG_INT(
   713         DEBUG_INT("MMA::CMMACameraWindow::StartViewFinder()  - \
   721             "MMA::CMMACameraWindow::StartViewFinder()  - \
   714             StartViewFinderDirectL error=%d", vfError);
   722 StartViewFinderDirectL error=%d", vfError);
   715 
   723 
   716         TRAPD(error, DrawViewFinderErrorL(vfError, drawRect));
   724         TRAP_IGNORE(DrawViewFinderErrorL(vfError, drawRect));
   717         DEBUG_INT("MMA::CMMACameraWindow::StartViewFinder, \
       
   718             DrawViewFinderErrorL error = %d", error);
   725     }
   719     }
   726 
   720 
   727     DEBUG(" > StartViewFinder");
   721     DEBUG(" > StartViewFinder");
   728 }
   722 }
   729 
   723 
   736 //
   730 //
   737 void CMMACameraWindow::DrawViewFinderErrorL(
   731 void CMMACameraWindow::DrawViewFinderErrorL(
   738     const TInt /*aError*/,
   732     const TInt /*aError*/,
   739     const TRect& aDrawRect)
   733     const TRect& aDrawRect)
   740 {
   734 {
   741 
   735     if (!iDirectAccess)
   742     ASSERT(iDirectAccess);
   736     {
       
   737         if (!iWs || !iScreenDevice || !iWindow) return;
       
   738 
       
   739         DEBUG("MMA::CMMACameraWindow::DrawViewFinderErrorL - \
       
   740             Instantiating CDirectScreenAccess");
       
   741         iDirectAccess = CDirectScreenAccess::NewL(*iWs,
       
   742                                      *iScreenDevice,
       
   743                                      *iWindow,
       
   744                                      *this);
       
   745     }
       
   746 
   743     TInt dcError = KErrNone;
   747     TInt dcError = KErrNone;
   744     if (!iDirectAccess->IsActive())
   748     if (!iDirectAccess->IsActive())
   745     {
   749     {
   746         TRAP(dcError, iDirectAccess->StartL());
   750         TRAP(dcError, iDirectAccess->StartL());
   747     }
   751     }
   829         iStarterTimer = NULL;
   833         iStarterTimer = NULL;
   830         iUICamera->Release();
   834         iUICamera->Release();
   831         delete iUICamera;
   835         delete iUICamera;
   832         iUICamera = NULL;
   836         iUICamera = NULL;
   833         iCameraPowerOn = EFalse;
   837         iCameraPowerOn = EFalse;
   834         iDirectAccess->Cancel();
   838         if (iDirectAccess)
   835         delete iDirectAccess;
   839         {
   836         iDirectAccess = NULL;
   840             iDirectAccess->Cancel();
       
   841             delete iDirectAccess;
       
   842             iDirectAccess = NULL;
       
   843         }
   837         delete iErrorIconBitmap;
   844         delete iErrorIconBitmap;
   838         iErrorIconBitmap = NULL;
   845         iErrorIconBitmap = NULL;
   839         delete iErrorIconMaskBitmap;
   846         delete iErrorIconMaskBitmap;
   840         iErrorIconMaskBitmap = NULL;
   847         iErrorIconMaskBitmap = NULL;
   841     }
   848     }
   880 void CMMACameraWindow::MdcDSAResourcesCallback(
   887 void CMMACameraWindow::MdcDSAResourcesCallback(
   881     RWsSession &aWs,
   888     RWsSession &aWs,
   882     CWsScreenDevice &aScreenDevice,
   889     CWsScreenDevice &aScreenDevice,
   883     RWindowBase &aWindow)
   890     RWindowBase &aWindow)
   884 {
   891 {
   885     TRAPD(error, iDirectAccess = CDirectScreenAccess::NewL(aWs,
       
   886                                  aScreenDevice,
       
   887                                  aWindow,
       
   888                                  *this));
       
   889     DEBUG_INT("MMA::CMMACameraWindow::MdcDSAResourcesCallback, error = %d", error);
       
   890     if (KErrNone != error)
       
   891     {
       
   892         return;
       
   893     }
       
   894     this->UIStartViewFinder(aWs, aScreenDevice, aWindow);
   892     this->UIStartViewFinder(aWs, aScreenDevice, aWindow);
   895 }
   893 }
   896 
   894 
   897 
   895 
   898 // ---------------------------------------------------------------------------
   896 // ---------------------------------------------------------------------------