javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationratecontrol.cpp
branchRCL_3
changeset 24 0fd27995241b
child 26 dc7c549001d5
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     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 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDE FILES
       
    20 #include <logger.h>
       
    21 #include <e32base.h>
       
    22 
       
    23 #include "cmmaanimationratecontrol.h"
       
    24 #include "cmmaanimationplayer.h"
       
    25 
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CMMAAnimationRateControl::NewL
       
    29 // Two-phased constructor.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CMMAAnimationRateControl* CMMAAnimationRateControl::NewL(CMMAAnimationPlayer* aPlayer)
       
    33 {
       
    34     CMMAAnimationRateControl* self = new(ELeave) CMMAAnimationRateControl(aPlayer);
       
    35     CleanupStack::PushL(self);
       
    36     self->ConstructL();
       
    37     CleanupStack::Pop();
       
    38     return self;
       
    39 }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CMMAAnimationRateControl::CMMAAnimationRateControl
       
    43 // C++ default constructor can NOT contain any code, that
       
    44 // might leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CMMAAnimationRateControl::CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer)
       
    48 {
       
    49     LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::CMMAAnimationRateControl");
       
    50     iPlayer = aPlayer;
       
    51 }
       
    52 
       
    53 // Destructor
       
    54 CMMAAnimationRateControl::~CMMAAnimationRateControl()
       
    55 {
       
    56     LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::~CMMAAnimationRateControl");
       
    57 }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CMMAAnimationRateControl::ConstructL
       
    61 // Symbian 2nd phase constructor can leave.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 void CMMAAnimationRateControl::ConstructL()
       
    65 {
       
    66     LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::ConstructL");
       
    67     iPlayer->SetRateL(KMMADefaultRate);
       
    68 }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CMMAAnimationRateControl::SetRateL
       
    72 // Set rate to minimum or default rate depending on parameter. Informs player
       
    73 // that rate has changed. Returns set rate.
       
    74 // (other items were commented in a header).
       
    75 // -----------------------------------------------------------------------------
       
    76 TInt CMMAAnimationRateControl::SetRateL(TInt aRate)
       
    77 {
       
    78     LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::SetRateL");
       
    79     TInt rate = aRate;
       
    80 
       
    81     if (rate <= KMMAMinRate)
       
    82     {
       
    83         rate = KMMAMinRate;
       
    84     }
       
    85     else
       
    86     {
       
    87         rate = KMMADefaultRate;
       
    88     }
       
    89     return iPlayer->SetRateL(rate);
       
    90 }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CMMAAnimationRateControl::RateL
       
    94 // Returns current rate.
       
    95 //
       
    96 // (other items were commented in a header).
       
    97 // -----------------------------------------------------------------------------
       
    98 TInt CMMAAnimationRateControl::RateL()
       
    99 {
       
   100     LOG( EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::RateL");
       
   101     return iPlayer->RateL();
       
   102 }
       
   103 
       
   104 //  END OF FILE