phoneuis/BubbleManager/Src/BMBubbleOutlookMiddleCnap.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: Implementation of CBubbleOutMiddleCnap class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMBubbleManager.h" //for enumerations
       
    21 #include    "BMBubbleOutlookMiddleCnap.h"
       
    22 #include    "BMBubbleImageManager.h"
       
    23 #include    "BMResourceManager.h"
       
    24 #include    "BMBubbleHeader.h"
       
    25 #include    "BMLayout.h"
       
    26 #include    "BMUtils.h"
       
    27 #include    "BMLayout2.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 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 //
       
    41 CBubbleOutlookMiddleCnap::CBubbleOutlookMiddleCnap
       
    42     ( CBubbleManager& aBubbleManager )
       
    43     : CBubbleOutlookThreeLined( aBubbleManager )
       
    44     {
       
    45     }
       
    46 
       
    47 // Symbian OS default constructor can leave.
       
    48 void CBubbleOutlookMiddleCnap::ConstructL()
       
    49     {
       
    50     CBubbleOutlookThreeLined::ConstructL();
       
    51     }
       
    52 
       
    53     
       
    54 // Destructor
       
    55 CBubbleOutlookMiddleCnap::~CBubbleOutlookMiddleCnap()
       
    56     {
       
    57     Reset();
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CBubbleOutlookMiddleCnap::ReadBubbleHeader
       
    63 //
       
    64 //  
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 void CBubbleOutlookMiddleCnap::ReadBubbleHeader( CBubbleHeader& aHeader )
       
    68     {
       
    69     iHeader = &aHeader;
       
    70     
       
    71     iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue );        
       
    72     
       
    73     if ( !iCallObjectDisplay )
       
    74         {
       
    75         GetCall1BubbleBitmaps();    
       
    76         }
       
    77     
       
    78     CBubbleOutlookThreeLined::ReadBubbleHeader( aHeader );
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CBubbleOutlookMiddleCnap::SizeChanged
       
    83 // called by framwork when the view size is changed
       
    84 //  
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void CBubbleOutlookMiddleCnap::SizeChanged()
       
    88     {
       
    89     if( !iHeader )
       
    90         {
       
    91         return;
       
    92         }
       
    93 
       
    94     AknsUtils::RegisterControlPosition( this );
       
    95 
       
    96     if ( !iCallObjectDisplay )
       
    97         {
       
    98         DoCall1Layout();    
       
    99         }
       
   100     else
       
   101         {
       
   102         TRAPD( err, DoCall2LayoutL() );
       
   103         if ( err )    
       
   104             {
       
   105             iBubble->SetPicture( NULL, NULL );
       
   106                 
       
   107             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   108             AknsDrawUtils::PrepareFrame( skin,
       
   109                                          iOuterRect,
       
   110                                          iInnerRect,
       
   111                                          iFrameId,
       
   112                                          KAknsIIDDefault );
       
   113             }  
       
   114         }      
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CBubbleOutlookMiddleCnap::DoCall1Layout
       
   119 // ---------------------------------------------------------------------------
       
   120 //    
       
   121 void CBubbleOutlookMiddleCnap::DoCall1Layout()
       
   122     {
       
   123     // Deprecated
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CBubbleOutlookMiddleCnap::DoCall2Layout
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 void CBubbleOutlookMiddleCnap::DoCall2LayoutL()
       
   131     {
       
   132     iBubble->SetPictureOwnedExternally( EFalse );
       
   133     iBubble->SetPicture( NULL, NULL );
       
   134     
       
   135     const TRect rect = Rect();
       
   136     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   137     switch ( callState )
       
   138         {
       
   139         case CBubbleManager::EIncoming:
       
   140         case CBubbleManager::EOutgoing:
       
   141         case CBubbleManager::EAlerting:
       
   142         case CBubbleManager::EWaiting:
       
   143         case CBubbleManager::EAlertToDisconnected:
       
   144             {
       
   145             ///////////////////////////////////////////////////////////////////
       
   146             // Incoming call layout. Three lines of text. Number entry open.
       
   147             ///////////////////////////////////////////////////////////////////
       
   148             
       
   149             // Layout create bubble image
       
   150             TAknLayoutRect bubbleRect;
       
   151             bubbleRect.LayoutRect( 
       
   152                 rect, 
       
   153                 BubbleLayout2::popup_call2_audio_in_background(6) );
       
   154             
       
   155             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   156             TRect outerRect;
       
   157             TRect innerRect;
       
   158             BubbleLayout2::RectFrameInnerOuterRects( frameRect, 
       
   159                                                      outerRect, 
       
   160                                                      innerRect);
       
   161             
       
   162             iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ?
       
   163                                       KAknsIIDQsnFrCall2RectDisconn : 
       
   164                                       KAknsIIDQsnFrCall2Rect;
       
   165             
       
   166             iOuterRect = outerRect;
       
   167             iOuterRect.Move( Rect().iTl );
       
   168             iInnerRect = innerRect;
       
   169             iInnerRect.Move( Rect().iTl );
       
   170 
       
   171             // Call indicator
       
   172             BubbleUtils::LayoutCustomElement(
       
   173                 iBigCallIndicator, 
       
   174                 rect, 
       
   175                 BubbleLayout2::popup_call2_audio_out_call_waiting_icon(1) );
       
   176             
       
   177             // Ciphering off
       
   178             BubbleUtils::LayoutControl( 
       
   179                 iCyphOffImage, 
       
   180                 rect,
       
   181                 BubbleLayout2::popup_call2_audio_in_ciphering_icon(6) );                
       
   182             
       
   183             // Number type icon
       
   184             BubbleUtils::LayoutCustomElement(
       
   185                 iNumberType, 
       
   186                 rect, 
       
   187                 BubbleLayout2::popup_call2_audio_in_call_number_type_icon(6) );
       
   188 
       
   189             // Text line 1
       
   190             BubbleUtils::LayoutLabel( 
       
   191                 iTextLine1, 
       
   192                 rect, 
       
   193                 BubbleLayout2::popup_call2_audio_in_call_text_1(6) );
       
   194             
       
   195             // Text line 2
       
   196             BubbleUtils::LayoutLabel( 
       
   197                 iTextLine2, 
       
   198                 rect, 
       
   199                 BubbleLayout2::popup_call2_audio_in_call_text_2(6) );
       
   200 
       
   201             // Smaller rect for text if brand image exists
       
   202             if ( iBrandImage )
       
   203                 {
       
   204                 // Text line 3
       
   205                 BubbleUtils::LayoutLabel(
       
   206                     iTextLine3,
       
   207                     rect,
       
   208                     BubbleLayout2::popup_call2_audio_in_call_text_3(4) );
       
   209 
       
   210                 //Brand image
       
   211                 BubbleUtils::LayoutCustomElement(
       
   212             	    iBrandImage,
       
   213                     rect,
       
   214                     BubbleLayout2::popup_call2_audio_in_brand_image(2) );
       
   215                 }
       
   216             else
       
   217                 {
       
   218                 // Text line 3
       
   219                 BubbleUtils::LayoutLabel(
       
   220                     iTextLine3,
       
   221                     rect,
       
   222                     BubbleLayout2::popup_call2_audio_in_call_text_3(2) );
       
   223                 }
       
   224                 
       
   225             // Create call object bitmaps
       
   226             iBubble->SetRect( bubbleRect.Rect() );                
       
   227 
       
   228             BubbleUtils::PrepareBubbleImageL( 
       
   229                 iFrameId,
       
   230                 outerRect,
       
   231                 innerRect,
       
   232                 iBubble );
       
   233                 
       
   234             if ( iHeader->CallObjectImage()  &&
       
   235                  !iHeader->CallObjectText().Length() )
       
   236                 {
       
   237                 // Add transparency
       
   238                 BubbleUtils::AddTransparencyToBubbleImageL( 
       
   239                     KAknsIIDQsnFrCall2RectCoMask, // gradient tp mask
       
   240                     outerRect,
       
   241                     innerRect,
       
   242                     iBubble );                    
       
   243                 }                
       
   244             break;
       
   245             }
       
   246             
       
   247         case CBubbleManager::EActive:
       
   248         case CBubbleManager::EOnHold:
       
   249         case CBubbleManager::EDisconnected:
       
   250             {
       
   251             ///////////////////////////////////////////////////////////////////
       
   252             // First call layout. Three lines of text. Two calls.  
       
   253             ///////////////////////////////////////////////////////////////////
       
   254 
       
   255             TAknLayoutRect bubbleRect;
       
   256             bubbleRect.LayoutRect( 
       
   257                 rect, 
       
   258                 BubbleLayout2::popup_call2_audio_first_call_background(21) );
       
   259             
       
   260             TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() );
       
   261             TRect outerRect;
       
   262             TRect innerRect;
       
   263             BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, 
       
   264                                                        outerRect, 
       
   265                                                        innerRect);
       
   266         
       
   267             TAknsItemID coMaskFrameId;
       
   268             if ( callState == CBubbleManager::EOnHold )
       
   269                 {
       
   270                 iFrameId = KAknsIIDQsnFrCall2Bubble;
       
   271                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask;    
       
   272                 }
       
   273             else if ( callState == CBubbleManager::EDisconnected )
       
   274                 {
       
   275                 iFrameId = KAknsIIDQsnFrCall2BubbleFirstDisconn;
       
   276                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;            
       
   277                 }
       
   278             else
       
   279                 {
       
   280                 iFrameId = KAknsIIDQsnFrCall2BubbleFirst;
       
   281                 coMaskFrameId = KAknsIIDQsnFrCall2BubbleFirstCoMask;                
       
   282                 }                
       
   283             
       
   284             // for possible frame draw
       
   285             iOuterRect = outerRect;
       
   286             iOuterRect.Move( Rect().iTl );
       
   287             iInnerRect = innerRect;
       
   288             iInnerRect.Move( Rect().iTl );
       
   289 
       
   290             // Call icon
       
   291             BubbleUtils::LayoutCustomElement( 
       
   292                 iSmallCallIndication, 
       
   293                 rect,
       
   294                 BubbleLayout2::popup_call2_audio_first_call_status_icon(20) );
       
   295                 
       
   296             // Ciphering off
       
   297             BubbleUtils::LayoutControl( 
       
   298                 iCyphOffImage, 
       
   299                 rect,
       
   300                 BubbleLayout2::popup_call2_audio_first_call_window_ciphering_icon(17) );
       
   301             
       
   302             // Call type pane
       
   303             BubbleUtils::LayoutCallTypeIndicators(
       
   304                 rect,
       
   305                 BubbleLayout2::popup_call2_audio_first_call_type_icon(17),
       
   306                 iTypeIndication1,   // Data/Fax
       
   307                 iTypeIndication2 ); // ALS line 2               
       
   308 
       
   309             // Text line 1
       
   310             BubbleUtils::LayoutLabel( 
       
   311                 iTextLine1, 
       
   312                 rect, 
       
   313                 BubbleLayout2::popup_call2_audio_first_call_cli_text(23) );
       
   314             
       
   315             // Text line 2 - phone number
       
   316             BubbleUtils::LayoutLabel( 
       
   317                 iTextLine2, 
       
   318                 rect, 
       
   319                 BubbleLayout2::popup_call2_audio_first_call_number_text(19) );
       
   320             
       
   321             // Text line 2 - call state
       
   322             BubbleUtils::LayoutLabel( 
       
   323                 iTextLine3, 
       
   324                 rect, 
       
   325                 BubbleLayout2::popup_call2_audio_first_call_state_text(19) );
       
   326             
       
   327             // Text line 2 - call timer
       
   328             BubbleUtils::LayoutLabel( 
       
   329                 iTimerCost, 
       
   330                 rect, 
       
   331                 BubbleLayout2::popup_call2_audio_first_call_state_text(21) );
       
   332                 
       
   333             // Build call object bubble
       
   334             iBubble->SetRect( bubbleRect.Rect() );                                
       
   335 
       
   336             BubbleUtils::PrepareBubbleImageL( 
       
   337                 iFrameId,
       
   338                 outerRect,
       
   339                 innerRect,
       
   340                 iBubble );
       
   341             
       
   342             // Add transparency
       
   343             BubbleUtils::AddTransparencyToBubbleImageL( 
       
   344                 coMaskFrameId,
       
   345                 outerRect,
       
   346                 innerRect,
       
   347                 iBubble );
       
   348                 
       
   349             if ( iHeader->CallObjectImage() )
       
   350                 {
       
   351                 BubbleUtils::PrepareCallObjectImageL(
       
   352                     *iHeader,
       
   353                     iBubbleManager.CallObjectImageIncallSize() );
       
   354                 
       
   355                 TAknLayoutRect cliRect;
       
   356                 cliRect.LayoutRect( 
       
   357                     frameRect, 
       
   358                     BubbleLayout2::popup_call2_bubble_pane_graphics_cli() );
       
   359                     
       
   360                 // Combine image to bubble image
       
   361                 BubbleUtils::PrepareCallObjectToBubbleImageL(
       
   362                     iHeader->CallObjectImage(),
       
   363                     iHeader->CallObjectImageMask(),
       
   364                     cliRect.Rect(),
       
   365                     coMaskFrameId, // gradient image mask
       
   366                     outerRect,
       
   367                     innerRect,
       
   368                     iBubble );
       
   369                 }
       
   370                 
       
   371             break;
       
   372             }
       
   373             
       
   374         default:
       
   375             break;
       
   376         }
       
   377     }
       
   378 
       
   379 // ---------------------------------------------------------------------------
       
   380 // CBubbleOutlookMiddleCnap::GetCall1BubbleBitmaps
       
   381 // ---------------------------------------------------------------------------
       
   382 //    
       
   383 void CBubbleOutlookMiddleCnap::GetCall1BubbleBitmaps()
       
   384     {
       
   385     CBubbleManager::TPhoneCallState callState = iHeader->CallState();
       
   386     
       
   387     TInt bubblePicture = KErrNotFound;
       
   388     TInt bubblePictureMask = KErrNotFound;
       
   389     
       
   390     switch ( callState )
       
   391         {
       
   392         case CBubbleManager::EWaiting:
       
   393         case CBubbleManager::EIncoming:
       
   394             bubblePicture = EQgn_graf_call_rec_big_left;
       
   395             bubblePictureMask = EQgn_graf_call_rec_big_left_mask;
       
   396             break;
       
   397         case CBubbleManager::EActive:
       
   398             bubblePicture = EQgn_graf_call_two_active_emergency;
       
   399             bubblePictureMask = EQgn_graf_call_two_active_emergency_mask; 
       
   400             break;
       
   401         case CBubbleManager::EAlertToDisconnected:
       
   402         case CBubbleManager::EOnHold:
       
   403         case CBubbleManager::EDisconnected:
       
   404         case CBubbleManager::ENone:
       
   405         default:        
       
   406             bubblePicture = KErrNotFound;
       
   407             bubblePictureMask = KErrNotFound;
       
   408             break;
       
   409         }
       
   410 
       
   411     if ( bubblePicture != KErrNotFound )
       
   412         {
       
   413         if ( bubblePictureMask == KErrNotFound )
       
   414             {
       
   415             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   416                 iBubble, (TBMIcons) bubblePicture );
       
   417             }
       
   418         else
       
   419             {
       
   420             iBubbleManager.ImageManager().SetBitmapToImage( 
       
   421                 iBubble, 
       
   422                 (TBMIcons) bubblePicture , 
       
   423                 (TBMIcons) bubblePictureMask);
       
   424             }
       
   425         }
       
   426         
       
   427     }
       
   428 
       
   429 //  End of File