videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolbar.cpp
author hgs
Mon, 20 Sep 2010 18:25:37 +0300
changeset 63 4707a0db12f6
parent 58 d2b028fd1f7d
permissions -rw-r--r--
201037

/*
* Copyright (c) 2010 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:  Implementation of VideoPlaybackControlBar
*
*/

// Version : %version:  10 %



#include "mpxvideo_debug.h"
#include "videoplaybacktoolbar.h"
#include "videoplaybackcontrolbar.h"
#include "videoplaybackprogressbar.h"
#include "mpxcommonvideoplaybackview.hrh"
#include "videoplaybackcontrolscontroller.h"


// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::VideoPlaybackControlBar()
// -------------------------------------------------------------------------------------------------
//
VideoPlaybackControlBar::VideoPlaybackControlBar(
        VideoPlaybackControlsController* controller )
    : mController( controller )
{
    MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::VideoPlaybackControlBar"));

    //
    // create toolbar handler
    //
    mToolBar = new VideoPlaybackToolBar( mController );

    //
    // create progressbar handler
    //
    mProgressBar = new VideoPlaybackProgressBar( mController );
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::~VideoPlaybackControlBar()
// -------------------------------------------------------------------------------------------------
//
VideoPlaybackControlBar::~VideoPlaybackControlBar()
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::~VideoPlaybackControlBar()"));

    if ( mProgressBar )
    {
        delete mProgressBar;
        mProgressBar = NULL;
    }

    if ( mToolBar )
    {
        delete mToolBar;
        mToolBar = NULL;
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::initialize()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::initialize()
{
    MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::initialize()"));

    if ( mProgressBar )
    {
        mProgressBar->initialize();
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::updateState()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::updateState( TMPXPlaybackState state )
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::updateState() state = %d"), state );

    if ( mToolBar )
    {
        mToolBar->updateState( state );
    }

    if ( mProgressBar )
    {
        mProgressBar->updateState( state );
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::aspectRatioChanged()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::aspectRatioChanged( int aspectRatio )
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );

    if ( mToolBar )
    {
        mToolBar->aspectRatioChanged( aspectRatio );
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::updateWithFileDetails()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::updateWithFileDetails(
        VideoPlaybackViewFileDetails* details )
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::updateWithFileDetails()"));

    if ( mToolBar )
    {
        mToolBar->updateWithFileDetails( details );
    }

    if ( mProgressBar )
    {
        mProgressBar->updateWithFileDetails( details );
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::setVisibleToControlBar()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::setVisibleToControlBar( bool visible )
{
    MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::setVisibleToControlBar()"),
                   _L("visible = %d"), visible );

    setVisible( visible );
    mToolBar->setVisible( visible );
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::durationChanged()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::durationChanged( int duration )
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::durationChanged()"));

    if ( mProgressBar )
    {
        mProgressBar->durationChanged( duration );
    }

    if ( mToolBar )
    {
        mToolBar->durationChanged( duration );
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::positionChanged()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::positionChanged( int position )
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::positionChanged()"));

    if ( mProgressBar )
    {
        mProgressBar->positionChanged( position );
    }

    if ( mToolBar )
    {
        mToolBar->positionChanged( position );
    }
}

// -------------------------------------------------------------------------------------------------
// VideoPlaybackControlBar::resetControl()
// -------------------------------------------------------------------------------------------------
//
void VideoPlaybackControlBar::resetControl()
{
    MPX_DEBUG(_L("VideoPlaybackControlBar::positionChanged()"));

    if ( mProgressBar )
    {
        mProgressBar->resetControl();
    }

    if ( mToolBar )
    {
        mToolBar->resetControl();
    }
}

//End of file