photosgallery/slideshow/view/src/shwviewtimer.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:    The pause handling control for the slideshow
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <glxlog.h>
       
    21 #include <glxtracer.h>
       
    22 #include "shwviewtimer.h"
       
    23 #include "shwtickobserver.h"
       
    24 
       
    25 //for converting values in second to microsecond
       
    26 const TInt KMicroMultiplier = 1000000;
       
    27 	
       
    28 // -----------------------------------------------------------------------------
       
    29 // HandleGestureL.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CShwTicker* CShwTicker::NewL(MShwTickObserver& aObserver)
       
    33 	{
       
    34 	TRACER("CShwTicker::NewL");
       
    35 	GLX_LOG_INFO("CShwTicker::NewL");
       
    36 	CShwTicker* self = new(ELeave) CShwTicker(aObserver);
       
    37 	CleanupStack::PushL(self);
       
    38 	self->ConstructL();
       
    39 	CleanupStack::Pop(self);
       
    40 	return self;
       
    41 	}
       
    42 	
       
    43 // -----------------------------------------------------------------------------
       
    44 // HandleGestureL.
       
    45 // -----------------------------------------------------------------------------
       
    46 //	
       
    47 void CShwTicker::StartTicking(TInt aAfter)
       
    48 	{
       
    49 	TRACER("CShwTicker::StartTicking");
       
    50 	GLX_LOG_INFO("CShwTicker::StartTicking");
       
    51 	Cancel();
       
    52 	iTimer.After( iStatus,(aAfter * KMicroMultiplier) );
       
    53 	SetActive();
       
    54 	}
       
    55 	
       
    56 // -----------------------------------------------------------------------------
       
    57 // HandleGestureL.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 void CShwTicker::CancelTicking()
       
    61 	{
       
    62 	TRACER("CShwTicker::CancelTicking");
       
    63 	GLX_LOG_INFO("CShwTicker::CancelTicking");
       
    64 	Cancel();
       
    65 	iObserver.HandleTickCancelled();
       
    66 	}
       
    67 	
       
    68 // -----------------------------------------------------------------------------
       
    69 // HandleGestureL.
       
    70 // -----------------------------------------------------------------------------
       
    71 //	
       
    72 void CShwTicker::RunL()
       
    73 	{
       
    74 	TRACER("CShwTicker::RunL");
       
    75 	GLX_LOG_INFO("CShwTicker::RunL");
       
    76 	iObserver.HandleTickL();
       
    77 	}
       
    78 	
       
    79 // -----------------------------------------------------------------------------
       
    80 // HandleGestureL.
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CShwTicker::DoCancel()
       
    84 	{
       
    85 	TRACER("CShwTicker::DoCancel");
       
    86 	GLX_LOG_INFO("CShwTicker::DoCancel");
       
    87 	//Cancel the RTimer
       
    88 	iTimer.Cancel();
       
    89 	}
       
    90 	
       
    91 // -----------------------------------------------------------------------------
       
    92 // HandleGestureL.
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CShwTicker::ConstructL()
       
    96 	{
       
    97 	TRACER("CShwTicker::ConstructL");
       
    98 	GLX_LOG_INFO("CShwTicker::ConstructL");
       
    99 	iTimer.CreateLocal();
       
   100 	}
       
   101 	
       
   102 // -----------------------------------------------------------------------------
       
   103 // HandleGestureL.
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 CShwTicker::CShwTicker(MShwTickObserver& aObserver) : CActive(EPriorityStandard) , 
       
   107 						iObserver(aObserver)
       
   108 	
       
   109 	{
       
   110 	TRACER("CShwTicker::CShwTicker");
       
   111 	GLX_LOG_INFO("CShwTicker::CShwTicker");
       
   112 	CActiveScheduler::Add(this);
       
   113 	}
       
   114 	
       
   115 // -----------------------------------------------------------------------------
       
   116 // HandleGestureL.
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 CShwTicker::~CShwTicker()
       
   120 	{
       
   121 	TRACER("CShwTicker::~CShwTicker");
       
   122 	GLX_LOG_INFO("CShwTicker::~CShwTicker");
       
   123 	Cancel();
       
   124 	iTimer.Close();
       
   125 	}