66 // CONSTANTS |
66 // CONSTANTS |
67 const TInt KZoomPanelTimeout = 4000000; // 4s |
67 const TInt KZoomPanelTimeout = 4000000; // 4s |
68 const TInt KReticuleFlashTimeout = 250000; // Quarter of a second (in microseconds). |
68 const TInt KReticuleFlashTimeout = 250000; // Quarter of a second (in microseconds). |
69 const TInt KAFIconCorners = 4; // Hip to be square |
69 const TInt KAFIconCorners = 4; // Hip to be square |
70 |
70 |
|
71 const TInt KIndicatorBlinkDelay = 250 * 1000; |
|
72 const TInt KNumberOfBlinks = 3; |
|
73 const TInt KNumberOfBlinksVideo = 8; |
|
74 |
71 #include "camvfgridinterface.h" |
75 #include "camvfgridinterface.h" |
72 #include "camlinevfgriddrawer.h" |
76 #include "camlinevfgriddrawer.h" |
73 |
77 |
74 // Snapshot data is needed in timelapse mode |
78 // Snapshot data is needed in timelapse mode |
75 const TUint KCameraEventInterest = ( ECamCameraEventClassVfControl |
79 const TUint KCameraEventInterest = ( ECamCameraEventClassVfControl |
779 iPhotoSceneUsesReticule = |
783 iPhotoSceneUsesReticule = |
780 !iController.CurrentSceneHasForcedFocus(); |
784 !iController.CurrentSceneHasForcedFocus(); |
781 } |
785 } |
782 } |
786 } |
783 } |
787 } |
|
788 // --------------------------------------------------- |
|
789 case ECamEventImageQualityChanged: |
|
790 case ECamEventVideoQualityChanged: |
|
791 if ( iBlinkResolutionIndicator ) |
|
792 { |
|
793 // Force the first blink to occur right away |
|
794 iDrawIndicator = EFalse; |
|
795 DrawResolutionIndicator(); |
|
796 |
|
797 // Update the resolution indicator icon to be used. |
|
798 SetResolutionIndicator(); |
|
799 |
|
800 // Start the blinking timer |
|
801 if ( !iIndBlinkTimer ) |
|
802 { |
|
803 iIndBlinkTimer = CPeriodic::NewL( EPriorityLess ); |
|
804 } |
|
805 else |
|
806 { |
|
807 iIndBlinkTimer->Cancel(); |
|
808 } |
|
809 |
|
810 iToggleCountdown = 2 * KNumberOfBlinks; |
|
811 if ( ECamEventVideoQualityChanged == aEvent ) |
|
812 { |
|
813 iToggleCountdown = 2 * KNumberOfBlinksVideo; |
|
814 } |
|
815 PRINT( _L("Camera <> start timer to blink indicator") ); |
|
816 iIndBlinkTimer->Start( KIndicatorBlinkDelay, |
|
817 KIndicatorBlinkDelay, |
|
818 TCallBack( IndicatorVisible, this) ); |
|
819 |
|
820 // Force the first blink to occur right away |
|
821 iDrawIndicator = ETrue; |
|
822 DrawResolutionIndicator(); |
|
823 |
|
824 // Quality level has changed through pinch gesture |
|
825 // Reinitialise the viewfinder grid |
|
826 if ( iVfGridDrawer ) |
|
827 { |
|
828 delete iVfGridDrawer; |
|
829 iVfGridDrawer = NULL; |
|
830 |
|
831 TRect rect = ViewFinderFrameRect(); |
|
832 InitVfGridL( rect ); |
|
833 } |
|
834 } |
|
835 else |
|
836 { |
|
837 if ( iIndBlinkTimer ) |
|
838 iIndBlinkTimer->Cancel(); |
|
839 } |
|
840 break; |
|
841 // --------------------------------------------------- |
784 default: |
842 default: |
785 { |
843 { |
786 // Other events => no action. |
844 // Other events => no action. |
787 break; |
845 break; |
788 } |
846 } |
825 |
883 |
826 ResetVFGridVisibility(); |
884 ResetVFGridVisibility(); |
827 } |
885 } |
828 else |
886 else |
829 { |
887 { |
|
888 if ( iIndBlinkTimer ) |
|
889 { |
|
890 iIndBlinkTimer->Cancel(); |
|
891 iDrawIndicator = ETrue; |
|
892 } |
830 iReceivedVfFrame = EFalse; |
893 iReceivedVfFrame = EFalse; |
831 |
894 |
832 // Cancel timer if we're losing focus |
895 // Cancel timer if we're losing focus |
833 iZoomTimer->Cancel(); |
896 iZoomTimer->Cancel(); |
834 |
897 |
2562 } |
2632 } |
2563 } |
2633 } |
2564 return resolutionIconLayout.Rect(); |
2634 return resolutionIconLayout.Rect(); |
2565 } |
2635 } |
2566 |
2636 |
|
2637 void CCamPreCaptureContainerBase::BlinkResolutionIndicatorOnChange( TBool aBlink ) |
|
2638 { |
|
2639 iBlinkResolutionIndicator = aBlink; |
|
2640 } |
|
2641 |
|
2642 void CCamPreCaptureContainerBase::DrawResolutionIndicator() |
|
2643 { |
|
2644 PRINT( _L("Camera => CCamPreCaptureContainerBase::DrawResolutionIndicator") ); |
|
2645 iToggleCountdown--; |
|
2646 |
|
2647 // State changed, need to redraw |
|
2648 ActivateGc(); |
|
2649 |
|
2650 // Invalidate the flash icon area |
|
2651 TRect rect( iResolutionIndicators[iCurrentIndicator]->LayoutRect() ); |
|
2652 RWindow window = Window(); |
|
2653 window.Invalidate( rect ); |
|
2654 window.BeginRedraw( rect ); |
|
2655 |
|
2656 // Redraw the background in that area |
|
2657 Redraw( rect ); |
|
2658 |
|
2659 // Draw the flash icon itself |
|
2660 CWindowGc& gc = SystemGc(); |
|
2661 if( iDrawIndicator ) |
|
2662 { |
|
2663 iResolutionIndicators[iCurrentIndicator]->DisplayIcon(); |
|
2664 } |
|
2665 else |
|
2666 { |
|
2667 iResolutionIndicators[iCurrentIndicator]->ClearIcon(); |
|
2668 } |
|
2669 iResolutionIndicators[iCurrentIndicator]->Draw( gc ); |
|
2670 |
|
2671 // Tell the window redraw is finished and deactivate Gc |
|
2672 window.EndRedraw(); |
|
2673 DeactivateGc(); |
|
2674 |
|
2675 // Stop the periodic timer when enough blinking has been done |
|
2676 if ( iDrawIndicator && iToggleCountdown <= 0 ) |
|
2677 { |
|
2678 iBlinkResolutionIndicator = EFalse; |
|
2679 iIndBlinkTimer->Cancel(); |
|
2680 } |
|
2681 |
|
2682 PRINT( _L("Camera <= CCamPreCaptureContainerBase::DrawResolutionIndicator") ); |
|
2683 } |
|
2684 |
|
2685 TInt CCamPreCaptureContainerBase::IndicatorVisible( TAny *aSelf ) |
|
2686 { |
|
2687 PRINT( _L("Camera => CCamPreCaptureContainerBase::IndicatorVisible") ); |
|
2688 CCamPreCaptureContainerBase* self = static_cast<CCamPreCaptureContainerBase*> (aSelf); |
|
2689 |
|
2690 if ( self ) |
|
2691 { |
|
2692 self->iDrawIndicator = !self->iDrawIndicator; |
|
2693 self->DrawResolutionIndicator(); |
|
2694 } |
|
2695 PRINT( _L("Camera <= CCamPreCaptureContainerBase::IndicatorVisible") ); |
|
2696 return KErrNone; |
|
2697 } |
|
2698 |
2567 // End of File |
2699 // End of File |
2568 |
2700 |