phoneuis/BubbleManager/Src/BMCallObjectManager.cpp
changeset 0 5f000ab63145
child 22 94dc1107e8b2
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  Call object loading.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include	<akniconconfig.h>
       
    22 #include    <AknsUtils.h>
       
    23 #include    "BMCallObjectManager.h"
       
    24 #include    "BMUtils.h"
       
    25 #include    "BMCallObjectUtils.h"
       
    26 #include    "BMPanic.h"
       
    27 #include    "BMMediaReaderFactory.h"
       
    28 #include    "BMMediaReaderInterface.h"
       
    29 #include    "BMBubbleImageManager.h"
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // LOCAL CONSTANTS AND MACROS
       
    36 const TInt KBMBubbleIdNone = -2;
       
    37 const TInt KBMCallTextAlphaValue = 128;
       
    38 
       
    39 // ============================ MEMBER FUNCTIONS ===============================
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CBubbleCallObjectManager::CBubbleCallObjectManager
       
    43 // C++ default constructor can NOT contain any code, that
       
    44 // might leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CBubbleCallObjectManager::CBubbleCallObjectManager( 
       
    48     CBubbleManager& aBubbleManager ) : iBubbleManager( aBubbleManager )
       
    49     {
       
    50     }
       
    51     
       
    52 // -----------------------------------------------------------------------------
       
    53 // CBubbleCallObjectManager::ConstructL
       
    54 // Symbian 2nd phase constructor can leave.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CBubbleCallObjectManager::ConstructL()
       
    58     {
       
    59     iIdleProcessor = CIdle::NewL( CActive::EPriorityIdle );
       
    60     iLoadingState = EBMLoaderReady;
       
    61     iBubbleId = KBMBubbleIdNone; 
       
    62     } 
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CBubbleCallObjectManager::NewL
       
    66 // Two-phased constructor.
       
    67 // -----------------------------------------------------------------------------
       
    68 //    
       
    69 CBubbleCallObjectManager* CBubbleCallObjectManager::NewL( 
       
    70     CBubbleManager& aBubbleManager )
       
    71     {
       
    72     CBubbleCallObjectManager* self = 
       
    73         new( ELeave ) CBubbleCallObjectManager( aBubbleManager );
       
    74     
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL( );
       
    77     CleanupStack::Pop( self );
       
    78 
       
    79     return self;    
       
    80     }
       
    81     
       
    82 // Destructor
       
    83 CBubbleCallObjectManager::~CBubbleCallObjectManager()
       
    84     {
       
    85     Reset();
       
    86 
       
    87     if ( iIdleProcessor )
       
    88         {
       
    89         iIdleProcessor->Cancel();            
       
    90         delete iIdleProcessor;
       
    91         }
       
    92     
       
    93     delete iCallThemeImageIcon;
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CBubbleCallObjectManager::Reset
       
    98 //
       
    99 // ---------------------------------------------------------------------------
       
   100 //    
       
   101 void CBubbleCallObjectManager::Reset()
       
   102     {
       
   103     iLoadingState = EBMLoaderReady;        
       
   104     iBubbleId = KBMBubbleIdNone;
       
   105     delete iMediaReader;
       
   106     iMediaReader = NULL;
       
   107     delete iCallText;
       
   108     iCallText = NULL;
       
   109     delete iCallImage;
       
   110     iCallImage = NULL;
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // CBubbleCallObjectManager::LoadImageFromFile
       
   115 //
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 void CBubbleCallObjectManager::LoadImageFromFile(
       
   119     const CBubbleManager::TBubbleId& aBubbleId,
       
   120     const TDesC& aFileName,
       
   121     const TImageLoadingParams& aParams )
       
   122     {
       
   123     if ( !aFileName.Length() )
       
   124         {
       
   125         return;            
       
   126         }
       
   127     
       
   128     if ( iLoadingState == EBMSuspended )
       
   129         {
       
   130         delete iCallImage;
       
   131         iCallImage = aFileName.Alloc();
       
   132         iImageLoadParams = aParams;
       
   133         iBubbleId = aBubbleId;
       
   134         return; // wait for resume
       
   135         }
       
   136     
       
   137     // queueing not supported, keep the existing
       
   138     if ( iLoadingState == EBMLoaderReady )
       
   139         {
       
   140         TRAPD( err, ReadFromFileL( aFileName, 
       
   141                                    aParams.iPreferredSize,
       
   142                                    aParams.iTinyImageSize ) );
       
   143         if ( err == KErrNone )
       
   144             {
       
   145             iLoadingState = EBMLoadingImage;
       
   146             delete iCallImage;
       
   147             iCallImage = aFileName.Alloc();
       
   148             iImageLoadParams = aParams;
       
   149             iBubbleId = aBubbleId;                                
       
   150             }    
       
   151         }
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CBubbleCallObjectManager::ReadFromFileL
       
   156 //
       
   157 // ---------------------------------------------------------------------------
       
   158 //    
       
   159 void CBubbleCallObjectManager::ReadFromFileL(
       
   160     const TDesC& aFileName,
       
   161     const TSize& aPreferredImageSize,
       
   162     const TSize& aTinyImageSize )
       
   163     {
       
   164     delete iMediaReader;
       
   165     iMediaReader = NULL;
       
   166     iMediaReader = BubbleMediaReaderFactory::CreateReaderL( aFileName );
       
   167     
       
   168     TSize sourceSize( iMediaReader->SourceSize() );
       
   169     
       
   170     TReal scaleFactor;
       
   171     TRect clipRect;
       
   172     TSize targetSize;
       
   173     if ( BubbleCallObjectUtils::GetScaleFactorAndClipRect(
       
   174              sourceSize,
       
   175              aPreferredImageSize,
       
   176              BubbleCallObjectUtils::EFillTarget,
       
   177              scaleFactor,
       
   178              clipRect ) &&
       
   179          aTinyImageSize != TSize(0,0) )
       
   180         {
       
   181         // Tiny image
       
   182         BubbleCallObjectUtils::GetScaleFactorAndClipRect(
       
   183              sourceSize,
       
   184              aTinyImageSize,
       
   185              BubbleCallObjectUtils::EMaximumFit,
       
   186              scaleFactor,
       
   187              clipRect );
       
   188         
       
   189         targetSize = aTinyImageSize;           
       
   190         }
       
   191     else
       
   192         {
       
   193         targetSize = aPreferredImageSize;    
       
   194         }        
       
   195     
       
   196     iMediaReader->StartReadingL( targetSize, 
       
   197                                  scaleFactor, 
       
   198                                  clipRect, 
       
   199                                  this );    
       
   200     }
       
   201 
       
   202 // ---------------------------------------------------------------------------
       
   203 // CBubbleCallObjectManager::LoadImageFromText
       
   204 //
       
   205 // ---------------------------------------------------------------------------
       
   206 //    
       
   207 void CBubbleCallObjectManager::LoadImageFromText(
       
   208     const CBubbleManager::TBubbleId& aBubbleId,
       
   209     const TDesC& aText,
       
   210     const TImageLoadingParams& aParams )
       
   211     {
       
   212     if ( !aText.Length() )
       
   213         {
       
   214         return;            
       
   215         }
       
   216         
       
   217     if ( iLoadingState == EBMSuspended )
       
   218         {
       
   219         delete iCallText;
       
   220         iCallText = aText.Alloc();    
       
   221         iImageLoadParams = aParams;
       
   222         iBubbleId = aBubbleId;
       
   223         return; // wait for resume
       
   224         }
       
   225     
       
   226     // queueing not supported, keep the existing
       
   227     if ( iLoadingState == EBMLoaderReady )    
       
   228         {
       
   229         delete iCallText;
       
   230         iCallText = aText.Alloc();        
       
   231         iBubbleId = aBubbleId;
       
   232         iImageLoadParams = aParams;
       
   233         TCallBack idleCallback( IdleProcessorCallback, this );
       
   234         iIdleProcessor->Cancel();
       
   235         iIdleProcessor->Start( idleCallback );
       
   236         iLoadingState = EBMLoadingText;    
       
   237         }
       
   238     }
       
   239 
       
   240 // ---------------------------------------------------------------------------
       
   241 // CBubbleCallObjectManager::CancelCallObjectLoading
       
   242 //
       
   243 // ---------------------------------------------------------------------------
       
   244 //    
       
   245 void CBubbleCallObjectManager::CancelCallObjectLoading( 
       
   246     const CBubbleManager::TBubbleId& aBubbleId )
       
   247     {
       
   248     if ( iLoadingState != EBMLoaderReady &&
       
   249          iBubbleId == aBubbleId )    
       
   250         {
       
   251         Reset();
       
   252         iIdleProcessor->Cancel();
       
   253         }
       
   254     }
       
   255     
       
   256 // ---------------------------------------------------------------------------
       
   257 // CBubbleCallObjectManager::Suspend
       
   258 //
       
   259 // ---------------------------------------------------------------------------
       
   260 //    
       
   261 void CBubbleCallObjectManager::Suspend()
       
   262     {
       
   263     if ( iLoadingState != EBMLoaderReady )
       
   264         {
       
   265         // Cancel image/text reading
       
   266         delete iMediaReader;
       
   267         iMediaReader = NULL;
       
   268         iIdleProcessor->Cancel();
       
   269         }
       
   270 
       
   271     // Set suspended state
       
   272     iLoadingState = EBMSuspended;
       
   273     }
       
   274     
       
   275 // ---------------------------------------------------------------------------
       
   276 // CBubbleCallObjectManager::Resume
       
   277 //
       
   278 // ---------------------------------------------------------------------------
       
   279 //    
       
   280 TInt CBubbleCallObjectManager::Resume()
       
   281     {
       
   282     TInt err = KErrNone;
       
   283     
       
   284     if ( iLoadingState == EBMSuspended )
       
   285         {
       
   286         TRAP( err, DoResumeL() );            
       
   287         }
       
   288         
       
   289     return err;        
       
   290     }
       
   291 
       
   292 // ---------------------------------------------------------------------------
       
   293 // CBubbleCallObjectManager::DoResumeL
       
   294 //
       
   295 // ---------------------------------------------------------------------------
       
   296 //    
       
   297 void CBubbleCallObjectManager::DoResumeL()
       
   298     {
       
   299     if ( iCallImage )    
       
   300         {
       
   301         CBubbleManager::TPhoneCallState callState =
       
   302                 iBubbleManager.CallState( iBubbleId );
       
   303         
       
   304         if ( callState < CBubbleManager::EIncoming &&
       
   305              iImageLoadParams.iThumbnailSize != TSize(0,0) )
       
   306             {
       
   307             // switch to incall image size
       
   308             iImageLoadParams.iPreferredSize = 
       
   309                 iImageLoadParams.iThumbnailSize;
       
   310             iImageLoadParams.iThumbnailSize = TSize(0,0);
       
   311             iImageLoadParams.iTinyImageSize = TSize(0,0);                   
       
   312             }
       
   313         
       
   314         ReadFromFileL( *iCallImage, 
       
   315                        iImageLoadParams.iPreferredSize,
       
   316                        iImageLoadParams.iTinyImageSize );
       
   317         
       
   318         iLoadingState = EBMLoadingImage;
       
   319         delete iCallImage;
       
   320         iCallImage = NULL;    
       
   321         }
       
   322     else if ( iCallText )        
       
   323         {
       
   324         TCallBack idleCallback( IdleProcessorCallback, this );
       
   325         iIdleProcessor->Cancel();
       
   326         iIdleProcessor->Start( idleCallback );
       
   327         iLoadingState = EBMLoadingText;    
       
   328         }
       
   329     else
       
   330         {
       
   331         Reset();    
       
   332         }        
       
   333     }
       
   334 
       
   335 // ---------------------------------------------------------------------------
       
   336 // CBubbleCallObjectManager::LoadCallThemeImage
       
   337 //
       
   338 // ---------------------------------------------------------------------------
       
   339 //            
       
   340 void CBubbleCallObjectManager::LoadCallThemeImage(
       
   341     CBubbleImageManager& aImageManager,    
       
   342     const TSize& aSize )
       
   343     {
       
   344     delete iCallThemeImageIcon;
       
   345     iCallThemeImageIcon = NULL;
       
   346     
       
   347     TRAPD( err, AllocateCallThemeImageIconL( aImageManager ) );
       
   348     if ( !err )
       
   349         {
       
   350         iCallThemeImageSize = aSize;
       
   351         
       
   352         if ( iLoadingState == EBMLoaderReady )    
       
   353             {
       
   354             TCallBack idleCallback( IdleProcessorCallback, this );
       
   355             iIdleProcessor->Cancel();
       
   356             iIdleProcessor->Start( idleCallback );
       
   357             iLoadingState = EBMInitializingIcon;
       
   358             }
       
   359         }
       
   360     }
       
   361 
       
   362 // ---------------------------------------------------------------------------
       
   363 // CBubbleCallObjectManager::AllocateCallThemeImageIconL
       
   364 //
       
   365 // ---------------------------------------------------------------------------
       
   366 //
       
   367 void CBubbleCallObjectManager::AllocateCallThemeImageIconL( 
       
   368         CBubbleImageManager& aImageManager )
       
   369     {
       
   370     CEikImage* themeImage = new( ELeave ) CEikImage;
       
   371     CleanupStack::PushL( themeImage );
       
   372     aImageManager.SetBitmapToImage( themeImage,
       
   373                                     EQgn_graf_call_image_1,
       
   374                                     EQgn_graf_call_image_1_mask );
       
   375 
       
   376     if ( themeImage->Bitmap() )
       
   377         {
       
   378         iCallThemeImageIcon = CGulIcon::NewL( 
       
   379                     const_cast<CFbsBitmap*> (themeImage->Bitmap()), 
       
   380                     const_cast<CFbsBitmap*> (themeImage->Mask()));
       
   381         }
       
   382     themeImage->SetPictureOwnedExternally( ETrue );
       
   383     CleanupStack::PopAndDestroy( themeImage );
       
   384     }
       
   385 
       
   386 // ---------------------------------------------------------------------------
       
   387 // CBubbleCallObjectManager::ReleaseCallThemeImage
       
   388 //
       
   389 // ---------------------------------------------------------------------------
       
   390 //
       
   391 void CBubbleCallObjectManager::ReleaseCallThemeImage()
       
   392     {
       
   393     delete iCallThemeImageIcon;
       
   394     iCallThemeImageIcon = NULL;
       
   395     }
       
   396 
       
   397 // ---------------------------------------------------------------------------
       
   398 // CBubbleCallObjectManager::ResizeCallThemeImage
       
   399 //
       
   400 // ---------------------------------------------------------------------------
       
   401 //
       
   402 void CBubbleCallObjectManager::ResizeCallThemeImage( const TSize& aSize )
       
   403     {
       
   404     iCallThemeImageSize = aSize;
       
   405     AknIconUtils::SetSize( iCallThemeImageIcon->Bitmap(),
       
   406                            iCallThemeImageSize,
       
   407                            EAspectRatioPreservedSlice );
       
   408     }
       
   409 
       
   410 // ---------------------------------------------------------------------------
       
   411 // CBubbleCallObjectManager::CallThemeImageIcon
       
   412 //
       
   413 // ---------------------------------------------------------------------------
       
   414 //
       
   415 CGulIcon* CBubbleCallObjectManager::CallThemeImageIcon()
       
   416     {
       
   417     return iCallThemeImageIcon;
       
   418     }
       
   419 
       
   420 // ---------------------------------------------------------------------------
       
   421 // CBubbleCallObjectManager::IdleProcessorCallback
       
   422 //
       
   423 // ---------------------------------------------------------------------------
       
   424 //     
       
   425 TInt CBubbleCallObjectManager::IdleProcessorCallback( TAny* aThis )
       
   426     {
       
   427     __ASSERT_ALWAYS( aThis, 
       
   428                      Panic( EBMPanicCallObjectManager ) );
       
   429                      
       
   430     CBubbleCallObjectManager* self = 
       
   431             static_cast<CBubbleCallObjectManager*>( aThis );
       
   432     
       
   433     TLoadingState state = self->iLoadingState;
       
   434     
       
   435     if ( state == EBMLoadingText )
       
   436         {
       
   437         TRAP_IGNORE( self->DoLoadImageInIdleL() );    
       
   438         }
       
   439     else if ( state == EBMInitializingIcon )
       
   440         {
       
   441         self->DoInitializeIcons();
       
   442         }
       
   443     else if ( state == EBMDeleting )        
       
   444         {
       
   445         self->DoDeleteReaderInIdle();
       
   446         }
       
   447     
       
   448     return KErrNone;        
       
   449     }
       
   450 
       
   451 // ---------------------------------------------------------------------------
       
   452 // CBubbleCallObjectManager::DoLoadImageInIdleL
       
   453 //
       
   454 // ---------------------------------------------------------------------------
       
   455 //
       
   456 void CBubbleCallObjectManager::DoLoadImageInIdleL()
       
   457     {
       
   458     if ( iLoadingState == EBMLoadingText && iCallText )
       
   459         {
       
   460         AknIconConfig::TPreferredDisplayMode mode;
       
   461         AknIconConfig::PreferredDisplayMode( mode, 
       
   462                                              AknIconConfig::EImageTypeIcon);
       
   463         
       
   464         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   465         TRgb skinColor;
       
   466         User::LeaveIfError( AknsUtils::GetCachedColor( 
       
   467                             skin, 
       
   468                             skinColor, 
       
   469                             KAknsIIDQsnTextColors,
       
   470                             EAknsCIQsnTextColorsCG51 ) );            
       
   471         
       
   472         CFbsBitmap* bitmap = NULL;
       
   473         CFbsBitmap* mask = NULL;
       
   474         
       
   475         BubbleCallObjectUtils::CreateImageBitmapsFromTextLC( 
       
   476             *iCallText, 
       
   477             iBubbleManager.Rect(),
       
   478             iImageLoadParams.iPreferredSize,
       
   479             skinColor,  // text color
       
   480             KBMCallTextAlphaValue, // semitransparent
       
   481             mode.iBitmapMode,
       
   482             bitmap,
       
   483             mask );
       
   484         CleanupStack::Pop(2); // bitmap, mask
       
   485                 
       
   486         iBubbleManager.StartChanges();
       
   487         iBubbleManager.SetCallObjectImage( iBubbleId,
       
   488                                            bitmap,
       
   489                                            mask,
       
   490                                            ETrue );
       
   491         iBubbleManager.EndChanges();
       
   492             
       
   493         delete iCallText;
       
   494         iCallText = NULL;                
       
   495         }
       
   496     
       
   497     iLoadingState = EBMLoaderReady;        
       
   498     iBubbleId = KBMBubbleIdNone;
       
   499     }
       
   500 
       
   501 // ---------------------------------------------------------------------------
       
   502 // CBubbleCallObjectManager::DoDeleteReaderInIdle
       
   503 //
       
   504 // ---------------------------------------------------------------------------
       
   505 //    
       
   506 void CBubbleCallObjectManager::DoDeleteReaderInIdle()
       
   507     {
       
   508     Reset();
       
   509     }
       
   510 
       
   511 // ---------------------------------------------------------------------------
       
   512 // CBubbleCallObjectManager::DoInitializeIcons
       
   513 //
       
   514 // ---------------------------------------------------------------------------
       
   515 //
       
   516 void CBubbleCallObjectManager::DoInitializeIcons()
       
   517     {
       
   518     AknIconUtils::ExcludeFromCache( iCallThemeImageIcon->Bitmap() );
       
   519     AknIconUtils::SetSize( iCallThemeImageIcon->Bitmap(),
       
   520                            iCallThemeImageSize,
       
   521                            EAspectRatioPreservedSlice );
       
   522     iLoadingState = EBMLoaderReady;
       
   523     }
       
   524 
       
   525 // ---------------------------------------------------------------------------
       
   526 // CBubbleCallObjectManager::FrameBufferDataChanged
       
   527 //
       
   528 // ---------------------------------------------------------------------------
       
   529 //    
       
   530 void CBubbleCallObjectManager::FrameBufferDataChanged()
       
   531     {
       
   532     TRAPD( err, DoHandleFrameBufferDataL() );
       
   533     
       
   534     if ( err != KErrNone )
       
   535         {
       
   536         TCallBack idleCallback( IdleProcessorCallback, this );
       
   537         iIdleProcessor->Cancel();
       
   538         iIdleProcessor->Start( idleCallback );
       
   539         iLoadingState = EBMDeleting;    
       
   540         }
       
   541     }
       
   542 
       
   543 // ---------------------------------------------------------------------------
       
   544 // CBubbleCallObjectManager::SetCallObjectImageL
       
   545 //
       
   546 // ---------------------------------------------------------------------------
       
   547 //     
       
   548 void CBubbleCallObjectManager::DoHandleFrameBufferDataL()
       
   549     {
       
   550     const CFbsBitmap* bitmap = iMediaReader->FrameBuffer();
       
   551     const CFbsBitmap* mask = iMediaReader->Mask();
       
   552     
       
   553     if ( bitmap )
       
   554         {
       
   555         CBubbleManager::TPhoneCallState callState =
       
   556             iBubbleManager.CallState( iBubbleId );
       
   557 
       
   558         // copy the current frame
       
   559         CFbsBitmap* d_bitmap = new( ELeave ) CFbsBitmap;
       
   560         CleanupStack::PushL( d_bitmap );
       
   561         User::LeaveIfError( d_bitmap->Duplicate( bitmap->Handle() ) );
       
   562             
       
   563         CFbsBitmap* d_mask = NULL;
       
   564         if ( mask )
       
   565             {
       
   566             d_mask = new( ELeave ) CFbsBitmap;
       
   567             CleanupStack::PushL( d_mask );
       
   568             User::LeaveIfError( d_mask->Duplicate( mask->Handle() ) );    
       
   569             CleanupStack::Pop( d_mask );
       
   570             }
       
   571         CleanupStack::Pop( d_bitmap );
       
   572             
       
   573         // assign the copy to call header.
       
   574         if ( ( iLoadingState == EBMLoadingThumbnail ) &&
       
   575              ( callState > CBubbleManager::EActive ) )
       
   576             {
       
   577             // displaying fullscreen image, set as thumbnail
       
   578             iBubbleManager.SetThumbnail( iBubbleId,
       
   579                                          d_bitmap,
       
   580                                          d_mask,
       
   581                                          ETrue ); // Ownership transfer
       
   582             }
       
   583         else
       
   584             {
       
   585             iBubbleManager.StartChanges();
       
   586             iBubbleManager.SetCallObjectImage( iBubbleId,
       
   587                                                d_bitmap,
       
   588                                                d_mask,
       
   589                                                ETrue ); // Ownership transfer
       
   590             iBubbleManager.EndChanges();
       
   591             }            
       
   592    
       
   593         }
       
   594     
       
   595     // Delete media reader
       
   596     iBubbleId = KBMBubbleIdNone;
       
   597     TCallBack idleCallback( IdleProcessorCallback, this );
       
   598     iIdleProcessor->Cancel();
       
   599     iIdleProcessor->Start( idleCallback );
       
   600     iLoadingState = EBMDeleting;         
       
   601     }
       
   602 
       
   603 // ---------------------------------------------------------------------------
       
   604 // CBubbleCallObjectManager::LoadThumbnailVersion
       
   605 //
       
   606 // ---------------------------------------------------------------------------
       
   607 //
       
   608 TBool CBubbleCallObjectManager::LoadThumbnailVersion()
       
   609     {
       
   610     TSize sourceSize( iMediaReader->SourceSize() );
       
   611     TReal scaleFactor;
       
   612     TRect clipRect;
       
   613     TBool isTiny = BubbleCallObjectUtils::GetScaleFactorAndClipRect(
       
   614         sourceSize,
       
   615         iImageLoadParams.iThumbnailSize,
       
   616         BubbleCallObjectUtils::EFillTarget,
       
   617         scaleFactor,
       
   618         clipRect );
       
   619             
       
   620     if ( !isTiny )
       
   621         {
       
   622         // scale image to thumbnail version
       
   623         iMediaReader->SetScaleAndClip( iImageLoadParams.iThumbnailSize, 
       
   624                                        scaleFactor,
       
   625                                        clipRect );
       
   626         return ETrue;            
       
   627         }
       
   628     else
       
   629         {
       
   630         // image is smaller than thumnail size
       
   631         return EFalse;            
       
   632         }                    
       
   633     }
       
   634 
       
   635 // ---------------------------------------------------------------------------
       
   636 // CBubbleCallObjectManager::ReaderError
       
   637 //
       
   638 // ---------------------------------------------------------------------------
       
   639 // 
       
   640 void CBubbleCallObjectManager::ReaderError( TInt /*aError*/ )
       
   641     {
       
   642     TCallBack idleCallback( IdleProcessorCallback, this );
       
   643     iIdleProcessor->Cancel();
       
   644     iIdleProcessor->Start( idleCallback );
       
   645     iLoadingState = EBMDeleting;
       
   646     }    
       
   647 
       
   648 //  End of File