camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp
branchRCL_3
changeset 17 8f559c47d7fd
parent 16 53c8aa5d97a3
child 19 e32fcfe0045f
--- a/camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp	Tue May 25 12:22:04 2010 +0300
+++ b/camerauis/cameraapp/generic/src/CamVideoPreCaptureView.cpp	Wed Jun 09 09:21:41 2010 +0300
@@ -57,8 +57,9 @@
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "CamVideoPreCaptureViewTraces.h"
 #endif
+#include "CamTimer.h"
 
-
+const TInt KHdmiTimeout = 1000000; // 1 sec
 
 
 // ========================= MEMBER FUNCTIONS ================================
@@ -84,6 +85,11 @@
 //
 CCamVideoPreCaptureView::~CCamVideoPreCaptureView()
     {
+    if( iHdmiTimer )
+        {
+        delete iHdmiTimer;
+        iHdmiTimer = NULL;
+        }
     }
     
 // ---------------------------------------------------------------------------
@@ -148,7 +154,12 @@
              // if the Camera in the Portrait mode
              // MSK event is handled like a capture key
             {
-            if ( iController.IsViewFinding() && appUi->CheckMemoryL() )
+            if( iController.IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
+                    iController.IsHdmiCableConnected() )
+                {
+                appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+                }
+            else if ( iController.IsViewFinding() && appUi->CheckMemoryL() )
                 {
                 iController.StartVideoRecordingL();
                 // fixed toolbar is used only with touch devices
@@ -168,7 +179,11 @@
         {
         	TInt callType( EPSCTsyCallTypeUninitialized );
             RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
-            if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
+            if( iController.IsHdmiCableConnected() )
+                {
+                appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+                }
+            else if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
             {
             SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
             appUi->SetLensCoverExit( EFalse );
@@ -575,7 +590,10 @@
           {
           // Vf was stopped when stopping video recording, need to restart here
           // if postcapture is off.
-          StartViewFinder();  
+          StartViewFinder();
+          if( iHdmiTimer->IsActive() )
+              iHdmiTimer->Cancel();
+          iHdmiTimer->StartTimer();
           } 
       break;
       }
@@ -619,17 +637,17 @@
 //
 void CCamVideoPreCaptureView::ConstructL()
     {
-    BaseConstructL( ROID(R_CAM_VIDEO_PRE_CAPTURE_VIEW_ID));
+    BaseConstructL( ROID(R_CAM_VIDEO_PRE_CAPTURE_VIEW_ID) );
     if(iController.UiConfigManagerPtr()->IsXenonFlashSupported())
         {
         CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR);
-        UpdateToolbarIconsL();
         }
     else
         {
         CreateAndSetToolbarL(R_CAM_VIDEO_PRECAPTURE_TOOLBAR_VIDEOLIGHT);
         }
     CCamPreCaptureViewBase::ConstructL();
+    iHdmiTimer = CCamTimer::NewL( KHdmiTimeout, TCallBack(HdmiTimerCallback, this));
     }
 
 // ---------------------------------------------------------------------------
@@ -1314,7 +1332,12 @@
     		// in CCamVideoPreCaptureContainer
         	TInt callType( EPSCTsyCallTypeUninitialized );
             RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallType, callType );
-            if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
+            if( iController.IntegerSettingValue( ECamSettingItemStopRecordingInHdmiMode) &&
+                    iController.IsHdmiCableConnected() )
+                {
+                appUi->HandleHdmiEventL( ECamHdmiCableConnectedBeforeRecording );
+                }
+            else if ( callType != EPSCTsyCallTypeH324Multimedia && iController.IsViewFinding() && appUi->CheckMemoryL() )
             {
                 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK );
                 iController.StartVideoRecordingL();
@@ -1643,5 +1666,30 @@
          }
      }
 
+ // ---------------------------------------------------------------------------
+ // CCamVideoPostCaptureView::HdmiTimerCallback
+ // ---------------------------------------------------------------------------
+ //
+ TInt CCamVideoPreCaptureView::HdmiTimerCallback( TAny* aSelf )
+     {
+     CCamVideoPreCaptureView* self = static_cast<CCamVideoPreCaptureView*>(aSelf);
+     TInt err(0);
+     if( self )
+         {
+         TRAP(err, self->DoHdmiTimerCallbackL() );
+         }
+     PRINT1( _L("Camera <> CCamVideoPreCaptureView::HdmiTimerCallback err=%d"), err);
+     return err;
+     }
+
+ // ---------------------------------------------------------------------------
+ // CCamVideoPostCaptureView::DoHdmlTimerCallbackL
+ // ---------------------------------------------------------------------------
+ //
+ void CCamVideoPreCaptureView::DoHdmiTimerCallbackL()
+     {
+     iController.HandlePostHdmiConnectDuringRecordingEventL();
+     }
+
 
 //  End of File