diff -r e52958d06c29 -r 5fd161fa28b6 svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTProgressBarTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtviewer/SvgtViewerPlugin/UIControlSrc/SVGTProgressBarTimer.cpp Thu Sep 09 11:17:40 2010 +0300 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2004,2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This file implements the timer functionality required for the +* progress time functionality in the dialog. +* +*/ + + +// User Includes +#include "SVGTProgressBarTimer.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::CSVGTProgressBarTimer +// Default Constructor. Initialises Timer State Variables. +// ----------------------------------------------------------------------------- +// +CSVGTProgressBarTimer::CSVGTProgressBarTimer(MSVGTProgressBarListener* + aListener , TBool aResetInactivityTime ) : + CTimer( CActive::EPriorityHigh ), iListener( aListener ), + iUseInactivityTime( aResetInactivityTime ) + { + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::ConstructL +// Second Phase Constructor for CSVGTProgressBarTimer. Adds this object to the +// applications active scheduler. +// ----------------------------------------------------------------------------- +// +void CSVGTProgressBarTimer::ConstructL() + { + // Call the base class ConstructL + CTimer::ConstructL(); + // Add to active scheduler + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::NewLC +// Factory function for creating CSVGTProgressBarTimer objects.It also pushes the +// created dialog object onto the cleanup stack. +// Returns: CSVGTProgressBarTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewLC( MSVGTProgressBarListener* + aListener , + TBool aResetInactivityTime ) // Listener for timer tick event + { + CSVGTProgressBarTimer* self = new ( ELeave ) CSVGTProgressBarTimer( + aListener , aResetInactivityTime ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::NewL +// Factory function for creating CSVGTProgressBarTimer objects. +// Returns: CSVGTProgressBarTimer* ; Pointer to the created object. +// Leaves if error occurs during creation. +// ----------------------------------------------------------------------------- +// +CSVGTProgressBarTimer* CSVGTProgressBarTimer::NewL( MSVGTProgressBarListener* + aListener , + TBool aResetInactivityTime ) // Listener for timer tick event + { + CSVGTProgressBarTimer* self = NewLC( aListener , aResetInactivityTime ); + CleanupStack::Pop( self ); + return self; + } + + +// Destructor +CSVGTProgressBarTimer::~CSVGTProgressBarTimer() + { + // Reset the listener + iListener = NULL; + // Cancel any pending timer events if any. + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::DoCancel +// Reimplements CActive::DoCancel. +// ----------------------------------------------------------------------------- +// +void CSVGTProgressBarTimer::DoCancel() + { + CTimer::DoCancel(); + } + +// ----------------------------------------------------------------------------- +// CSVGTProgressBarTimer::RunL +// Reimplements CActive::RunL. This function updates the media time. +// ----------------------------------------------------------------------------- +// +void CSVGTProgressBarTimer::RunL() + { + if ( iUseInactivityTime ) + { + User::ResetInactivityTime(); + } + + // CallBack listener + if ( iListener ) + { + iListener->UpdateProgressBar(); + } + } + +// End of File