phoneuis/BubbleManager/Src/BMBubbleOutlookVideoCnap.cpp
changeset 0 5f000ab63145
child 19 544e34b3255a
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Bubble outlook video ringtone.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookVideoCnap.h"
       
    22 #include    "BMBubbleImageManager.h"
       
    23 #include    "BMResourceManager.h"
       
    24 #include    "BMBubbleHeader.h"
       
    25 #include    "BMUtils.h"
       
    26 #include    "BMLayout3.h"
       
    27 #include    "BMVideoController.h"
       
    28 #include    "telbubblecustomelement.h"
       
    29 
       
    30 #include    <eiklabel.h> 
       
    31 #include    <eikimage.h>
       
    32 #include    <eikenv.h>
       
    33 #include    <AknsUtils.h>
       
    34 #include    <AknsDrawUtils.h>
       
    35 #include    <AknLayout2ScalableDef.h>
       
    36 #include    <layoutmetadata.cdl.h>
       
    37 
       
    38 
       
    39 // ========================= MEMBER FUNCTIONS ================================
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CBubbleOutlookVideoCnap
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CBubbleOutlookVideoCnap::CBubbleOutlookVideoCnap( 
       
    46     CBubbleManager& aBubbleManager ) : 
       
    47     CBubbleOutlookThreeLined( aBubbleManager )
       
    48     {
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // ConstructL
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CBubbleOutlookVideoCnap::ConstructL()
       
    56     { 
       
    57     CBubbleOutlookThreeLined::ConstructL();
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // ~CBubbleOutlookVideoCnap
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CBubbleOutlookVideoCnap::~CBubbleOutlookVideoCnap()
       
    65     {
       
    66     Reset();
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // ReadBubbleHeader
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 void CBubbleOutlookVideoCnap::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    74     {
       
    75     iHeader = &aHeader;
       
    76     
       
    77     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    78     
       
    79     CBubbleOutlookThreeLined::ReadBubbleHeader( aHeader );
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // SizeChanged
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 void CBubbleOutlookVideoCnap::SizeChanged()
       
    87     {
       
    88     if( !iHeader )
       
    89         {
       
    90         return;
       
    91         }
       
    92         
       
    93     const TRect rect( Rect() );
       
    94     
       
    95     // Layout labels
       
    96     BubbleUtils::LayoutLabel( 
       
    97         iTextLine1, 
       
    98         rect, 
       
    99         BubbleLayout3::popup_call3_audio_in_window_text_line_1(2));    
       
   100             
       
   101     BubbleUtils::LayoutLabel( 
       
   102         iTextLine2,
       
   103         rect, 
       
   104         BubbleLayout3::popup_call3_audio_in_window_text_line_2(2));
       
   105 
       
   106     BubbleUtils::LayoutLabel( 
       
   107         iTextLine3,
       
   108         rect, 
       
   109         BubbleLayout3::popup_call3_audio_in_window_text_line_3(0));                
       
   110 
       
   111     // Call indicator
       
   112     BubbleUtils::LayoutCustomElement(
       
   113         iBigCallIndicator, 
       
   114         rect, 
       
   115         BubbleLayout3::popup_call3_audio_in_window_call_indication(2) );
       
   116     
       
   117     // Layout number type icon
       
   118     BubbleUtils::LayoutCustomElement( 
       
   119         iNumberType, 
       
   120         rect, 
       
   121         BubbleLayout3::popup_call3_audio_in_window_numbertype_indication(2));   
       
   122 
       
   123     // Layout cyphering indicator
       
   124     BubbleUtils::LayoutControl(
       
   125         iCyphOffImage, 
       
   126         rect, 
       
   127         BubbleLayout3::popup_call3_audio_in_window_cipheringoff_indication(2));      
       
   128         
       
   129     // Layout and prepare frame
       
   130     TAknLayoutRect bubbleRect;
       
   131     bubbleRect.LayoutRect( 
       
   132         rect, 
       
   133         BubbleLayout3::popup_call3_audio_in_pane(1));
       
   134     
       
   135     if ( Layout_Meta_Data::IsMirrored() )
       
   136         {
       
   137         TAknLayoutRect bubbleTopRight;        
       
   138         bubbleTopRight.LayoutRect( 
       
   139             bubbleRect.Rect(), 
       
   140             BubbleLayout3::popup_call3_audio_in_window_fr_corner_topright());
       
   141             
       
   142         TAknLayoutRect bubbleBottomLeft;        
       
   143         bubbleBottomLeft.LayoutRect( 
       
   144             bubbleRect.Rect(), 
       
   145             BubbleLayout3::popup_call3_audio_in_window_fr_corner_bottomleft());        
       
   146         
       
   147         iOuterRect = TRect( bubbleTopRight.Rect().iTl, 
       
   148                                  bubbleBottomLeft.Rect().iBr );
       
   149         iInnerRect = TRect( bubbleTopRight.Rect().iBr, 
       
   150                                  bubbleBottomLeft.Rect().iTl );        
       
   151         }
       
   152     else
       
   153         {
       
   154         TAknLayoutRect bubbleTopLeft;        
       
   155         bubbleTopLeft.LayoutRect( 
       
   156             bubbleRect.Rect(), 
       
   157             BubbleLayout3::popup_call3_audio_in_window_fr_corner_topleft());
       
   158             
       
   159         TAknLayoutRect bubbleBottomRight;        
       
   160         bubbleBottomRight.LayoutRect( 
       
   161             bubbleRect.Rect(), 
       
   162             BubbleLayout3::popup_call3_audio_in_window_fr_corner_bottomright());        
       
   163         
       
   164         iOuterRect = TRect( bubbleTopLeft.Rect().iTl, 
       
   165                                  bubbleBottomRight.Rect().iBr );
       
   166         iInnerRect = TRect( bubbleTopLeft.Rect().iBr, 
       
   167                                  bubbleBottomRight.Rect().iTl );        
       
   168         }        
       
   169                     
       
   170 
       
   171     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   172     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   173     iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ?
       
   174                                       KAknsIIDQsnFrCall3RectDisconn : 
       
   175                                       KAknsIIDQsnFrCall3Rect;
       
   176     AknsDrawUtils::PrepareFrame( skin,
       
   177                                  iOuterRect,
       
   178                                  iInnerRect,
       
   179                                  iFrameId,
       
   180                                  KAknsIIDDefault );
       
   181 
       
   182     // Pass video layouts to video controller.
       
   183     LayoutVideoPanes( rect );
       
   184     iBubbleManager.VideoController().SetVideoPaneBackgroundFrame(
       
   185         iFrameId, iOuterRect, iInnerRect );
       
   186                                  
       
   187     // Layout rectangle for separator line
       
   188     TAknLayoutRect lineRect;
       
   189     lineRect.LayoutRect( rect, 
       
   190         BubbleLayout3::popup_call3_audio_in_window_separator_line( 2 )); 
       
   191     iLineRect = lineRect.Rect();        
       
   192     }
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // PositionChanged
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 void CBubbleOutlookVideoCnap::PositionChanged()
       
   199     {
       
   200     AknsUtils::RegisterControlPosition( this );
       
   201     }
       
   202     
       
   203 // ---------------------------------------------------------------------------
       
   204 // DrawBitmaps
       
   205 // ---------------------------------------------------------------------------
       
   206 //
       
   207 void CBubbleOutlookVideoCnap::DrawBitmaps( CBitmapContext& aGc ) const
       
   208     {
       
   209     // Check that proper call header is set
       
   210     if ( iHeader == NULL ) 
       
   211         { 
       
   212         return; 
       
   213         }
       
   214 
       
   215     if ( !iHeader->IsUsed() ) 
       
   216         { 
       
   217         return; 
       
   218         }
       
   219 
       
   220     if ( iHeader->IsInConference() ) 
       
   221         { 
       
   222         return; 
       
   223         }
       
   224 
       
   225     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   226     if ( iBubble->Bitmap() )
       
   227         {
       
   228         BubbleUtils::DrawMaskedImage( aGc , iBubble );    
       
   229         }
       
   230     else
       
   231         {
       
   232         // Draw bubble frame
       
   233         if ( !AknsDrawUtils::DrawFrame( skin,
       
   234                                         (CWindowGc&) aGc,  
       
   235                                         iOuterRect,
       
   236                                         iInnerRect,
       
   237                                         iFrameId,
       
   238                                         KAknsIIDDefault ) )
       
   239             {
       
   240             BubbleUtils::DrawBackgroundRect( aGc, Rect() );
       
   241             }        
       
   242         }
       
   243         
       
   244     CFbsBitmap* lineBmp = NULL;
       
   245     CFbsBitmap* lineBmpMask = NULL;
       
   246     AknsUtils::GetCachedMaskedBitmap( skin,
       
   247                                       KAknsIIDQgnGrafLineSecondaryHorizontal, 
       
   248                                       lineBmp, 
       
   249                                       lineBmpMask);
       
   250     if ( lineBmp )
       
   251         {
       
   252         AknIconUtils::SetSize( lineBmp, 
       
   253                                iLineRect.Size(), 
       
   254                                EAspectRatioNotPreserved);
       
   255         if ( lineBmpMask )
       
   256             {
       
   257             AknIconUtils::SetSize( lineBmpMask, iLineRect.Size(), 
       
   258                                    EAspectRatioNotPreserved);
       
   259             
       
   260             aGc.BitBltMasked( iLineRect.iTl, lineBmp, TRect( TPoint(0,0), 
       
   261                              lineBmp->SizeInPixels() ),
       
   262                              lineBmpMask, EFalse);
       
   263             }
       
   264         else
       
   265             {
       
   266             aGc.BitBlt( iLineRect.iTl, lineBmp );
       
   267             }
       
   268         }                 
       
   269     }
       
   270     
       
   271 // ---------------------------------------------------------------------------
       
   272 // LayoutVideoPanes
       
   273 // ---------------------------------------------------------------------------
       
   274 //
       
   275 void CBubbleOutlookVideoCnap::LayoutVideoPanes( const TRect& aParentRect )
       
   276     {
       
   277      // Qcif video pane         
       
   278     TAknLayoutRect qcifVideoPane;
       
   279     qcifVideoPane.LayoutRect( 
       
   280         aParentRect, 
       
   281         BubbleLayout3::call3_video_qcif_pane(2) );
       
   282 
       
   283     // Qcif uncrop pane         
       
   284     TAknLayoutRect qcifUncropPane;
       
   285     qcifUncropPane.LayoutRect( 
       
   286         aParentRect, 
       
   287         BubbleLayout3::call3_video_qcif_uncrop_pane(2) );
       
   288         
       
   289     // Subqcif video pane         
       
   290     TAknLayoutRect subQcifVideoPane;
       
   291     subQcifVideoPane.LayoutRect( 
       
   292         aParentRect, 
       
   293         BubbleLayout3::call3_video_subqcif_pane(2) );
       
   294 
       
   295     // Subqcif uncrop pane         
       
   296     TAknLayoutRect subQcifUncropPane;
       
   297     subQcifUncropPane.LayoutRect( 
       
   298         aParentRect, 
       
   299         BubbleLayout3::call3_video_subqcif_uncrop_pane(2) );
       
   300         
       
   301     // Update video rects to video controller
       
   302     iBubbleManager.VideoController().SetQcifVideoPaneRects(
       
   303          qcifVideoPane.Rect(),
       
   304          qcifUncropPane.Rect() );
       
   305          
       
   306     iBubbleManager.VideoController().SetSubQcifVideoPaneRects(
       
   307          subQcifVideoPane.Rect(),
       
   308          subQcifUncropPane.Rect() );    
       
   309     }            
       
   310 
       
   311 // End of File