messagingappbase/smartmessaging/oplogobc/src/OperatorLogoOTAConv.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  
       
    15 *     Image conversion
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include    "OperatorLogoOTAConv.h"
       
    23 #include    <imageconversion.h>
       
    24 #include    <StringLoader.h>               // for StringLoader (iCoeEnv)
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // COperatorLogoOTAConv::COperatorLogoOTAConv
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 COperatorLogoOTAConv::COperatorLogoOTAConv() : 
       
    35     CActive( EPriorityNormal )
       
    36     {
       
    37     // Empty
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // COperatorLogoOTAConv::ConstructL
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void COperatorLogoOTAConv::ConstructL()
       
    46     {    
       
    47     CActiveScheduler::Add( this );    
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // COperatorLogoOTAConv::NewL
       
    52 // Two-phased constructor.
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 COperatorLogoOTAConv* COperatorLogoOTAConv::NewL()
       
    56     {
       
    57     COperatorLogoOTAConv* self = NewLC();
       
    58     CleanupStack::Pop();
       
    59 
       
    60     return self;
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // COperatorLogoOTAConv::NewLC
       
    65 // Two-phased constructor.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 COperatorLogoOTAConv* COperatorLogoOTAConv::NewLC()
       
    69     {
       
    70     COperatorLogoOTAConv* self = new( ELeave ) COperatorLogoOTAConv();
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL();
       
    73 
       
    74     return self;
       
    75     }
       
    76 
       
    77 
       
    78 // Destructor
       
    79 COperatorLogoOTAConv::~COperatorLogoOTAConv()
       
    80     {
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // COperatorLogoOTAConv::ConvertImageL
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void COperatorLogoOTAConv::ConvertImageL( const TDesC& aFile, CFbsBitmap& aBitmap )
       
    88     {
       
    89 
       
    90     CImageDecoder* decoder =  
       
    91         CImageDecoder::FileNewL( CCoeEnv::Static()->FsSession(), aFile, 
       
    92             CImageDecoder::EOptionNone, KImageTypeOTAUid, KNullUid, KNullUid );
       
    93     
       
    94     CleanupStack::PushL( decoder );
       
    95 
       
    96     TFrameInfo info( decoder->FrameInfo() );
       
    97 
       
    98     // Create the bitmap
       
    99     aBitmap.Create( info.iOverallSizeInPixels, info.iFrameDisplayMode );
       
   100 
       
   101     decoder->Convert( &iStatus, aBitmap );
       
   102     SetActive();
       
   103     StartWait();
       
   104     CleanupStack::PopAndDestroy(); // decoder
       
   105    
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // COperatorLogoOTAConv::StartWait
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 void COperatorLogoOTAConv::StartWait()
       
   113     {
       
   114     if( !iWait.IsStarted() )
       
   115         {
       
   116         iWait.Start();
       
   117         }
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // COperatorLogoOTAConv::StopWait
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void COperatorLogoOTAConv::StopWait()
       
   125     {
       
   126     if( iWait.IsStarted() )
       
   127         {
       
   128         iWait.AsyncStop();
       
   129         }
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // COperatorLogoOTAConv::RunL
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void COperatorLogoOTAConv::RunL()
       
   137     {
       
   138     StopWait();
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // COperatorLogoOTAConv::DoCancel()
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void COperatorLogoOTAConv::DoCancel()
       
   146     {
       
   147     }
       
   148 
       
   149 //  End of File