videoplayerapp/videoplayerengine/src/videoserviceview.cpp
author hgs
Fri, 30 Apr 2010 09:52:11 +0300
changeset 37 4eb2df7f7cbe
parent 36 8aed59de29f9
child 24 7d93ee07fb27
permissions -rw-r--r--
201017
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Implementation of VideoServiceView
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// Version : %version:  3 %
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include "videoservices.h"
hgs
parents:
diff changeset
    21
#include "videoserviceview.h"
hgs
parents:
diff changeset
    22
#include "videoplayerengine.h"
hgs
parents:
diff changeset
    23
#include "mpxvideo_debug.h"
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    26
// VideoServiceView()
hgs
parents:
diff changeset
    27
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    28
// 
hgs
parents:
diff changeset
    29
VideoServiceView::VideoServiceView( VideoServices* parent, QVideoPlayerEngine* engine )
hgs
parents:
diff changeset
    30
    : XQServiceProvider( QLatin1String("com.nokia.Videos.com.nokia.symbian.IFileView"), parent )
hgs
parents:
diff changeset
    31
    , mEngine( engine )
hgs
parents:
diff changeset
    32
    , mServiceApp( parent )
hgs
parents:
diff changeset
    33
{
hgs
parents:
diff changeset
    34
    MPX_ENTER_EXIT(_L("VideoServiceView::VideoServiceView()"));    
hgs
parents:
diff changeset
    35
    publishAll();
hgs
parents:
diff changeset
    36
}
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    39
// ~VideoServiceView()
hgs
parents:
diff changeset
    40
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    41
// 
hgs
parents:
diff changeset
    42
VideoServiceView::~VideoServiceView()
hgs
parents:
diff changeset
    43
{
hgs
parents:
diff changeset
    44
    MPX_ENTER_EXIT(_L("VideoServiceView::~VideoServiceView()"));
hgs
parents:
diff changeset
    45
}
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    48
// setEngine()
hgs
parents:
diff changeset
    49
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    50
// 
hgs
parents:
diff changeset
    51
void VideoServiceView::setEngine( QVideoPlayerEngine* engine )
hgs
parents:
diff changeset
    52
{
hgs
parents:
diff changeset
    53
    MPX_ENTER_EXIT(_L("VideoServiceView::setEngine()"));
hgs
parents:
diff changeset
    54
	mEngine = engine;
hgs
parents:
diff changeset
    55
}
hgs
parents:
diff changeset
    56
hgs
parents:
diff changeset
    57
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    58
// view( QString )
hgs
parents:
diff changeset
    59
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    60
// 
hgs
parents:
diff changeset
    61
bool VideoServiceView::view( QString file )
hgs
parents:
diff changeset
    62
{
hgs
parents:
diff changeset
    63
    MPX_ENTER_EXIT(_L("VideoServiceView::view( QString ) "),
hgs
parents:
diff changeset
    64
                   _L("file = %s"), file.data() );
hgs
parents:
diff changeset
    65
    
hgs
parents:
diff changeset
    66
    if(mEngine)
hgs
parents:
diff changeset
    67
    {
hgs
parents:
diff changeset
    68
    	mServiceApp->setCurrentService(VideoServices::EView);
hgs
parents:
diff changeset
    69
    	mEngine->playMedia( file );
hgs
parents:
diff changeset
    70
    }
hgs
parents:
diff changeset
    71
    
hgs
parents:
diff changeset
    72
    return true;
hgs
parents:
diff changeset
    73
}
hgs
parents:
diff changeset
    74
hgs
parents:
diff changeset
    75
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    76
// view( XQSharableFile )
hgs
parents:
diff changeset
    77
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    78
// 
hgs
parents:
diff changeset
    79
bool VideoServiceView::view( XQSharableFile file  )
hgs
parents:
diff changeset
    80
{
hgs
parents:
diff changeset
    81
    MPX_ENTER_EXIT(_L("VideoServiceView::view( XQSharableFile )"));
hgs
parents:
diff changeset
    82
    
hgs
parents:
diff changeset
    83
    RFile rFile;
hgs
parents:
diff changeset
    84
    bool handleOK = file.getHandle( rFile );
hgs
parents:
diff changeset
    85
hgs
parents:
diff changeset
    86
    mServiceApp->setCurrentService(VideoServices::EView);
hgs
parents:
diff changeset
    87
    
hgs
parents:
diff changeset
    88
    if ( mEngine)
hgs
parents:
diff changeset
    89
    {
hgs
parents:
diff changeset
    90
        if ( handleOK )
hgs
parents:
diff changeset
    91
        {            
hgs
parents:
diff changeset
    92
            mEngine->playMedia( rFile );        
hgs
parents:
diff changeset
    93
        }
hgs
parents:
diff changeset
    94
        else
hgs
parents:
diff changeset
    95
        {
hgs
parents:
diff changeset
    96
            mEngine->playMedia( file.fileName() );    
hgs
parents:
diff changeset
    97
        }
hgs
parents:
diff changeset
    98
    }
hgs
parents:
diff changeset
    99
       
hgs
parents:
diff changeset
   100
	return true;
hgs
parents:
diff changeset
   101
}
hgs
parents:
diff changeset
   102
hgs
parents:
diff changeset
   103
hgs
parents:
diff changeset
   104
hgs
parents:
diff changeset
   105