videoplayerapp/videoplayerengine/src/videoserviceview.cpp
changeset 36 8aed59de29f9
child 24 7d93ee07fb27
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Implementation of VideoServiceView
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  3 %
       
    19 
       
    20 #include "videoservices.h"
       
    21 #include "videoserviceview.h"
       
    22 #include "videoplayerengine.h"
       
    23 #include "mpxvideo_debug.h"
       
    24 
       
    25 // -------------------------------------------------------------------------------------------------
       
    26 // VideoServiceView()
       
    27 // -------------------------------------------------------------------------------------------------
       
    28 // 
       
    29 VideoServiceView::VideoServiceView( VideoServices* parent, QVideoPlayerEngine* engine )
       
    30     : XQServiceProvider( QLatin1String("com.nokia.Videos.com.nokia.symbian.IFileView"), parent )
       
    31     , mEngine( engine )
       
    32     , mServiceApp( parent )
       
    33 {
       
    34     MPX_ENTER_EXIT(_L("VideoServiceView::VideoServiceView()"));    
       
    35     publishAll();
       
    36 }
       
    37 
       
    38 // -------------------------------------------------------------------------------------------------
       
    39 // ~VideoServiceView()
       
    40 // -------------------------------------------------------------------------------------------------
       
    41 // 
       
    42 VideoServiceView::~VideoServiceView()
       
    43 {
       
    44     MPX_ENTER_EXIT(_L("VideoServiceView::~VideoServiceView()"));
       
    45 }
       
    46 
       
    47 // -------------------------------------------------------------------------------------------------
       
    48 // setEngine()
       
    49 // -------------------------------------------------------------------------------------------------
       
    50 // 
       
    51 void VideoServiceView::setEngine( QVideoPlayerEngine* engine )
       
    52 {
       
    53     MPX_ENTER_EXIT(_L("VideoServiceView::setEngine()"));
       
    54 	mEngine = engine;
       
    55 }
       
    56 
       
    57 // -------------------------------------------------------------------------------------------------
       
    58 // view( QString )
       
    59 // -------------------------------------------------------------------------------------------------
       
    60 // 
       
    61 bool VideoServiceView::view( QString file )
       
    62 {
       
    63     MPX_ENTER_EXIT(_L("VideoServiceView::view( QString ) "),
       
    64                    _L("file = %s"), file.data() );
       
    65     
       
    66     if(mEngine)
       
    67     {
       
    68     	mServiceApp->setCurrentService(VideoServices::EView);
       
    69     	mEngine->playMedia( file );
       
    70     }
       
    71     
       
    72     return true;
       
    73 }
       
    74 
       
    75 // -------------------------------------------------------------------------------------------------
       
    76 // view( XQSharableFile )
       
    77 // -------------------------------------------------------------------------------------------------
       
    78 // 
       
    79 bool VideoServiceView::view( XQSharableFile file  )
       
    80 {
       
    81     MPX_ENTER_EXIT(_L("VideoServiceView::view( XQSharableFile )"));
       
    82     
       
    83     RFile rFile;
       
    84     bool handleOK = file.getHandle( rFile );
       
    85 
       
    86     mServiceApp->setCurrentService(VideoServices::EView);
       
    87     
       
    88     if ( mEngine)
       
    89     {
       
    90         if ( handleOK )
       
    91         {            
       
    92             mEngine->playMedia( rFile );        
       
    93         }
       
    94         else
       
    95         {
       
    96             mEngine->playMedia( file.fileName() );    
       
    97         }
       
    98     }
       
    99        
       
   100 	return true;
       
   101 }
       
   102 
       
   103 
       
   104 
       
   105