videoplayerapp/videoplayerengine/src/videoserviceview.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 12:53:14 +0300
changeset 24 7d93ee07fb27
parent 17 69946d1824c4
child 44 518105d52e45
permissions -rw-r--r--
Revision: 201019 Kit: 2010121

/*
* Copyright (c) 2009 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 VideoServiceView
*
*/

// Version : %version:  4 %

#include "videoservices.h"
#include "videoserviceview.h"
#include "videoplayerengine.h"
#include "mpxvideo_debug.h"

// -------------------------------------------------------------------------------------------------
// VideoServiceView()
// -------------------------------------------------------------------------------------------------
// 
VideoServiceView::VideoServiceView( VideoServices* parent, 
                                    QVideoPlayerEngine* engine, 
                                    QLatin1String service )
    : XQServiceProvider( service, parent )
    , mEngine( engine )
    , mServiceApp( parent )
{
    MPX_ENTER_EXIT(_L("VideoServiceView::VideoServiceView()"));    
    publishAll();
}

// -------------------------------------------------------------------------------------------------
// ~VideoServiceView()
// -------------------------------------------------------------------------------------------------
// 
VideoServiceView::~VideoServiceView()
{
    MPX_ENTER_EXIT(_L("VideoServiceView::~VideoServiceView()"));
}

// -------------------------------------------------------------------------------------------------
// setEngine()
// -------------------------------------------------------------------------------------------------
// 
void VideoServiceView::setEngine( QVideoPlayerEngine* engine )
{
    MPX_ENTER_EXIT(_L("VideoServiceView::setEngine()"));
	mEngine = engine;
}

// -------------------------------------------------------------------------------------------------
// view( QString )
// -------------------------------------------------------------------------------------------------
// 
bool VideoServiceView::view( QString file )
{
    MPX_ENTER_EXIT(_L("VideoServiceView::view( QString ) "),
                   _L("file = %s"), file.data() );
    
    if(mEngine)
    {
    	mServiceApp->setCurrentService(VideoServices::EView);
    	mEngine->playMedia( file );
    }
    
    return true;
}

// -------------------------------------------------------------------------------------------------
// view( XQSharableFile )
// -------------------------------------------------------------------------------------------------
// 
bool VideoServiceView::view( XQSharableFile file  )
{
    MPX_ENTER_EXIT(_L("VideoServiceView::view( XQSharableFile )"));
    
    RFile rFile;
    bool handleOK = file.getHandle( rFile );

    mServiceApp->setCurrentService(VideoServices::EView);
    
    if ( mEngine)
    {
        if ( handleOK )
        {            
            mEngine->playMedia( rFile );        
        }
        else
        {
            mEngine->playMedia( file.fileName() );    
        }
    }
       
	return true;
}