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