videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp
author hgs
Fri, 02 Jul 2010 17:14:33 +0300
changeset 42 17f382c040b1
parent 40 13331705e488
permissions -rw-r--r--
201025_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
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 MPXVideoPlaybackControlsController
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
40
hgs
parents: 39
diff changeset
    18
// Version : %version: da1mmcf#41 %
30
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
// INCLUDE FILES
hgs
parents:
diff changeset
    23
#include <coecntrl.h>
hgs
parents:
diff changeset
    24
#include <bautils.h>
hgs
parents:
diff changeset
    25
#include <barsread.h>
hgs
parents:
diff changeset
    26
#include <f32file.h>
hgs
parents:
diff changeset
    27
34
hgs
parents: 30
diff changeset
    28
#include <QTimer>
30
hgs
parents:
diff changeset
    29
#include <thumbnailmanager_qt.h>
36
hgs
parents: 35
diff changeset
    30
#include <xqserviceutil.h>
30
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
#include <hblabel.h>
36
hgs
parents: 35
diff changeset
    33
#include <hbvolumesliderpopup.h>
30
hgs
parents:
diff changeset
    34
#include <hbtransparentwindow.h>
35
hgs
parents: 34
diff changeset
    35
#include <hbiconanimationmanager.h>
37
hgs
parents: 36
diff changeset
    36
#include <shareui.h>
38
hgs
parents: 37
diff changeset
    37
#include <hbinstance.h>
40
hgs
parents: 39
diff changeset
    38
#include <hbtapgesture.h>
hgs
parents: 39
diff changeset
    39
#include <hbpangesture.h>
30
hgs
parents:
diff changeset
    40
hgs
parents:
diff changeset
    41
#include "mpxvideoviewwrapper.h"
hgs
parents:
diff changeset
    42
#include "hbvideobaseplaybackview.h"
35
hgs
parents: 34
diff changeset
    43
#include "mpxvideoplaybackcontrolbar.h"
30
hgs
parents:
diff changeset
    44
#include "mpxvideoplaybackcontrolpolicy.h"
hgs
parents:
diff changeset
    45
#include "mpxvideoplaybackdocumentloader.h"
hgs
parents:
diff changeset
    46
#include "mpxvideoplaybackviewfiledetails.h"
hgs
parents:
diff changeset
    47
#include "mpxvideoplaybackstatuspanecontrol.h"
hgs
parents:
diff changeset
    48
#include "mpxvideoplaybackfiledetailswidget.h"
hgs
parents:
diff changeset
    49
#include "mpxvideoplaybackfullscreencontrol.h"
hgs
parents:
diff changeset
    50
#include "mpxvideoplaybackcontrolscontroller.h"
hgs
parents:
diff changeset
    51
#include "mpxvideoplaybackcontrolconfiguration.h"
hgs
parents:
diff changeset
    52
#include "mpxvideoplaybackdetailsplaybackwindow.h"
36
hgs
parents: 35
diff changeset
    53
#include "videoservices.h"
30
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
hgs
parents:
diff changeset
    56
// ================= MEMBER FUNCTIONS ==============================================================
hgs
parents:
diff changeset
    57
hgs
parents:
diff changeset
    58
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    59
// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
hgs
parents:
diff changeset
    60
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    61
//
hgs
parents:
diff changeset
    62
QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController(
hgs
parents:
diff changeset
    63
        HbVideoBasePlaybackView *view,
hgs
parents:
diff changeset
    64
        CMPXVideoViewWrapper *viewWrapper,
hgs
parents:
diff changeset
    65
        QMPXVideoPlaybackViewFileDetails *details )
hgs
parents:
diff changeset
    66
    : mView( view )
hgs
parents:
diff changeset
    67
    , mViewWrapper( viewWrapper )
hgs
parents:
diff changeset
    68
    , mFileDetails( details )
hgs
parents:
diff changeset
    69
    , mControlsPolicy( NULL )
hgs
parents:
diff changeset
    70
    , mControlsConfig( NULL )
hgs
parents:
diff changeset
    71
    , mControlsTimer( NULL )
39
hgs
parents: 38
diff changeset
    72
    , mRNLogoTimer( NULL )
30
hgs
parents:
diff changeset
    73
    , mLoader( NULL )
hgs
parents:
diff changeset
    74
    , mVolumeControl( NULL )
hgs
parents:
diff changeset
    75
    , mThumbnailManager( NULL )
36
hgs
parents: 35
diff changeset
    76
    , mVideoServices( 0 )
30
hgs
parents:
diff changeset
    77
    , mViewTransitionIsGoingOn( false )
36
hgs
parents: 35
diff changeset
    78
    , mIsAttachOperation( false )
30
hgs
parents:
diff changeset
    79
    , mThumbNailState( EThumbNailEmpty )
hgs
parents:
diff changeset
    80
    , mState( EPbStateNotInitialised )
hgs
parents:
diff changeset
    81
    , mViewMode( EFullScreenView )
hgs
parents:
diff changeset
    82
{
hgs
parents:
diff changeset
    83
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()"));
hgs
parents:
diff changeset
    84
hgs
parents:
diff changeset
    85
    initializeController();
hgs
parents:
diff changeset
    86
}
hgs
parents:
diff changeset
    87
hgs
parents:
diff changeset
    88
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    89
// QMPXVideoPlaybackControlsController::initializeController()
hgs
parents:
diff changeset
    90
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
    91
//
hgs
parents:
diff changeset
    92
void QMPXVideoPlaybackControlsController::initializeController()
hgs
parents:
diff changeset
    93
{
hgs
parents:
diff changeset
    94
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::initializeController()"));
hgs
parents:
diff changeset
    95
38
hgs
parents: 37
diff changeset
    96
    mOrientation = hbInstance->allMainWindows()[0]->orientation();
hgs
parents: 37
diff changeset
    97
    bool ok = connect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ),
hgs
parents: 37
diff changeset
    98
                       this, SLOT( handleOrientationChanged( Qt::Orientation ) ) );
hgs
parents: 37
diff changeset
    99
hgs
parents: 37
diff changeset
   100
    MPX_DEBUG(
40
hgs
parents: 39
diff changeset
   101
        _L("QMPXVideoPlaybackControlsController::initializeController() orientation = %d, ok =%d"),
38
hgs
parents: 37
diff changeset
   102
        mOrientation, ok );
hgs
parents: 37
diff changeset
   103
30
hgs
parents:
diff changeset
   104
    setParent( mView );
hgs
parents:
diff changeset
   105
38
hgs
parents: 37
diff changeset
   106
    mView->hideItems( Hb::AllItems );
hgs
parents: 37
diff changeset
   107
30
hgs
parents:
diff changeset
   108
    //
hgs
parents:
diff changeset
   109
    // Create layout loader
hgs
parents:
diff changeset
   110
    //
38
hgs
parents: 37
diff changeset
   111
    ok = false;
30
hgs
parents:
diff changeset
   112
    mLoader = new QMPXVideoPlaybackDocumentLoader( this );
hgs
parents:
diff changeset
   113
    mLoader->load( KMPXPLAYBACKVIEW_XML, &ok );
hgs
parents:
diff changeset
   114
hgs
parents:
diff changeset
   115
    if ( ok )
hgs
parents:
diff changeset
   116
    {
hgs
parents:
diff changeset
   117
        QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
hgs
parents:
diff changeset
   118
        mView->setWidget( widget );
hgs
parents:
diff changeset
   119
    }
hgs
parents:
diff changeset
   120
    else
hgs
parents:
diff changeset
   121
    {
36
hgs
parents: 35
diff changeset
   122
        MPX_DEBUG(
hgs
parents: 35
diff changeset
   123
                _L("QMPXVideoPlaybackControlsController::initializeController()- can't find xml"));
30
hgs
parents:
diff changeset
   124
hgs
parents:
diff changeset
   125
        //
hgs
parents:
diff changeset
   126
        // Can't find xml for layout. Delete mLoader
hgs
parents:
diff changeset
   127
        //
hgs
parents:
diff changeset
   128
        delete mLoader;
hgs
parents:
diff changeset
   129
        mLoader = NULL;
hgs
parents:
diff changeset
   130
    }
34
hgs
parents: 30
diff changeset
   131
39
hgs
parents: 38
diff changeset
   132
    mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
hgs
parents: 38
diff changeset
   133
40
hgs
parents: 39
diff changeset
   134
    //
hgs
parents: 39
diff changeset
   135
    // Controls dismissing timer
hgs
parents: 39
diff changeset
   136
    //
34
hgs
parents: 30
diff changeset
   137
    mControlsTimer = new QTimer( this );
hgs
parents: 30
diff changeset
   138
    mControlsTimer->setInterval( KMPXControlsTimeOut );
hgs
parents: 30
diff changeset
   139
    mControlsTimer->setSingleShot( false );
hgs
parents: 30
diff changeset
   140
    connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
hgs
parents: 30
diff changeset
   141
36
hgs
parents: 35
diff changeset
   142
    mControlsPolicy = new QMPXVideoPlaybackControlPolicy();
40
hgs
parents: 39
diff changeset
   143
36
hgs
parents: 35
diff changeset
   144
    mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
hgs
parents: 35
diff changeset
   145
    connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
hgs
parents: 35
diff changeset
   146
    mControlsConfig->createControlList();
hgs
parents: 35
diff changeset
   147
39
hgs
parents: 38
diff changeset
   148
    //
hgs
parents: 38
diff changeset
   149
    // Create volume popup control
hgs
parents: 38
diff changeset
   150
    //
36
hgs
parents: 35
diff changeset
   151
    mVolumeControl = new HbVolumeSliderPopup();
hgs
parents: 35
diff changeset
   152
    mVolumeControl->setVisible( false );
hgs
parents: 35
diff changeset
   153
    mVolumeControl->setTimeout( KMPXControlsTimeOut );
hgs
parents: 35
diff changeset
   154
    mVolumeControl->setTickPosition( Hb::NoSliderTicks );
hgs
parents: 35
diff changeset
   155
    mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
hgs
parents: 35
diff changeset
   156
hgs
parents: 35
diff changeset
   157
    //
40
hgs
parents: 39
diff changeset
   158
    // grab tap gesture
hgs
parents: 39
diff changeset
   159
    //
hgs
parents: 39
diff changeset
   160
    mView->grabGesture( Qt::TapGesture );
hgs
parents: 39
diff changeset
   161
    connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
hgs
parents: 39
diff changeset
   162
hgs
parents: 39
diff changeset
   163
    //
hgs
parents: 39
diff changeset
   164
    // grab pan gesture for playlist
hgs
parents: 39
diff changeset
   165
    //
hgs
parents: 39
diff changeset
   166
    if ( mFileDetails->mMultiItemPlaylist )
hgs
parents: 39
diff changeset
   167
    {
hgs
parents: 39
diff changeset
   168
        mView->grabGesture( Qt::PanGesture );
hgs
parents: 39
diff changeset
   169
        connect( mView, SIGNAL( pannedToRight() ), this, SLOT( skipToPreviousVideoItem() ) );
hgs
parents: 39
diff changeset
   170
        connect( mView, SIGNAL( pannedToLeft() ), this, SLOT( skipToNextVideoItem() ) );
hgs
parents: 39
diff changeset
   171
    }
hgs
parents: 39
diff changeset
   172
hgs
parents: 39
diff changeset
   173
    //
36
hgs
parents: 35
diff changeset
   174
    // if videoplayback is in service mode, create a videoservices instance
hgs
parents: 35
diff changeset
   175
    //
hgs
parents: 35
diff changeset
   176
    if ( XQServiceUtil::isService() && ! mVideoServices )
hgs
parents: 35
diff changeset
   177
    {
hgs
parents: 35
diff changeset
   178
        //
40
hgs
parents: 39
diff changeset
   179
        // obtain VideoServices instance
36
hgs
parents: 35
diff changeset
   180
        //
40
hgs
parents: 39
diff changeset
   181
        mVideoServices = VideoServices::instance();
36
hgs
parents: 35
diff changeset
   182
hgs
parents: 35
diff changeset
   183
        //
hgs
parents: 35
diff changeset
   184
        // allow 'attach' operation only for non-streaming media clips
hgs
parents: 35
diff changeset
   185
        //
hgs
parents: 35
diff changeset
   186
        if ( mVideoServices && mFileDetails->mPlaybackMode == EMPXVideoLocal )
hgs
parents: 35
diff changeset
   187
        {
hgs
parents: 35
diff changeset
   188
            //
hgs
parents: 35
diff changeset
   189
            // determine if this is 'attach' operation
hgs
parents: 35
diff changeset
   190
            //
hgs
parents: 35
diff changeset
   191
            mIsAttachOperation = ( mVideoServices->currentService() == VideoServices::EUriFetcher );
40
hgs
parents: 39
diff changeset
   192
36
hgs
parents: 35
diff changeset
   193
            if ( mIsAttachOperation )
hgs
parents: 35
diff changeset
   194
            {
hgs
parents: 35
diff changeset
   195
                //
hgs
parents: 35
diff changeset
   196
                // connect signal filePath() to videoservices slot itemSelected()
hgs
parents: 35
diff changeset
   197
                //
40
hgs
parents: 39
diff changeset
   198
                connect( this, SIGNAL( attachVideoPath( const QString& ) ),
hgs
parents: 39
diff changeset
   199
                         mVideoServices, SLOT( itemSelected( const QString& ) ) );
36
hgs
parents: 35
diff changeset
   200
            }
hgs
parents: 35
diff changeset
   201
        }
hgs
parents: 35
diff changeset
   202
    }
30
hgs
parents:
diff changeset
   203
}
hgs
parents:
diff changeset
   204
hgs
parents:
diff changeset
   205
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   206
// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
hgs
parents:
diff changeset
   207
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   208
//
hgs
parents:
diff changeset
   209
QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
hgs
parents:
diff changeset
   210
{
36
hgs
parents: 35
diff changeset
   211
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()"));
30
hgs
parents:
diff changeset
   212
40
hgs
parents: 39
diff changeset
   213
    mView->ungrabGesture( Qt::TapGesture );
hgs
parents: 39
diff changeset
   214
    disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
hgs
parents: 39
diff changeset
   215
hgs
parents: 39
diff changeset
   216
    if ( mFileDetails->mMultiItemPlaylist )
hgs
parents: 39
diff changeset
   217
    {
hgs
parents: 39
diff changeset
   218
        mView->ungrabGesture( Qt::PanGesture );
hgs
parents: 39
diff changeset
   219
hgs
parents: 39
diff changeset
   220
        disconnect( mView, SIGNAL( pannedToRight() ), this, SLOT( skipToNextVideoItem() ) );
hgs
parents: 39
diff changeset
   221
        disconnect( mView, SIGNAL( pannedToLeft() ), this, SLOT( skipToPreviousVideoItem() ) );
hgs
parents: 39
diff changeset
   222
    }
hgs
parents: 39
diff changeset
   223
30
hgs
parents:
diff changeset
   224
    disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
hgs
parents:
diff changeset
   225
    disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
38
hgs
parents: 37
diff changeset
   226
    disconnect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ),
hgs
parents: 37
diff changeset
   227
                this, SLOT( handleOrientationChanged( Qt::Orientation ) ) );
30
hgs
parents:
diff changeset
   228
hgs
parents:
diff changeset
   229
    mView->setWidget( NULL );
hgs
parents:
diff changeset
   230
hgs
parents:
diff changeset
   231
    mControls.clear();
hgs
parents:
diff changeset
   232
hgs
parents:
diff changeset
   233
    if ( mControlsTimer )
hgs
parents:
diff changeset
   234
    {
hgs
parents:
diff changeset
   235
        delete mControlsTimer;
hgs
parents:
diff changeset
   236
        mControlsTimer = NULL;
hgs
parents:
diff changeset
   237
    }
hgs
parents:
diff changeset
   238
39
hgs
parents: 38
diff changeset
   239
    if ( mRNLogoTimer )
hgs
parents: 38
diff changeset
   240
    {
40
hgs
parents: 39
diff changeset
   241
        disconnect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );
39
hgs
parents: 38
diff changeset
   242
hgs
parents: 38
diff changeset
   243
        delete mRNLogoTimer;
hgs
parents: 38
diff changeset
   244
        mRNLogoTimer = NULL;
hgs
parents: 38
diff changeset
   245
    }
hgs
parents: 38
diff changeset
   246
30
hgs
parents:
diff changeset
   247
    if ( mControlsPolicy )
hgs
parents:
diff changeset
   248
    {
hgs
parents:
diff changeset
   249
        delete mControlsPolicy;
hgs
parents:
diff changeset
   250
        mControlsPolicy = NULL;
hgs
parents:
diff changeset
   251
    }
hgs
parents:
diff changeset
   252
hgs
parents:
diff changeset
   253
    if ( mControlsConfig )
hgs
parents:
diff changeset
   254
    {
hgs
parents:
diff changeset
   255
        delete mControlsConfig;
hgs
parents:
diff changeset
   256
        mControlsConfig = NULL;
hgs
parents:
diff changeset
   257
    }
hgs
parents:
diff changeset
   258
hgs
parents:
diff changeset
   259
    if ( mLoader )
hgs
parents:
diff changeset
   260
    {
hgs
parents:
diff changeset
   261
        delete mLoader;
hgs
parents:
diff changeset
   262
        mLoader = NULL;
hgs
parents:
diff changeset
   263
    }
hgs
parents:
diff changeset
   264
hgs
parents:
diff changeset
   265
    if ( mThumbnailManager )
hgs
parents:
diff changeset
   266
    {
hgs
parents:
diff changeset
   267
        delete mThumbnailManager;
40
hgs
parents: 39
diff changeset
   268
        mThumbnailManager = NULL;
36
hgs
parents: 35
diff changeset
   269
    }
hgs
parents: 35
diff changeset
   270
hgs
parents: 35
diff changeset
   271
    if ( mVolumeControl )
hgs
parents: 35
diff changeset
   272
    {
hgs
parents: 35
diff changeset
   273
        delete mVolumeControl;
hgs
parents: 35
diff changeset
   274
        mVolumeControl = NULL;
30
hgs
parents:
diff changeset
   275
    }
40
hgs
parents: 39
diff changeset
   276
36
hgs
parents: 35
diff changeset
   277
    if ( mIsAttachOperation )
hgs
parents: 35
diff changeset
   278
    {
hgs
parents: 35
diff changeset
   279
        //
hgs
parents: 35
diff changeset
   280
        // disable connection for 'attach' operation
hgs
parents: 35
diff changeset
   281
        //
40
hgs
parents: 39
diff changeset
   282
        disconnect( this, SIGNAL( attachVideoPath( const QString& ) ),
hgs
parents: 39
diff changeset
   283
                    mVideoServices, SLOT( itemSelected( const QString& ) ) );
36
hgs
parents: 35
diff changeset
   284
    }
40
hgs
parents: 39
diff changeset
   285
36
hgs
parents: 35
diff changeset
   286
    if ( mVideoServices )
40
hgs
parents: 39
diff changeset
   287
    {
36
hgs
parents: 35
diff changeset
   288
        //
hgs
parents: 35
diff changeset
   289
        // decrease videoservices instance count
hgs
parents: 35
diff changeset
   290
        //
hgs
parents: 35
diff changeset
   291
    	mVideoServices->decreaseReferenceCount();
hgs
parents: 35
diff changeset
   292
    	mVideoServices = 0;
hgs
parents: 35
diff changeset
   293
    }
30
hgs
parents:
diff changeset
   294
}
hgs
parents:
diff changeset
   295
hgs
parents:
diff changeset
   296
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   297
// QMPXVideoPlaybackControlsController::addFileDetails()
hgs
parents:
diff changeset
   298
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   299
//
hgs
parents:
diff changeset
   300
void QMPXVideoPlaybackControlsController::addFileDetails(
hgs
parents:
diff changeset
   301
    QMPXVideoPlaybackViewFileDetails* details )
hgs
parents:
diff changeset
   302
{
35
hgs
parents: 34
diff changeset
   303
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::addFileDetails"));
hgs
parents: 34
diff changeset
   304
30
hgs
parents:
diff changeset
   305
    mFileDetails = details;
hgs
parents:
diff changeset
   306
40
hgs
parents: 39
diff changeset
   307
    mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
hgs
parents: 39
diff changeset
   308
30
hgs
parents:
diff changeset
   309
    mControlsConfig->updateControlsWithFileDetails();
hgs
parents:
diff changeset
   310
hgs
parents:
diff changeset
   311
    //
hgs
parents:
diff changeset
   312
    // for audio-only clips and tv-out, default view is flip view
hgs
parents:
diff changeset
   313
    //
hgs
parents:
diff changeset
   314
    if ( ! details->mVideoEnabled )
hgs
parents:
diff changeset
   315
    {
hgs
parents:
diff changeset
   316
        changeViewMode( EAudioOnlyView, false );
hgs
parents:
diff changeset
   317
    }
hgs
parents:
diff changeset
   318
hgs
parents:
diff changeset
   319
    if ( details->mTvOutConnected )
hgs
parents:
diff changeset
   320
    {
37
hgs
parents: 36
diff changeset
   321
        handleEvent( EMPXControlCmdTvOutConnected );
30
hgs
parents:
diff changeset
   322
    }
hgs
parents:
diff changeset
   323
hgs
parents:
diff changeset
   324
    //
hgs
parents:
diff changeset
   325
    // Dimmed the volume control if it is video only
hgs
parents:
diff changeset
   326
    //
hgs
parents:
diff changeset
   327
    if ( ! mFileDetails->mAudioEnabled )
hgs
parents:
diff changeset
   328
    {
hgs
parents:
diff changeset
   329
        mVolumeControl->setValue( 0 );
hgs
parents:
diff changeset
   330
        mVolumeControl->setEnabled( false );
hgs
parents:
diff changeset
   331
    }
hgs
parents:
diff changeset
   332
}
hgs
parents:
diff changeset
   333
hgs
parents:
diff changeset
   334
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   335
// QMPXVideoPlaybackControlsController::handleEvent
hgs
parents:
diff changeset
   336
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   337
//
hgs
parents:
diff changeset
   338
void QMPXVideoPlaybackControlsController::handleEvent(
hgs
parents:
diff changeset
   339
    TMPXVideoPlaybackControlCommandIds event, int value )
hgs
parents:
diff changeset
   340
{
hgs
parents:
diff changeset
   341
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleEvent(%d)"), event);
hgs
parents:
diff changeset
   342
hgs
parents:
diff changeset
   343
    switch ( event )
hgs
parents:
diff changeset
   344
    {
hgs
parents:
diff changeset
   345
        case EMPXControlCmdSetPosition:
hgs
parents:
diff changeset
   346
        {
hgs
parents:
diff changeset
   347
            MPX_DEBUG(_L("    [EMPXControlCmdSetPosition [%d]]"), value );
hgs
parents:
diff changeset
   348
hgs
parents:
diff changeset
   349
            positionChanged( (qreal)value / (qreal)KPbMilliMultiplier);
hgs
parents:
diff changeset
   350
            break;
hgs
parents:
diff changeset
   351
        }
hgs
parents:
diff changeset
   352
        case EMPXControlCmdSetDuration:
hgs
parents:
diff changeset
   353
        {
hgs
parents:
diff changeset
   354
            MPX_DEBUG(_L("    [EMPXControlCmdSetDuration [%d]]"), value );
hgs
parents:
diff changeset
   355
hgs
parents:
diff changeset
   356
            durationChanged( (qreal)value / (qreal)KPbMilliMultiplier );
hgs
parents:
diff changeset
   357
            break;
hgs
parents:
diff changeset
   358
        }
hgs
parents:
diff changeset
   359
        case EMPXControlCmdStateChanged:
hgs
parents:
diff changeset
   360
        {
hgs
parents:
diff changeset
   361
            MPX_DEBUG(_L("    [EMPXControlCmdStateChanged]"));
hgs
parents:
diff changeset
   362
hgs
parents:
diff changeset
   363
            handleStateChange( (TMPXPlaybackState)value );
hgs
parents:
diff changeset
   364
            break;
hgs
parents:
diff changeset
   365
        }
hgs
parents:
diff changeset
   366
        case EMPXControlCmdSetVolume:
hgs
parents:
diff changeset
   367
        {
hgs
parents:
diff changeset
   368
            MPX_DEBUG(_L("    [EMPXControlCmdSetVolume [%d]]"), value );
hgs
parents:
diff changeset
   369
hgs
parents:
diff changeset
   370
            volumeChanged( value );
hgs
parents:
diff changeset
   371
            break;
hgs
parents:
diff changeset
   372
        }
hgs
parents:
diff changeset
   373
        case EMPXControlCmdSetAspectRatio:
hgs
parents:
diff changeset
   374
        {
hgs
parents:
diff changeset
   375
            MPX_DEBUG(_L("    [EMPXControlCmdSetAspectRatio %d]"), value );
hgs
parents:
diff changeset
   376
hgs
parents:
diff changeset
   377
            aspectRatioChanged( value );
hgs
parents:
diff changeset
   378
hgs
parents:
diff changeset
   379
            break;
hgs
parents:
diff changeset
   380
        }
hgs
parents:
diff changeset
   381
        case EMPXControlCmdSetDownloadSize:
hgs
parents:
diff changeset
   382
        {
hgs
parents:
diff changeset
   383
            MPX_DEBUG(_L("    [EMPXControlCmdSetDownloadSize [%d]]"), value );
hgs
parents:
diff changeset
   384
            setDownloadSize( value );
hgs
parents:
diff changeset
   385
            break;
hgs
parents:
diff changeset
   386
        }
hgs
parents:
diff changeset
   387
        case EMPXControlCmdDownloadUpdated:
hgs
parents:
diff changeset
   388
        {
hgs
parents:
diff changeset
   389
            MPX_DEBUG(_L("    [EMPXControlCmdDownloadUpdated [%d]]"), value );
hgs
parents:
diff changeset
   390
            updateDownloadPosition( value );
hgs
parents:
diff changeset
   391
            break;
hgs
parents:
diff changeset
   392
        }
hgs
parents:
diff changeset
   393
        case EMPXControlCmdDownloadComplete:
hgs
parents:
diff changeset
   394
        {
hgs
parents:
diff changeset
   395
            MPX_DEBUG(_L("    [EMPXControlCmdDownloadComplete [%d]]"), value);
hgs
parents:
diff changeset
   396
            updateDownloadPosition( value );
hgs
parents:
diff changeset
   397
            break;
hgs
parents:
diff changeset
   398
        }
hgs
parents:
diff changeset
   399
        case EMPXControlCmdSetDownloadPaused:
hgs
parents:
diff changeset
   400
        case EMPXControlCmdClearDownloadPaused:
hgs
parents:
diff changeset
   401
        {
hgs
parents:
diff changeset
   402
            mControlsConfig->updateControlList( event );
hgs
parents:
diff changeset
   403
            break;
hgs
parents:
diff changeset
   404
        }
hgs
parents:
diff changeset
   405
        case EMPXControlCmdTvOutConnected:
hgs
parents:
diff changeset
   406
        {
hgs
parents:
diff changeset
   407
            MPX_DEBUG(_L("    [EMPXControlCmdTvOutConnected]"));
hgs
parents:
diff changeset
   408
37
hgs
parents: 36
diff changeset
   409
            handleTvOutEvent( true, event );
30
hgs
parents:
diff changeset
   410
            break;
hgs
parents:
diff changeset
   411
        }
hgs
parents:
diff changeset
   412
        case EMPXControlCmdTvOutDisconnected:
hgs
parents:
diff changeset
   413
        {
hgs
parents:
diff changeset
   414
            MPX_DEBUG(_L("    [EMPXControlCmdTvOutDisConnected]"));
hgs
parents:
diff changeset
   415
37
hgs
parents: 36
diff changeset
   416
            handleTvOutEvent( false, event );
30
hgs
parents:
diff changeset
   417
            break;
hgs
parents:
diff changeset
   418
        }
hgs
parents:
diff changeset
   419
        case EMPXControlCmdHandleErrors:
hgs
parents:
diff changeset
   420
        {
hgs
parents:
diff changeset
   421
            MPX_DEBUG(_L("    [EMPXControlCmdHandleErrors]"));
hgs
parents:
diff changeset
   422
hgs
parents:
diff changeset
   423
            handleErrors();
hgs
parents:
diff changeset
   424
hgs
parents:
diff changeset
   425
            break;
hgs
parents:
diff changeset
   426
        }
hgs
parents:
diff changeset
   427
        case EMPXControlCmdShowVolumeControls:
hgs
parents:
diff changeset
   428
        {
hgs
parents:
diff changeset
   429
            MPX_DEBUG(_L("    [EMPXControlCmdShowVolumeControls]"));
hgs
parents:
diff changeset
   430
hgs
parents:
diff changeset
   431
            showVolumeControls();
hgs
parents:
diff changeset
   432
            break;
hgs
parents:
diff changeset
   433
        }
hgs
parents:
diff changeset
   434
    }
hgs
parents:
diff changeset
   435
}
hgs
parents:
diff changeset
   436
hgs
parents:
diff changeset
   437
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   438
// QMPXVideoPlaybackControlsController::handleStateChange
hgs
parents:
diff changeset
   439
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   440
//
hgs
parents:
diff changeset
   441
void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
hgs
parents:
diff changeset
   442
{
hgs
parents:
diff changeset
   443
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleStateChange()"),
hgs
parents:
diff changeset
   444
                   _L("new state = %d"), newState );
hgs
parents:
diff changeset
   445
hgs
parents:
diff changeset
   446
    //
hgs
parents:
diff changeset
   447
    // Somehow EPbStatePlaying, EPbStatePaused gets called twice continously
hgs
parents:
diff changeset
   448
    //
hgs
parents:
diff changeset
   449
    if ( newState != mState )
hgs
parents:
diff changeset
   450
    {
hgs
parents:
diff changeset
   451
        mState = newState;
hgs
parents:
diff changeset
   452
hgs
parents:
diff changeset
   453
        switch ( newState )
hgs
parents:
diff changeset
   454
        {
hgs
parents:
diff changeset
   455
            case EPbStatePlaying:
hgs
parents:
diff changeset
   456
            case EPbStateInitialising:
hgs
parents:
diff changeset
   457
            case EPbStateBuffering:
hgs
parents:
diff changeset
   458
            case EPbStatePaused:
hgs
parents:
diff changeset
   459
            case EPbStateNotInitialised:
hgs
parents:
diff changeset
   460
            {
hgs
parents:
diff changeset
   461
                //
hgs
parents:
diff changeset
   462
                //  Show all the controls
hgs
parents:
diff changeset
   463
                //
hgs
parents:
diff changeset
   464
                showControls();
hgs
parents:
diff changeset
   465
36
hgs
parents: 35
diff changeset
   466
                updateState();
hgs
parents: 35
diff changeset
   467
30
hgs
parents:
diff changeset
   468
                break;
hgs
parents:
diff changeset
   469
            }
36
hgs
parents: 35
diff changeset
   470
            default:
hgs
parents: 35
diff changeset
   471
            {
40
hgs
parents: 39
diff changeset
   472
                break;
36
hgs
parents: 35
diff changeset
   473
            }
30
hgs
parents:
diff changeset
   474
        }
hgs
parents:
diff changeset
   475
    }
hgs
parents:
diff changeset
   476
}
hgs
parents:
diff changeset
   477
hgs
parents:
diff changeset
   478
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   479
// QMPXVideoPlaybackControlsController::controlsListUpdated()
hgs
parents:
diff changeset
   480
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   481
//
hgs
parents:
diff changeset
   482
void QMPXVideoPlaybackControlsController::controlsListUpdated()
hgs
parents:
diff changeset
   483
{
hgs
parents:
diff changeset
   484
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::controlsListUpdated()"));
hgs
parents:
diff changeset
   485
hgs
parents:
diff changeset
   486
    hideAllControls();
hgs
parents:
diff changeset
   487
hgs
parents:
diff changeset
   488
    QList<TMPXVideoPlaybackControls>& updatedList = mControlsConfig->controlList();
hgs
parents:
diff changeset
   489
hgs
parents:
diff changeset
   490
    QList<TMPXVideoPlaybackControls> myList = updatedList;
hgs
parents:
diff changeset
   491
hgs
parents:
diff changeset
   492
    int controlCount = mControls.count();
hgs
parents:
diff changeset
   493
hgs
parents:
diff changeset
   494
    int i = 0 ;
hgs
parents:
diff changeset
   495
    int index = KErrNotFound;
hgs
parents:
diff changeset
   496
hgs
parents:
diff changeset
   497
hgs
parents:
diff changeset
   498
    for ( int iCnt = 0 ; iCnt < controlCount ; iCnt++ )
hgs
parents:
diff changeset
   499
    {
hgs
parents:
diff changeset
   500
        index = myList.indexOf( mControls[i]->controlIndex() );
hgs
parents:
diff changeset
   501
hgs
parents:
diff changeset
   502
        if ( index == KErrNotFound )
hgs
parents:
diff changeset
   503
        {
hgs
parents:
diff changeset
   504
            //
hgs
parents:
diff changeset
   505
            //  Delete control since it doesn't exist in new list
hgs
parents:
diff changeset
   506
            //
hgs
parents:
diff changeset
   507
            mControls.removeAt( i );
hgs
parents:
diff changeset
   508
        }
hgs
parents:
diff changeset
   509
        else
hgs
parents:
diff changeset
   510
        {
hgs
parents:
diff changeset
   511
            //
hgs
parents:
diff changeset
   512
            //  Control exists in new list.
hgs
parents:
diff changeset
   513
            //  Update the policy property based on file details and view mode to the controls
hgs
parents:
diff changeset
   514
            //
hgs
parents:
diff changeset
   515
            TUint properties = 0;
40
hgs
parents: 39
diff changeset
   516
            mControlsPolicy->setControlProperties(
30
hgs
parents:
diff changeset
   517
                    mControls[i]->controlIndex(), properties, mFileDetails, mViewMode );
hgs
parents:
diff changeset
   518
            mControls[i]->updateControlProperties( properties );
hgs
parents:
diff changeset
   519
hgs
parents:
diff changeset
   520
            //
hgs
parents:
diff changeset
   521
            //  Control exists in new list.
hgs
parents:
diff changeset
   522
            //
hgs
parents:
diff changeset
   523
            myList.removeAt( index );
39
hgs
parents: 38
diff changeset
   524
            i++;
30
hgs
parents:
diff changeset
   525
        }
hgs
parents:
diff changeset
   526
    }
hgs
parents:
diff changeset
   527
hgs
parents:
diff changeset
   528
    //
hgs
parents:
diff changeset
   529
    //  The updated list will contain added controls only
hgs
parents:
diff changeset
   530
    //
hgs
parents:
diff changeset
   531
    for ( int j = 0 ; j < myList.count() ; j++ )
hgs
parents:
diff changeset
   532
    {
hgs
parents:
diff changeset
   533
        appendControl( myList[j] );
hgs
parents:
diff changeset
   534
    }
hgs
parents:
diff changeset
   535
hgs
parents:
diff changeset
   536
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   537
    {
hgs
parents:
diff changeset
   538
        mControls[i]->updateControlsWithFileDetails( mFileDetails );
hgs
parents:
diff changeset
   539
    }
hgs
parents:
diff changeset
   540
hgs
parents:
diff changeset
   541
    showControls();
hgs
parents:
diff changeset
   542
}
hgs
parents:
diff changeset
   543
hgs
parents:
diff changeset
   544
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   545
// QMPXVideoPlaybackControlsController::appendControl()
hgs
parents:
diff changeset
   546
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   547
//
hgs
parents:
diff changeset
   548
void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
hgs
parents:
diff changeset
   549
{
hgs
parents:
diff changeset
   550
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::appendControl()"),
hgs
parents:
diff changeset
   551
                   _L("control index = %d"), controlIndex );
hgs
parents:
diff changeset
   552
hgs
parents:
diff changeset
   553
    TUint properties = 0;
hgs
parents:
diff changeset
   554
hgs
parents:
diff changeset
   555
    mControlsPolicy->setControlProperties( controlIndex, properties, mFileDetails, mViewMode );
hgs
parents:
diff changeset
   556
    QMPXVideoPlaybackFullScreenControl* control;
hgs
parents:
diff changeset
   557
hgs
parents:
diff changeset
   558
    switch ( controlIndex )
hgs
parents:
diff changeset
   559
    {
hgs
parents:
diff changeset
   560
        case EMPXBufferingAnimation:
hgs
parents:
diff changeset
   561
        {
hgs
parents:
diff changeset
   562
            //
39
hgs
parents: 38
diff changeset
   563
            // Load animation icons
hgs
parents: 38
diff changeset
   564
            //
hgs
parents: 38
diff changeset
   565
            QString animationName = ":/hbvideoplaybackview/animations/";
hgs
parents: 38
diff changeset
   566
hgs
parents: 38
diff changeset
   567
            if ( mFileDetails->mRNFormat )
hgs
parents: 38
diff changeset
   568
            {
hgs
parents: 38
diff changeset
   569
                animationName.append( "rn_preroll_anim.axml" );
hgs
parents: 38
diff changeset
   570
            }
hgs
parents: 38
diff changeset
   571
            else
hgs
parents: 38
diff changeset
   572
            {
hgs
parents: 38
diff changeset
   573
                animationName.append( "generic_preroll_anim.axml" );
hgs
parents: 38
diff changeset
   574
            }
hgs
parents: 38
diff changeset
   575
hgs
parents: 38
diff changeset
   576
            HbIconAnimationManager* manager = HbIconAnimationManager::global();
hgs
parents: 38
diff changeset
   577
            bool ok = manager->addDefinitionFile( animationName );
hgs
parents: 38
diff changeset
   578
hgs
parents: 38
diff changeset
   579
            MPX_DEBUG(_L("    EMPXBufferingAnimation add animation definition ok = %d"), ok);
hgs
parents: 38
diff changeset
   580
hgs
parents: 38
diff changeset
   581
            //
30
hgs
parents:
diff changeset
   582
            // Buffering animation icon
hgs
parents:
diff changeset
   583
            //
hgs
parents:
diff changeset
   584
            QGraphicsWidget *widget = mLoader->findWidget( QString( "bufferingIcon" ) );
hgs
parents:
diff changeset
   585
            HbLabel *bufferingAnim = qobject_cast<HbLabel*>( widget );
hgs
parents:
diff changeset
   586
hgs
parents:
diff changeset
   587
            control = new QMPXVideoPlaybackFullScreenControl( this,
hgs
parents:
diff changeset
   588
                                                              controlIndex,
hgs
parents:
diff changeset
   589
                                                              bufferingAnim,
hgs
parents:
diff changeset
   590
                                                              properties );
hgs
parents:
diff changeset
   591
            mControls.append( control );
hgs
parents:
diff changeset
   592
hgs
parents:
diff changeset
   593
            break;
hgs
parents:
diff changeset
   594
        }
hgs
parents:
diff changeset
   595
        case EMPXStatusPane:
hgs
parents:
diff changeset
   596
        {
hgs
parents:
diff changeset
   597
            //
hgs
parents:
diff changeset
   598
            // Status key (signal + title + back key)
hgs
parents:
diff changeset
   599
            //
hgs
parents:
diff changeset
   600
            control = new QMPXVideoPlaybackStatusPaneControl( this,
40
hgs
parents: 39
diff changeset
   601
                                                              controlIndex,
30
hgs
parents:
diff changeset
   602
                                                              NULL,
hgs
parents:
diff changeset
   603
                                                              properties );
hgs
parents:
diff changeset
   604
            mControls.append( control );
hgs
parents:
diff changeset
   605
hgs
parents:
diff changeset
   606
            break;
hgs
parents:
diff changeset
   607
        }
35
hgs
parents: 34
diff changeset
   608
        case EMPXControlBar:
30
hgs
parents:
diff changeset
   609
        {
hgs
parents:
diff changeset
   610
            //
hgs
parents:
diff changeset
   611
            // Button bar
hgs
parents:
diff changeset
   612
            //
35
hgs
parents: 34
diff changeset
   613
            QGraphicsWidget *widget = mLoader->findWidget( QString( "controlBarLayout" ) );
40
hgs
parents: 39
diff changeset
   614
            QMPXVideoPlaybackControlBar *controlBar =
35
hgs
parents: 34
diff changeset
   615
                qobject_cast<QMPXVideoPlaybackControlBar*>( widget );
hgs
parents: 34
diff changeset
   616
            controlBar->initialize();
30
hgs
parents:
diff changeset
   617
hgs
parents:
diff changeset
   618
            control = new QMPXVideoPlaybackFullScreenControl( this,
hgs
parents:
diff changeset
   619
                                                              controlIndex,
35
hgs
parents: 34
diff changeset
   620
                                                              controlBar,
30
hgs
parents:
diff changeset
   621
                                                              properties );
hgs
parents:
diff changeset
   622
            mControls.append( control );
hgs
parents:
diff changeset
   623
hgs
parents:
diff changeset
   624
            break;
hgs
parents:
diff changeset
   625
        }
hgs
parents:
diff changeset
   626
        case EMPXFileDetailsWidget:
hgs
parents:
diff changeset
   627
        {
hgs
parents:
diff changeset
   628
            QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) );
40
hgs
parents: 39
diff changeset
   629
            QMPXVideoPlaybackFileDetailsWidget *fileDetails =
30
hgs
parents:
diff changeset
   630
                qobject_cast<QMPXVideoPlaybackFileDetailsWidget*>( widget );
hgs
parents:
diff changeset
   631
hgs
parents:
diff changeset
   632
            control = new QMPXVideoPlaybackFullScreenControl( this,
hgs
parents:
diff changeset
   633
                                                              controlIndex,
hgs
parents:
diff changeset
   634
                                                              fileDetails,
hgs
parents:
diff changeset
   635
                                                              properties );
hgs
parents:
diff changeset
   636
hgs
parents:
diff changeset
   637
            mControls.append( control );
hgs
parents:
diff changeset
   638
            break;
hgs
parents:
diff changeset
   639
        }
hgs
parents:
diff changeset
   640
        case EMPXIndicatorBitmap:
hgs
parents:
diff changeset
   641
        {
hgs
parents:
diff changeset
   642
            QGraphicsWidget *widget = mLoader->findWidget( QString( "bitmapLayout" ) );
hgs
parents:
diff changeset
   643
            HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
hgs
parents:
diff changeset
   644
hgs
parents:
diff changeset
   645
            setDefaultBitmap();
hgs
parents:
diff changeset
   646
            control = new QMPXVideoPlaybackFullScreenControl( this,
hgs
parents:
diff changeset
   647
                                                              controlIndex,
hgs
parents:
diff changeset
   648
                                                              bitmapWidget,
hgs
parents:
diff changeset
   649
                                                              properties );
hgs
parents:
diff changeset
   650
            mControls.append( control );
hgs
parents:
diff changeset
   651
hgs
parents:
diff changeset
   652
            break;
hgs
parents:
diff changeset
   653
        }
39
hgs
parents: 38
diff changeset
   654
        case EMPXRealLogoBitmap:
hgs
parents: 38
diff changeset
   655
        {
hgs
parents: 38
diff changeset
   656
            QGraphicsWidget *widget = mLoader->findWidget( QString( "rnLogoBitmap" ) );
hgs
parents: 38
diff changeset
   657
            HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
hgs
parents: 38
diff changeset
   658
hgs
parents: 38
diff changeset
   659
            control = new QMPXVideoPlaybackFullScreenControl( this,
hgs
parents: 38
diff changeset
   660
                                                              controlIndex,
hgs
parents: 38
diff changeset
   661
                                                              bitmapWidget,
hgs
parents: 38
diff changeset
   662
                                                              properties );
hgs
parents: 38
diff changeset
   663
            mControls.append( control );
hgs
parents: 38
diff changeset
   664
hgs
parents: 38
diff changeset
   665
            connect( bitmapWidget, SIGNAL( visibleChanged() ),
hgs
parents: 38
diff changeset
   666
                     this, SLOT( handleRNLogoVisibleChanged() ) );
hgs
parents: 38
diff changeset
   667
hgs
parents: 38
diff changeset
   668
            break;
hgs
parents: 38
diff changeset
   669
        }
30
hgs
parents:
diff changeset
   670
        case EMPXDetailsViewPlaybackWindow:
hgs
parents:
diff changeset
   671
        {
hgs
parents:
diff changeset
   672
            QGraphicsWidget *widget = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
40
hgs
parents: 39
diff changeset
   673
            QMPXVideoPlaybackDetailsPlaybackWindow *detailsPlaybackWindow =
30
hgs
parents:
diff changeset
   674
                    qobject_cast<QMPXVideoPlaybackDetailsPlaybackWindow*>( widget );
hgs
parents:
diff changeset
   675
            detailsPlaybackWindow->initialize();
hgs
parents:
diff changeset
   676
hgs
parents:
diff changeset
   677
            control = new QMPXVideoPlaybackFullScreenControl( this,
hgs
parents:
diff changeset
   678
                                                              controlIndex,
hgs
parents:
diff changeset
   679
                                                              detailsPlaybackWindow,
hgs
parents:
diff changeset
   680
                                                              properties );
hgs
parents:
diff changeset
   681
            mControls.append( control );
hgs
parents:
diff changeset
   682
hgs
parents:
diff changeset
   683
            break;
hgs
parents:
diff changeset
   684
        }
hgs
parents:
diff changeset
   685
    }
hgs
parents:
diff changeset
   686
}
hgs
parents:
diff changeset
   687
hgs
parents:
diff changeset
   688
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   689
// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
hgs
parents:
diff changeset
   690
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   691
//
hgs
parents:
diff changeset
   692
void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
hgs
parents:
diff changeset
   693
hgs
parents:
diff changeset
   694
{
hgs
parents:
diff changeset
   695
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleTappedOnScreen()"));
hgs
parents:
diff changeset
   696
hgs
parents:
diff changeset
   697
    //
40
hgs
parents: 39
diff changeset
   698
    // If we are in full screen view, toggle the visibility when playing and paused
hgs
parents: 39
diff changeset
   699
    // If we are in details view, issue playpause
hgs
parents: 39
diff changeset
   700
    // If we are in audio only view, ignore
30
hgs
parents:
diff changeset
   701
    //
40
hgs
parents: 39
diff changeset
   702
    switch( mViewMode )
30
hgs
parents:
diff changeset
   703
    {
40
hgs
parents: 39
diff changeset
   704
        case EFullScreenView:
30
hgs
parents:
diff changeset
   705
        {
40
hgs
parents: 39
diff changeset
   706
            if ( mState == EPbStatePlaying || mState == EPbStatePaused )
30
hgs
parents:
diff changeset
   707
            {
40
hgs
parents: 39
diff changeset
   708
                if ( isVisible() )
30
hgs
parents:
diff changeset
   709
                {
40
hgs
parents: 39
diff changeset
   710
                    //
hgs
parents: 39
diff changeset
   711
                    // If the volume control is visible, hide it
hgs
parents: 39
diff changeset
   712
                    //
hgs
parents: 39
diff changeset
   713
                    if ( mVolumeControl->isVisible() )
hgs
parents: 39
diff changeset
   714
                    {
hgs
parents: 39
diff changeset
   715
                        mVolumeControl->setVisible( false );
hgs
parents: 39
diff changeset
   716
                    }
hgs
parents: 39
diff changeset
   717
hgs
parents: 39
diff changeset
   718
                    hideAllControls();
30
hgs
parents:
diff changeset
   719
                }
40
hgs
parents: 39
diff changeset
   720
                else
hgs
parents: 39
diff changeset
   721
                {
hgs
parents: 39
diff changeset
   722
                    showControls();
hgs
parents: 39
diff changeset
   723
                }
30
hgs
parents:
diff changeset
   724
            }
40
hgs
parents: 39
diff changeset
   725
hgs
parents: 39
diff changeset
   726
            break;
hgs
parents: 39
diff changeset
   727
        }
hgs
parents: 39
diff changeset
   728
        case EDetailsView:
hgs
parents: 39
diff changeset
   729
        {
hgs
parents: 39
diff changeset
   730
            handleCommand( EMPXPbvCmdPlayPause );
hgs
parents: 39
diff changeset
   731
hgs
parents: 39
diff changeset
   732
            break;
30
hgs
parents:
diff changeset
   733
        }
hgs
parents:
diff changeset
   734
    }
hgs
parents:
diff changeset
   735
}
hgs
parents:
diff changeset
   736
hgs
parents:
diff changeset
   737
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   738
// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
hgs
parents:
diff changeset
   739
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   740
//
hgs
parents:
diff changeset
   741
void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
hgs
parents:
diff changeset
   742
{
hgs
parents:
diff changeset
   743
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()"));
hgs
parents:
diff changeset
   744
hgs
parents:
diff changeset
   745
    if ( mControlsTimer->isActive() )
hgs
parents:
diff changeset
   746
    {
hgs
parents:
diff changeset
   747
        mControlsTimer->stop();
hgs
parents:
diff changeset
   748
    }
hgs
parents:
diff changeset
   749
hgs
parents:
diff changeset
   750
    //
hgs
parents:
diff changeset
   751
    //  Do not start the time for DetailsView and AudioOnlyView
hgs
parents:
diff changeset
   752
    //
hgs
parents:
diff changeset
   753
    if ( timerAction == EMPXTimerReset &&
hgs
parents:
diff changeset
   754
         mState == EPbStatePlaying &&
hgs
parents:
diff changeset
   755
         mViewMode == EFullScreenView )
hgs
parents:
diff changeset
   756
    {
hgs
parents:
diff changeset
   757
        MPX_DEBUG(_L("    Starting Controls Timer"));
hgs
parents:
diff changeset
   758
hgs
parents:
diff changeset
   759
        mControlsTimer->start();
hgs
parents:
diff changeset
   760
    }
hgs
parents:
diff changeset
   761
}
hgs
parents:
diff changeset
   762
hgs
parents:
diff changeset
   763
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   764
//   QMPXVideoPlaybackControlsController::hideAllControls()
hgs
parents:
diff changeset
   765
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   766
//
hgs
parents:
diff changeset
   767
void QMPXVideoPlaybackControlsController::hideAllControls()
hgs
parents:
diff changeset
   768
{
hgs
parents:
diff changeset
   769
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::hideControls()"));
hgs
parents:
diff changeset
   770
hgs
parents:
diff changeset
   771
    resetDisappearingTimers( EMPXTimerCancel );
hgs
parents:
diff changeset
   772
hgs
parents:
diff changeset
   773
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   774
    {
hgs
parents:
diff changeset
   775
        mControls[i]->setVisible( false );
hgs
parents:
diff changeset
   776
    }
hgs
parents:
diff changeset
   777
}
hgs
parents:
diff changeset
   778
hgs
parents:
diff changeset
   779
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   780
//   QMPXVideoPlaybackControlsController::showControls()
hgs
parents:
diff changeset
   781
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   782
//
hgs
parents:
diff changeset
   783
void QMPXVideoPlaybackControlsController::showControls()
hgs
parents:
diff changeset
   784
{
hgs
parents:
diff changeset
   785
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::showControls()"));
hgs
parents:
diff changeset
   786
hgs
parents:
diff changeset
   787
    resetDisappearingTimers( EMPXTimerReset );
hgs
parents:
diff changeset
   788
38
hgs
parents: 37
diff changeset
   789
    if ( ! mViewTransitionIsGoingOn && mOrientation == Qt::Horizontal )
30
hgs
parents:
diff changeset
   790
    {
hgs
parents:
diff changeset
   791
        for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   792
        {
hgs
parents:
diff changeset
   793
            mControls[i]->setVisibility( mState );
hgs
parents:
diff changeset
   794
        }
40
hgs
parents: 39
diff changeset
   795
    }
30
hgs
parents:
diff changeset
   796
}
hgs
parents:
diff changeset
   797
hgs
parents:
diff changeset
   798
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   799
//   QMPXVideoPlaybackControlsController::isVisible()
hgs
parents:
diff changeset
   800
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   801
//
hgs
parents:
diff changeset
   802
bool QMPXVideoPlaybackControlsController::isVisible()
hgs
parents:
diff changeset
   803
{
38
hgs
parents: 37
diff changeset
   804
    bool visible = false;
30
hgs
parents:
diff changeset
   805
hgs
parents:
diff changeset
   806
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   807
    {
35
hgs
parents: 34
diff changeset
   808
        if ( mControls[i]->controlIndex() == EMPXControlBar )
30
hgs
parents:
diff changeset
   809
        {
hgs
parents:
diff changeset
   810
            if ( mControls[i]->isVisible() )
hgs
parents:
diff changeset
   811
            {
38
hgs
parents: 37
diff changeset
   812
                visible = true;
30
hgs
parents:
diff changeset
   813
            }
hgs
parents:
diff changeset
   814
hgs
parents:
diff changeset
   815
            break;
hgs
parents:
diff changeset
   816
        }
hgs
parents:
diff changeset
   817
    }
hgs
parents:
diff changeset
   818
hgs
parents:
diff changeset
   819
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isVisible() [%d]"), visible);
hgs
parents:
diff changeset
   820
hgs
parents:
diff changeset
   821
    return visible;
hgs
parents:
diff changeset
   822
}
hgs
parents:
diff changeset
   823
hgs
parents:
diff changeset
   824
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   825
//   QMPXVideoPlaybackControlsController::handleCommand()
hgs
parents:
diff changeset
   826
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   827
//
40
hgs
parents: 39
diff changeset
   828
void QMPXVideoPlaybackControlsController::handleCommand(
30
hgs
parents:
diff changeset
   829
        TMPXVideoPlaybackViewCommandIds command, int value )
hgs
parents:
diff changeset
   830
{
hgs
parents:
diff changeset
   831
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
hgs
parents:
diff changeset
   832
hgs
parents:
diff changeset
   833
    switch( command )
hgs
parents:
diff changeset
   834
    {
hgs
parents:
diff changeset
   835
        case EMPXPbvCmdSetPosition:
hgs
parents:
diff changeset
   836
        {
40
hgs
parents: 39
diff changeset
   837
            TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyPosition,
30
hgs
parents:
diff changeset
   838
                                                     value * KPbMilliMultiplier ) );
hgs
parents:
diff changeset
   839
            break;
hgs
parents:
diff changeset
   840
        }
hgs
parents:
diff changeset
   841
        case EMPXPbvCmdSetVolume:
hgs
parents:
diff changeset
   842
        {
hgs
parents:
diff changeset
   843
            TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyVolume, value ) );
40
hgs
parents: 39
diff changeset
   844
            break;
30
hgs
parents:
diff changeset
   845
        }
hgs
parents:
diff changeset
   846
        default:
hgs
parents:
diff changeset
   847
        {
hgs
parents:
diff changeset
   848
            TRAP_IGNORE( mViewWrapper->HandleCommandL( command ) );
hgs
parents:
diff changeset
   849
            break;
hgs
parents:
diff changeset
   850
        }
hgs
parents:
diff changeset
   851
    }
hgs
parents:
diff changeset
   852
}
hgs
parents:
diff changeset
   853
hgs
parents:
diff changeset
   854
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   855
//   QMPXVideoPlaybackControlsController::volumeChanged()
hgs
parents:
diff changeset
   856
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   857
//
hgs
parents:
diff changeset
   858
void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
hgs
parents:
diff changeset
   859
{
hgs
parents:
diff changeset
   860
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::volumeChanged() [%d]"), volume);
hgs
parents:
diff changeset
   861
hgs
parents:
diff changeset
   862
    if ( mVolumeControl )
hgs
parents:
diff changeset
   863
    {
hgs
parents:
diff changeset
   864
        mVolumeControl->setValue( volume );
hgs
parents:
diff changeset
   865
    }
hgs
parents:
diff changeset
   866
}
hgs
parents:
diff changeset
   867
hgs
parents:
diff changeset
   868
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   869
//   QMPXVideoPlaybackControlsController::showVolumeControls()
hgs
parents:
diff changeset
   870
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   871
//
hgs
parents:
diff changeset
   872
void QMPXVideoPlaybackControlsController::showVolumeControls()
hgs
parents:
diff changeset
   873
{
hgs
parents:
diff changeset
   874
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::showVolumeControls()"));
hgs
parents:
diff changeset
   875
hgs
parents:
diff changeset
   876
    if ( mVolumeControl )
hgs
parents:
diff changeset
   877
    {
hgs
parents:
diff changeset
   878
        mVolumeControl->setVisible( true );
hgs
parents:
diff changeset
   879
    }
hgs
parents:
diff changeset
   880
}
hgs
parents:
diff changeset
   881
hgs
parents:
diff changeset
   882
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   883
//   QMPXVideoPlaybackControlsController::durationChanged()
hgs
parents:
diff changeset
   884
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   885
//
hgs
parents:
diff changeset
   886
void QMPXVideoPlaybackControlsController::durationChanged( int duration )
hgs
parents:
diff changeset
   887
{
hgs
parents:
diff changeset
   888
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::durationChanged() [%d]"), duration);
hgs
parents:
diff changeset
   889
hgs
parents:
diff changeset
   890
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   891
    {
hgs
parents:
diff changeset
   892
        if ( mControls[i]->durationChanged( duration ) )
hgs
parents:
diff changeset
   893
        {
hgs
parents:
diff changeset
   894
            break;
hgs
parents:
diff changeset
   895
        }
hgs
parents:
diff changeset
   896
    }
hgs
parents:
diff changeset
   897
}
hgs
parents:
diff changeset
   898
hgs
parents:
diff changeset
   899
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   900
//   QMPXVideoPlaybackControlsController::positionChanged()
hgs
parents:
diff changeset
   901
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   902
//
hgs
parents:
diff changeset
   903
void QMPXVideoPlaybackControlsController::positionChanged( int position )
hgs
parents:
diff changeset
   904
{
hgs
parents:
diff changeset
   905
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::positionChanged() [%d]"), position);
hgs
parents:
diff changeset
   906
hgs
parents:
diff changeset
   907
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   908
    {
hgs
parents:
diff changeset
   909
        if ( mControls[i]->positionChanged( position ) )
hgs
parents:
diff changeset
   910
        {
hgs
parents:
diff changeset
   911
            break;
hgs
parents:
diff changeset
   912
        }
hgs
parents:
diff changeset
   913
    }
hgs
parents:
diff changeset
   914
}
hgs
parents:
diff changeset
   915
hgs
parents:
diff changeset
   916
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   917
//   QMPXVideoPlaybackControlsController::aspectRatioChanged()
hgs
parents:
diff changeset
   918
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   919
//
hgs
parents:
diff changeset
   920
void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
hgs
parents:
diff changeset
   921
{
hgs
parents:
diff changeset
   922
    MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::aspectRatioChanged() [%d]"), aspectRatio);
hgs
parents:
diff changeset
   923
hgs
parents:
diff changeset
   924
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   925
    {
hgs
parents:
diff changeset
   926
        if ( mControls[i]->aspectRatioChanged( aspectRatio ) )
hgs
parents:
diff changeset
   927
        {
hgs
parents:
diff changeset
   928
            break;
hgs
parents:
diff changeset
   929
        }
hgs
parents:
diff changeset
   930
    }
hgs
parents:
diff changeset
   931
}
hgs
parents:
diff changeset
   932
hgs
parents:
diff changeset
   933
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   934
//   QMPXVideoPlaybackControlsController::updateState()
hgs
parents:
diff changeset
   935
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   936
//
hgs
parents:
diff changeset
   937
void QMPXVideoPlaybackControlsController::updateState()
hgs
parents:
diff changeset
   938
{
hgs
parents:
diff changeset
   939
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateState() [%d]"), mState);
hgs
parents:
diff changeset
   940
hgs
parents:
diff changeset
   941
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
   942
    {
hgs
parents:
diff changeset
   943
        mControls[i]->updateState( mState );
hgs
parents:
diff changeset
   944
    }
hgs
parents:
diff changeset
   945
}
hgs
parents:
diff changeset
   946
hgs
parents:
diff changeset
   947
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   948
// QMPXVideoPlaybackControlsController::realFormat()
hgs
parents:
diff changeset
   949
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   950
//
hgs
parents:
diff changeset
   951
bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
hgs
parents:
diff changeset
   952
{
38
hgs
parents: 37
diff changeset
   953
    bool realFormat = false;
30
hgs
parents:
diff changeset
   954
hgs
parents:
diff changeset
   955
    if ( !filename.isNull() && !filename.isEmpty() )
hgs
parents:
diff changeset
   956
    {
hgs
parents:
diff changeset
   957
        if ( mFileDetails->mPlaybackMode == EMPXVideoStreaming ||
hgs
parents:
diff changeset
   958
             mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming )
hgs
parents:
diff changeset
   959
        {
hgs
parents:
diff changeset
   960
            TBufC<255> file(filename.utf16());
hgs
parents:
diff changeset
   961
            realFormat = realFormatForStreaming( file );
hgs
parents:
diff changeset
   962
        }
hgs
parents:
diff changeset
   963
        else
hgs
parents:
diff changeset
   964
        {
hgs
parents:
diff changeset
   965
            realFormat = realFormatForLocal();
hgs
parents:
diff changeset
   966
        }
hgs
parents:
diff changeset
   967
    }
hgs
parents:
diff changeset
   968
hgs
parents:
diff changeset
   969
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormat() [%d]"), realFormat);
hgs
parents:
diff changeset
   970
hgs
parents:
diff changeset
   971
    return realFormat;
hgs
parents:
diff changeset
   972
}
hgs
parents:
diff changeset
   973
hgs
parents:
diff changeset
   974
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   975
// QMPXVideoPlaybackControlsController::realFormatForStreaming()
hgs
parents:
diff changeset
   976
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
   977
//
hgs
parents:
diff changeset
   978
bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
hgs
parents:
diff changeset
   979
{
38
hgs
parents: 37
diff changeset
   980
    bool realFormat = false;
30
hgs
parents:
diff changeset
   981
    TParse filePath;
hgs
parents:
diff changeset
   982
hgs
parents:
diff changeset
   983
    _LIT(KMPXRMEXT, ".R" );
hgs
parents:
diff changeset
   984
hgs
parents:
diff changeset
   985
    int err = filePath.Set( des, NULL, NULL );
hgs
parents:
diff changeset
   986
hgs
parents:
diff changeset
   987
    //
hgs
parents:
diff changeset
   988
    // It is valid to have a "\" character in a url, but parsing fails,
hgs
parents:
diff changeset
   989
    // switch these characters to "/" for the local string and try parsing again.
hgs
parents:
diff changeset
   990
    //
hgs
parents:
diff changeset
   991
    if ( err == KErrBadName )
hgs
parents:
diff changeset
   992
    {
hgs
parents:
diff changeset
   993
        int backsashPos = des.LocateF('\\');
hgs
parents:
diff changeset
   994
hgs
parents:
diff changeset
   995
        if( backsashPos != KErrNotFound )
hgs
parents:
diff changeset
   996
        {
hgs
parents:
diff changeset
   997
            HBufC* fileName = NULL;
hgs
parents:
diff changeset
   998
hgs
parents:
diff changeset
   999
            TRAP( err,  fileName = des.AllocL() );
hgs
parents:
diff changeset
  1000
hgs
parents:
diff changeset
  1001
            if ( err == KErrNone )
hgs
parents:
diff changeset
  1002
            {
hgs
parents:
diff changeset
  1003
                int count( fileName->Des().Length() );
hgs
parents:
diff changeset
  1004
hgs
parents:
diff changeset
  1005
                for ( int j = backsashPos ; j < count; ++j )
hgs
parents:
diff changeset
  1006
                {
hgs
parents:
diff changeset
  1007
                    if ( fileName->Des()[j]== '\\' )
hgs
parents:
diff changeset
  1008
                    {
hgs
parents:
diff changeset
  1009
                        fileName->Des()[j]='/';
hgs
parents:
diff changeset
  1010
                    }
hgs
parents:
diff changeset
  1011
                }
40
hgs
parents: 39
diff changeset
  1012
                err = filePath.Set( fileName->Des(), NULL, NULL );
30
hgs
parents:
diff changeset
  1013
            }
hgs
parents:
diff changeset
  1014
hgs
parents:
diff changeset
  1015
            if ( fileName )
hgs
parents:
diff changeset
  1016
            {
hgs
parents:
diff changeset
  1017
                delete fileName;
hgs
parents:
diff changeset
  1018
                fileName = NULL;
hgs
parents:
diff changeset
  1019
            }
hgs
parents:
diff changeset
  1020
        }
hgs
parents:
diff changeset
  1021
    }
hgs
parents:
diff changeset
  1022
hgs
parents:
diff changeset
  1023
    if ( err == KErrNone )
hgs
parents:
diff changeset
  1024
    {
hgs
parents:
diff changeset
  1025
        //
hgs
parents:
diff changeset
  1026
        // The requirement to support arguments with the extension in streaming links
hgs
parents:
diff changeset
  1027
        // for-ex: /video.3gp?start=10&end=40 will have to supported
hgs
parents:
diff changeset
  1028
        // as well. So just by doing p.Ext() would retrieve all the string
hgs
parents:
diff changeset
  1029
        // after "." so by doing a Left(2) would retrieve only
hgs
parents:
diff changeset
  1030
        // .3g or .rm and so on. This would help better
hgs
parents:
diff changeset
  1031
        // interpret the extension and decide the branding accordingly
hgs
parents:
diff changeset
  1032
        //
hgs
parents:
diff changeset
  1033
        filePath.Set( filePath.NameAndExt(), NULL, NULL );
hgs
parents:
diff changeset
  1034
        TPtrC extension = filePath.Ext().Left( 2 );
hgs
parents:
diff changeset
  1035
hgs
parents:
diff changeset
  1036
        TBuf<2> buf;
hgs
parents:
diff changeset
  1037
        buf.Format( extension );
hgs
parents:
diff changeset
  1038
        buf.UpperCase();
hgs
parents:
diff changeset
  1039
hgs
parents:
diff changeset
  1040
        // RealMedia Branding
hgs
parents:
diff changeset
  1041
        if ( ! buf.Compare( KMPXRMEXT ) )
hgs
parents:
diff changeset
  1042
        {
38
hgs
parents: 37
diff changeset
  1043
            realFormat = true;
30
hgs
parents:
diff changeset
  1044
        }
hgs
parents:
diff changeset
  1045
    }
hgs
parents:
diff changeset
  1046
hgs
parents:
diff changeset
  1047
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormatForStreaming()[%d]"), realFormat);
hgs
parents:
diff changeset
  1048
hgs
parents:
diff changeset
  1049
    return realFormat;
hgs
parents:
diff changeset
  1050
}
hgs
parents:
diff changeset
  1051
hgs
parents:
diff changeset
  1052
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1053
// QMPXVideoPlaybackControlsController::realFormatForLocal()
hgs
parents:
diff changeset
  1054
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1055
//
hgs
parents:
diff changeset
  1056
bool QMPXVideoPlaybackControlsController::realFormatForLocal()
hgs
parents:
diff changeset
  1057
{
hgs
parents:
diff changeset
  1058
    bool realFormat = false;
40
hgs
parents: 39
diff changeset
  1059
30
hgs
parents:
diff changeset
  1060
    QString real( "real" );
hgs
parents:
diff changeset
  1061
    QString rn( "rn" );
40
hgs
parents: 39
diff changeset
  1062
30
hgs
parents:
diff changeset
  1063
    if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) ||
hgs
parents:
diff changeset
  1064
         mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) )
hgs
parents:
diff changeset
  1065
    {
hgs
parents:
diff changeset
  1066
        realFormat = true;
hgs
parents:
diff changeset
  1067
    }
38
hgs
parents: 37
diff changeset
  1068
30
hgs
parents:
diff changeset
  1069
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormatForLocal() [%d]"), realFormat);
hgs
parents:
diff changeset
  1070
hgs
parents:
diff changeset
  1071
    return realFormat;
hgs
parents:
diff changeset
  1072
}
hgs
parents:
diff changeset
  1073
hgs
parents:
diff changeset
  1074
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1075
//   QMPXVideoPlaybackControlsController::setDownloadSize()
hgs
parents:
diff changeset
  1076
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1077
//
hgs
parents:
diff changeset
  1078
void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
hgs
parents:
diff changeset
  1079
{
hgs
parents:
diff changeset
  1080
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::setDownloadSize() [%d]"), size);
hgs
parents:
diff changeset
  1081
hgs
parents:
diff changeset
  1082
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
  1083
    {
hgs
parents:
diff changeset
  1084
        if ( mControls[i]->setDownloadSize( size ) )
hgs
parents:
diff changeset
  1085
        {
hgs
parents:
diff changeset
  1086
            break;
hgs
parents:
diff changeset
  1087
        }
hgs
parents:
diff changeset
  1088
    }
hgs
parents:
diff changeset
  1089
}
hgs
parents:
diff changeset
  1090
hgs
parents:
diff changeset
  1091
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1092
//   QMPXVideoPlaybackControlsController::updateDownloadPosition()
hgs
parents:
diff changeset
  1093
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1094
//
hgs
parents:
diff changeset
  1095
void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
hgs
parents:
diff changeset
  1096
{
hgs
parents:
diff changeset
  1097
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateDownloadPosition() [%d]"), size);
hgs
parents:
diff changeset
  1098
hgs
parents:
diff changeset
  1099
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
  1100
    {
hgs
parents:
diff changeset
  1101
        if ( mControls[i]->updateDownloadPosition( size ) )
hgs
parents:
diff changeset
  1102
        {
hgs
parents:
diff changeset
  1103
            break;
hgs
parents:
diff changeset
  1104
        }
hgs
parents:
diff changeset
  1105
    }
hgs
parents:
diff changeset
  1106
}
hgs
parents:
diff changeset
  1107
hgs
parents:
diff changeset
  1108
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1109
// QMPXVideoPlaybackControlsController::handleErrors
hgs
parents:
diff changeset
  1110
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1111
//
hgs
parents:
diff changeset
  1112
void QMPXVideoPlaybackControlsController::handleErrors()
hgs
parents:
diff changeset
  1113
{
hgs
parents:
diff changeset
  1114
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleErrors()"),
hgs
parents:
diff changeset
  1115
                   _L("mState = %d"), mState );
hgs
parents:
diff changeset
  1116
}
hgs
parents:
diff changeset
  1117
hgs
parents:
diff changeset
  1118
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1119
//   QMPXVideoPlaybackControlsController::isSoftKeyVisible()
hgs
parents:
diff changeset
  1120
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1121
//
39
hgs
parents: 38
diff changeset
  1122
bool QMPXVideoPlaybackControlsController::isSoftKeyVisible()
30
hgs
parents:
diff changeset
  1123
{
38
hgs
parents: 37
diff changeset
  1124
    bool visible = false;
30
hgs
parents:
diff changeset
  1125
hgs
parents:
diff changeset
  1126
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents:
diff changeset
  1127
    {
hgs
parents:
diff changeset
  1128
        if ( mControls[i]->controlIndex() == EMPXStatusPane )
hgs
parents:
diff changeset
  1129
        {
hgs
parents:
diff changeset
  1130
            if ( mControls[i]->isVisible() )
hgs
parents:
diff changeset
  1131
            {
38
hgs
parents: 37
diff changeset
  1132
                visible = true;
30
hgs
parents:
diff changeset
  1133
            }
hgs
parents:
diff changeset
  1134
hgs
parents:
diff changeset
  1135
            break;
hgs
parents:
diff changeset
  1136
        }
hgs
parents:
diff changeset
  1137
    }
hgs
parents:
diff changeset
  1138
hgs
parents:
diff changeset
  1139
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isSoftKeyVisible() [%d]"), visible);
hgs
parents:
diff changeset
  1140
hgs
parents:
diff changeset
  1141
    return visible;
hgs
parents:
diff changeset
  1142
}
hgs
parents:
diff changeset
  1143
hgs
parents:
diff changeset
  1144
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1145
//   QMPXVideoPlaybackControlsController::handleTvOutEvent
hgs
parents:
diff changeset
  1146
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1147
//
hgs
parents:
diff changeset
  1148
void QMPXVideoPlaybackControlsController::handleTvOutEvent(
37
hgs
parents: 36
diff changeset
  1149
        bool connected, TMPXVideoPlaybackControlCommandIds event )
30
hgs
parents:
diff changeset
  1150
{
hgs
parents:
diff changeset
  1151
    Q_UNUSED( event );
hgs
parents:
diff changeset
  1152
hgs
parents:
diff changeset
  1153
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleTvOutEvent()"));
hgs
parents:
diff changeset
  1154
hgs
parents:
diff changeset
  1155
    mFileDetails->mTvOutConnected = connected;
hgs
parents:
diff changeset
  1156
hgs
parents:
diff changeset
  1157
    setDefaultBitmap();
hgs
parents:
diff changeset
  1158
hgs
parents:
diff changeset
  1159
    if ( mFileDetails->mTvOutConnected )
hgs
parents:
diff changeset
  1160
    {
hgs
parents:
diff changeset
  1161
        generateThumbNail();
hgs
parents:
diff changeset
  1162
    }
hgs
parents:
diff changeset
  1163
hgs
parents:
diff changeset
  1164
    //
40
hgs
parents: 39
diff changeset
  1165
    // Change the view.
30
hgs
parents:
diff changeset
  1166
    // If Tv-out is connected, go to AudioOnlyView.
hgs
parents:
diff changeset
  1167
    // If not, go back to default view.
hgs
parents:
diff changeset
  1168
    //
hgs
parents:
diff changeset
  1169
    TPlaybackViewMode viewMode = EFullScreenView;
hgs
parents:
diff changeset
  1170
hgs
parents:
diff changeset
  1171
    if ( mFileDetails->mTvOutConnected || ! mFileDetails->mVideoEnabled )
hgs
parents:
diff changeset
  1172
    {
hgs
parents:
diff changeset
  1173
        viewMode = EAudioOnlyView;
hgs
parents:
diff changeset
  1174
    }
hgs
parents:
diff changeset
  1175
hgs
parents:
diff changeset
  1176
    changeViewMode( viewMode, false );
hgs
parents:
diff changeset
  1177
}
hgs
parents:
diff changeset
  1178
hgs
parents:
diff changeset
  1179
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1180
//   QMPXVideoPlaybackControlsController::changeViewMode
hgs
parents:
diff changeset
  1181
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1182
//
40
hgs
parents: 39
diff changeset
  1183
void QMPXVideoPlaybackControlsController::changeViewMode(
30
hgs
parents:
diff changeset
  1184
        TPlaybackViewMode viewMode, bool transitionEffect )
hgs
parents:
diff changeset
  1185
{
36
hgs
parents: 35
diff changeset
  1186
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode( %d, %d )"),
hgs
parents: 35
diff changeset
  1187
            viewMode, transitionEffect );
30
hgs
parents:
diff changeset
  1188
hgs
parents:
diff changeset
  1189
    if ( viewMode != mViewMode )
hgs
parents:
diff changeset
  1190
    {
hgs
parents:
diff changeset
  1191
        switch ( viewMode )
hgs
parents:
diff changeset
  1192
        {
hgs
parents:
diff changeset
  1193
            case EFullScreenView:
hgs
parents:
diff changeset
  1194
            case EDetailsView:
hgs
parents:
diff changeset
  1195
            {
hgs
parents:
diff changeset
  1196
                if ( mFileDetails->mVideoEnabled && ! mFileDetails->mTvOutConnected )
hgs
parents:
diff changeset
  1197
                {
hgs
parents:
diff changeset
  1198
                    mViewMode = viewMode;
hgs
parents:
diff changeset
  1199
hgs
parents:
diff changeset
  1200
                    //
hgs
parents:
diff changeset
  1201
                    // Hack to clean up the screen before transition. We may not need it in NGA env
hgs
parents:
diff changeset
  1202
                    //
hgs
parents:
diff changeset
  1203
                    hideAllControls();
hgs
parents:
diff changeset
  1204
hgs
parents:
diff changeset
  1205
                    updateVideoRect( transitionEffect );
hgs
parents:
diff changeset
  1206
                }
hgs
parents:
diff changeset
  1207
hgs
parents:
diff changeset
  1208
                break;
hgs
parents:
diff changeset
  1209
            }
hgs
parents:
diff changeset
  1210
            case EAudioOnlyView:
hgs
parents:
diff changeset
  1211
            {
hgs
parents:
diff changeset
  1212
                if ( ! mFileDetails->mVideoEnabled || mFileDetails->mTvOutConnected )
hgs
parents:
diff changeset
  1213
                {
hgs
parents:
diff changeset
  1214
                    mViewMode = viewMode;
hgs
parents:
diff changeset
  1215
hgs
parents:
diff changeset
  1216
                    mControlsConfig->updateControlList( EMPXControlCmdAudionOnlyViewOpened );
hgs
parents:
diff changeset
  1217
                }
hgs
parents:
diff changeset
  1218
hgs
parents:
diff changeset
  1219
                break;
hgs
parents:
diff changeset
  1220
            }
hgs
parents:
diff changeset
  1221
            default:
hgs
parents:
diff changeset
  1222
            {
hgs
parents:
diff changeset
  1223
                break;
hgs
parents:
diff changeset
  1224
            }
hgs
parents:
diff changeset
  1225
        }
hgs
parents:
diff changeset
  1226
    }
hgs
parents:
diff changeset
  1227
}
hgs
parents:
diff changeset
  1228
hgs
parents:
diff changeset
  1229
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1230
//   QMPXVideoPlaybackControlsController::updateVideoRectDone
hgs
parents:
diff changeset
  1231
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1232
//
hgs
parents:
diff changeset
  1233
void QMPXVideoPlaybackControlsController::updateVideoRectDone()
hgs
parents:
diff changeset
  1234
{
hgs
parents:
diff changeset
  1235
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRectDone()"));
hgs
parents:
diff changeset
  1236
hgs
parents:
diff changeset
  1237
    mViewTransitionIsGoingOn = false;
hgs
parents:
diff changeset
  1238
hgs
parents:
diff changeset
  1239
    TMPXVideoPlaybackControlCommandIds event = EMPXControlCmdFullScreenViewOpened;
hgs
parents:
diff changeset
  1240
hgs
parents:
diff changeset
  1241
    if ( mViewMode == EDetailsView )
hgs
parents:
diff changeset
  1242
    {
hgs
parents:
diff changeset
  1243
        event = EMPXControlCmdDetailsViewOpened;
hgs
parents:
diff changeset
  1244
    }
hgs
parents:
diff changeset
  1245
hgs
parents:
diff changeset
  1246
    mControlsConfig->updateControlList( event );
hgs
parents:
diff changeset
  1247
}
hgs
parents:
diff changeset
  1248
hgs
parents:
diff changeset
  1249
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1250
//   QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
hgs
parents:
diff changeset
  1251
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1252
//
hgs
parents:
diff changeset
  1253
void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
hgs
parents:
diff changeset
  1254
{
hgs
parents:
diff changeset
  1255
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()"));
hgs
parents:
diff changeset
  1256
40
hgs
parents: 39
diff changeset
  1257
    if ( mViewMode == EFullScreenView )
hgs
parents: 39
diff changeset
  1258
    {
hgs
parents: 39
diff changeset
  1259
        handleCommand( EMPXPbvCmdPreviousListItem );
hgs
parents: 39
diff changeset
  1260
    }
30
hgs
parents:
diff changeset
  1261
}
hgs
parents:
diff changeset
  1262
hgs
parents:
diff changeset
  1263
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1264
//   QMPXVideoPlaybackControlsController::skipToNextVideoItem
hgs
parents:
diff changeset
  1265
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1266
//
hgs
parents:
diff changeset
  1267
void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
hgs
parents:
diff changeset
  1268
{
hgs
parents:
diff changeset
  1269
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToNextVideoItem()"));
hgs
parents:
diff changeset
  1270
40
hgs
parents: 39
diff changeset
  1271
    if ( mViewMode == EFullScreenView )
hgs
parents: 39
diff changeset
  1272
    {
hgs
parents: 39
diff changeset
  1273
        handleCommand( EMPXPbvCmdNextListItem );
hgs
parents: 39
diff changeset
  1274
    }
30
hgs
parents:
diff changeset
  1275
}
hgs
parents:
diff changeset
  1276
hgs
parents:
diff changeset
  1277
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1278
//   QMPXVideoPlaybackControlsController::updateVideoRect()
hgs
parents:
diff changeset
  1279
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1280
//
hgs
parents:
diff changeset
  1281
void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
hgs
parents:
diff changeset
  1282
{
36
hgs
parents: 35
diff changeset
  1283
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRect( %d )"),
hgs
parents: 35
diff changeset
  1284
            transitionEffect );
30
hgs
parents:
diff changeset
  1285
hgs
parents:
diff changeset
  1286
    if ( mFileDetails->mVideoEnabled && ! mFileDetails->mTvOutConnected )
hgs
parents:
diff changeset
  1287
    {
hgs
parents:
diff changeset
  1288
        mViewTransitionIsGoingOn = true;
hgs
parents:
diff changeset
  1289
hgs
parents:
diff changeset
  1290
        QRectF rect;
hgs
parents:
diff changeset
  1291
36
hgs
parents: 35
diff changeset
  1292
        MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRect() : mViewMode = %d )"),
hgs
parents: 35
diff changeset
  1293
                mViewMode );
40
hgs
parents: 39
diff changeset
  1294
30
hgs
parents:
diff changeset
  1295
        if ( mViewMode == EDetailsView )
hgs
parents:
diff changeset
  1296
        {
hgs
parents:
diff changeset
  1297
            QGraphicsWidget *parent = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
hgs
parents:
diff changeset
  1298
            QGraphicsWidget *child = mLoader->findWidget( QString( "small_transparentWindow" ) );
hgs
parents:
diff changeset
  1299
hgs
parents:
diff changeset
  1300
            rect = parent->mapRectToScene( child->geometry() );
hgs
parents:
diff changeset
  1301
        }
hgs
parents:
diff changeset
  1302
        else if ( mViewMode == EFullScreenView )
hgs
parents:
diff changeset
  1303
        {
hgs
parents:
diff changeset
  1304
            QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
hgs
parents:
diff changeset
  1305
            rect = widget->geometry();
hgs
parents:
diff changeset
  1306
        }
hgs
parents:
diff changeset
  1307
40
hgs
parents: 39
diff changeset
  1308
        mViewWrapper->UpdateVideoRect(
30
hgs
parents:
diff changeset
  1309
                rect.x(), rect.y(), rect.width(), rect.height(), transitionEffect );
hgs
parents:
diff changeset
  1310
    }
hgs
parents:
diff changeset
  1311
}
hgs
parents:
diff changeset
  1312
hgs
parents:
diff changeset
  1313
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1314
//   QMPXVideoPlaybackControlsController::setDefaultBitmap()
hgs
parents:
diff changeset
  1315
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1316
//
hgs
parents:
diff changeset
  1317
void QMPXVideoPlaybackControlsController::setDefaultBitmap()
hgs
parents:
diff changeset
  1318
{
hgs
parents:
diff changeset
  1319
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::setDefaultBitmap()"));
hgs
parents:
diff changeset
  1320
hgs
parents:
diff changeset
  1321
    //
hgs
parents:
diff changeset
  1322
    // set specific bitmaps for audio only and tv out cases
hgs
parents:
diff changeset
  1323
    // If we already requested a thumbnail, we will set the thumbnail after we receive the thumbnail
hgs
parents:
diff changeset
  1324
    //
hgs
parents:
diff changeset
  1325
    if ( mLoader && mThumbNailState != EThumbNailRequsted )
hgs
parents:
diff changeset
  1326
    {
hgs
parents:
diff changeset
  1327
        QGraphicsWidget *tvOutBitmap = mLoader->findWidget( "tvOutBitmap" );
hgs
parents:
diff changeset
  1328
        tvOutBitmap->setVisible( false );
hgs
parents:
diff changeset
  1329
hgs
parents:
diff changeset
  1330
        QGraphicsWidget *realAudioOnlyBitmap = mLoader->findWidget( "realAudioOnlyBitmap" );
hgs
parents:
diff changeset
  1331
        realAudioOnlyBitmap->setVisible( false );
hgs
parents:
diff changeset
  1332
hgs
parents:
diff changeset
  1333
        QGraphicsWidget *partialAudioOnlyBitmap = mLoader->findWidget( "partialAudioOnlyBitmap" );
hgs
parents:
diff changeset
  1334
        partialAudioOnlyBitmap->setVisible( false );
hgs
parents:
diff changeset
  1335
hgs
parents:
diff changeset
  1336
        QGraphicsWidget *audioOnlyBitmap = mLoader->findWidget( "audioOnlyBitmap" );
hgs
parents:
diff changeset
  1337
        audioOnlyBitmap->setVisible( false );
hgs
parents:
diff changeset
  1338
hgs
parents:
diff changeset
  1339
        if ( mFileDetails->mTvOutConnected )
hgs
parents:
diff changeset
  1340
        {
hgs
parents:
diff changeset
  1341
            tvOutBitmap->setVisible( true );
hgs
parents:
diff changeset
  1342
        }
40
hgs
parents: 39
diff changeset
  1343
        else if ( mFileDetails->mRNFormat )
30
hgs
parents:
diff changeset
  1344
        {
hgs
parents:
diff changeset
  1345
            realAudioOnlyBitmap->setVisible( true );
hgs
parents:
diff changeset
  1346
        }
hgs
parents:
diff changeset
  1347
        else if ( mFileDetails->mPartialPlayback )
hgs
parents:
diff changeset
  1348
        {
hgs
parents:
diff changeset
  1349
            partialAudioOnlyBitmap->setVisible( true );
hgs
parents:
diff changeset
  1350
        }
hgs
parents:
diff changeset
  1351
        else
hgs
parents:
diff changeset
  1352
        {
hgs
parents:
diff changeset
  1353
            audioOnlyBitmap->setVisible( true );
hgs
parents:
diff changeset
  1354
        }
40
hgs
parents: 39
diff changeset
  1355
    }
30
hgs
parents:
diff changeset
  1356
}
hgs
parents:
diff changeset
  1357
hgs
parents:
diff changeset
  1358
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1359
//   QMPXVideoPlaybackControlsController::generateThumbNail()
hgs
parents:
diff changeset
  1360
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1361
//
hgs
parents:
diff changeset
  1362
void QMPXVideoPlaybackControlsController::generateThumbNail()
hgs
parents:
diff changeset
  1363
{
hgs
parents:
diff changeset
  1364
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::generateThumbNail()"));
hgs
parents:
diff changeset
  1365
hgs
parents:
diff changeset
  1366
    //
hgs
parents:
diff changeset
  1367
    // Generate thumbnail if it is local playback
hgs
parents:
diff changeset
  1368
    //
hgs
parents:
diff changeset
  1369
    if ( mFileDetails->mPlaybackMode == EMPXVideoLocal )
hgs
parents:
diff changeset
  1370
    {
hgs
parents:
diff changeset
  1371
        if ( mThumbNailState == EThumbNailEmpty )
hgs
parents:
diff changeset
  1372
        {
40
hgs
parents: 39
diff changeset
  1373
            mThumbnailManager = new ThumbnailManager(); ;
30
hgs
parents:
diff changeset
  1374
hgs
parents:
diff changeset
  1375
            mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
hgs
parents:
diff changeset
  1376
            mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
40
hgs
parents: 39
diff changeset
  1377
hgs
parents: 39
diff changeset
  1378
            if ( connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
30
hgs
parents:
diff changeset
  1379
                          this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ) )
hgs
parents:
diff changeset
  1380
            {
hgs
parents:
diff changeset
  1381
                mThumbnailManager->getThumbnail( mFileDetails->mClipName );
hgs
parents:
diff changeset
  1382
                mThumbNailState = EThumbNailRequsted;
hgs
parents:
diff changeset
  1383
            }
hgs
parents:
diff changeset
  1384
        }
hgs
parents:
diff changeset
  1385
    }
hgs
parents:
diff changeset
  1386
    else
hgs
parents:
diff changeset
  1387
    {
hgs
parents:
diff changeset
  1388
        mThumbNailState = EThumbNailNotAvailable;
hgs
parents:
diff changeset
  1389
    }
hgs
parents:
diff changeset
  1390
}
hgs
parents:
diff changeset
  1391
hgs
parents:
diff changeset
  1392
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1393
// QMPXVideoPlaybackControlsController::handleThumbnailReady()
hgs
parents:
diff changeset
  1394
// -------------------------------------------------------------------------------------------------
hgs
parents:
diff changeset
  1395
//
40
hgs
parents: 39
diff changeset
  1396
void QMPXVideoPlaybackControlsController::handleThumbnailReady(
30
hgs
parents:
diff changeset
  1397
        QPixmap tnData, void *internal , int id, int error )
hgs
parents:
diff changeset
  1398
{
hgs
parents:
diff changeset
  1399
    Q_UNUSED( internal );
hgs
parents:
diff changeset
  1400
    Q_UNUSED( id );
hgs
parents:
diff changeset
  1401
hgs
parents:
diff changeset
  1402
    if( ! error && mLoader )
hgs
parents:
diff changeset
  1403
    {
hgs
parents:
diff changeset
  1404
        QGraphicsWidget *tvOutBitmap = mLoader->findWidget( "tvOutBitmap" );
hgs
parents:
diff changeset
  1405
        HbLabel *tvOutLabel = qobject_cast<HbLabel*>( tvOutBitmap );
hgs
parents:
diff changeset
  1406
hgs
parents:
diff changeset
  1407
        QIcon *qicon = new QIcon( tnData );
hgs
parents:
diff changeset
  1408
hgs
parents:
diff changeset
  1409
        HbIcon *hbIcon = new HbIcon( *qicon );
hgs
parents:
diff changeset
  1410
        hbIcon->setSize( tvOutBitmap->size() );
hgs
parents:
diff changeset
  1411
        tvOutLabel->setIcon( *hbIcon );
hgs
parents:
diff changeset
  1412
hgs
parents:
diff changeset
  1413
        mThumbNailState = EThumbNailSet;
hgs
parents:
diff changeset
  1414
    }
hgs
parents:
diff changeset
  1415
    else
hgs
parents:
diff changeset
  1416
    {
hgs
parents:
diff changeset
  1417
        mThumbNailState = EThumbNailNotAvailable;
hgs
parents:
diff changeset
  1418
    }
hgs
parents:
diff changeset
  1419
hgs
parents:
diff changeset
  1420
    setDefaultBitmap();
hgs
parents:
diff changeset
  1421
40
hgs
parents: 39
diff changeset
  1422
    disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
30
hgs
parents:
diff changeset
  1423
                this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) );
hgs
parents:
diff changeset
  1424
}
hgs
parents:
diff changeset
  1425
36
hgs
parents: 35
diff changeset
  1426
// -------------------------------------------------------------------------------------------------
hgs
parents: 35
diff changeset
  1427
// QMPXVideoPlaybackControlsController::attachVideo()
hgs
parents: 35
diff changeset
  1428
// -------------------------------------------------------------------------------------------------
hgs
parents: 35
diff changeset
  1429
//
hgs
parents: 35
diff changeset
  1430
void QMPXVideoPlaybackControlsController::attachVideo()
hgs
parents: 35
diff changeset
  1431
{
37
hgs
parents: 36
diff changeset
  1432
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()"),
hgs
parents: 36
diff changeset
  1433
                   _L("file = %s"), mFileDetails->mClipName.data() );
40
hgs
parents: 39
diff changeset
  1434
37
hgs
parents: 36
diff changeset
  1435
    //
hgs
parents: 36
diff changeset
  1436
    // close playback view
hgs
parents: 36
diff changeset
  1437
    //
hgs
parents: 36
diff changeset
  1438
    mView->closePlaybackView();
40
hgs
parents: 39
diff changeset
  1439
37
hgs
parents: 36
diff changeset
  1440
    //
hgs
parents: 36
diff changeset
  1441
    // emit signal to launch videoservices itemSelected() slot
hgs
parents: 36
diff changeset
  1442
    //
36
hgs
parents: 35
diff changeset
  1443
    emit( attachVideoPath( mFileDetails->mClipName ) );
40
hgs
parents: 39
diff changeset
  1444
36
hgs
parents: 35
diff changeset
  1445
}
hgs
parents: 35
diff changeset
  1446
37
hgs
parents: 36
diff changeset
  1447
// -------------------------------------------------------------------------------------------------
hgs
parents: 36
diff changeset
  1448
// QMPXVideoPlaybackControlsController::sendVideo()
hgs
parents: 36
diff changeset
  1449
// -------------------------------------------------------------------------------------------------
hgs
parents: 36
diff changeset
  1450
//
hgs
parents: 36
diff changeset
  1451
void QMPXVideoPlaybackControlsController::sendVideo()
hgs
parents: 36
diff changeset
  1452
{
hgs
parents: 36
diff changeset
  1453
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()"),
hgs
parents: 36
diff changeset
  1454
                   _L("file = %s"), mFileDetails->mClipName.data() );
40
hgs
parents: 39
diff changeset
  1455
37
hgs
parents: 36
diff changeset
  1456
    //
hgs
parents: 36
diff changeset
  1457
    // pause playback
hgs
parents: 36
diff changeset
  1458
    //
hgs
parents: 36
diff changeset
  1459
    handleCommand( EMPXPbvCmdPause );
40
hgs
parents: 39
diff changeset
  1460
hgs
parents: 39
diff changeset
  1461
    //
37
hgs
parents: 36
diff changeset
  1462
    // send video to shareUI
hgs
parents: 36
diff changeset
  1463
    //
hgs
parents: 36
diff changeset
  1464
    ShareUi dlg;
hgs
parents: 36
diff changeset
  1465
    QStringList fileList;
hgs
parents: 36
diff changeset
  1466
    fileList.append( mFileDetails->mClipName );
40
hgs
parents: 39
diff changeset
  1467
    dlg.send( fileList, true );
37
hgs
parents: 36
diff changeset
  1468
}
hgs
parents: 36
diff changeset
  1469
38
hgs
parents: 37
diff changeset
  1470
// -------------------------------------------------------------------------------------------------
39
hgs
parents: 38
diff changeset
  1471
// QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()
hgs
parents: 38
diff changeset
  1472
// -------------------------------------------------------------------------------------------------
hgs
parents: 38
diff changeset
  1473
//
hgs
parents: 38
diff changeset
  1474
void QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()
hgs
parents: 38
diff changeset
  1475
{
hgs
parents: 38
diff changeset
  1476
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()"));
hgs
parents: 38
diff changeset
  1477
hgs
parents: 38
diff changeset
  1478
    QGraphicsWidget *widget = mLoader->findWidget( QString( "rnLogoBitmap" ) );
hgs
parents: 38
diff changeset
  1479
hgs
parents: 38
diff changeset
  1480
    if ( widget->isVisible() )
hgs
parents: 38
diff changeset
  1481
    {
hgs
parents: 38
diff changeset
  1482
        if ( mRNLogoTimer )
hgs
parents: 38
diff changeset
  1483
        {
hgs
parents: 38
diff changeset
  1484
            delete mRNLogoTimer;
hgs
parents: 38
diff changeset
  1485
            mRNLogoTimer = NULL;
hgs
parents: 38
diff changeset
  1486
        }
hgs
parents: 38
diff changeset
  1487
hgs
parents: 38
diff changeset
  1488
        mRNLogoTimer = new QTimer( this );
hgs
parents: 38
diff changeset
  1489
        mRNLogoTimer->setInterval( KMPXRNLogoTimeOut );
hgs
parents: 38
diff changeset
  1490
        mRNLogoTimer->setSingleShot( true );
40
hgs
parents: 39
diff changeset
  1491
        connect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );
39
hgs
parents: 38
diff changeset
  1492
hgs
parents: 38
diff changeset
  1493
        mRNLogoTimer->start();
hgs
parents: 38
diff changeset
  1494
    }
hgs
parents: 38
diff changeset
  1495
}
hgs
parents: 38
diff changeset
  1496
hgs
parents: 38
diff changeset
  1497
// -------------------------------------------------------------------------------------------------
hgs
parents: 38
diff changeset
  1498
// QMPXVideoPlaybackControlsController::handleRNLogoTimeout()
hgs
parents: 38
diff changeset
  1499
// -------------------------------------------------------------------------------------------------
hgs
parents: 38
diff changeset
  1500
//
hgs
parents: 38
diff changeset
  1501
void QMPXVideoPlaybackControlsController::handleRNLogoTimeout()
hgs
parents: 38
diff changeset
  1502
{
hgs
parents: 38
diff changeset
  1503
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleRNLogoTimeout()"));
hgs
parents: 38
diff changeset
  1504
hgs
parents: 38
diff changeset
  1505
    if ( mRNLogoTimer->isActive() )
hgs
parents: 38
diff changeset
  1506
    {
hgs
parents: 38
diff changeset
  1507
        mRNLogoTimer->stop();
hgs
parents: 38
diff changeset
  1508
    }
hgs
parents: 38
diff changeset
  1509
hgs
parents: 38
diff changeset
  1510
    //
hgs
parents: 38
diff changeset
  1511
    // Remove RN logo from the controls list and issue play command if needed
hgs
parents: 38
diff changeset
  1512
    //
hgs
parents: 38
diff changeset
  1513
    mControlsConfig->updateControlList( EMPXControlCmdRemoveRNLogo );
hgs
parents: 38
diff changeset
  1514
    handleCommand( EMPXPbvCmdRealOneBitmapTimeout );
hgs
parents: 38
diff changeset
  1515
}
hgs
parents: 38
diff changeset
  1516
hgs
parents: 38
diff changeset
  1517
// -------------------------------------------------------------------------------------------------
hgs
parents: 38
diff changeset
  1518
// QMPXVideoPlaybackControlsController::isRNLogoBitmapInControlList()
hgs
parents: 38
diff changeset
  1519
// -------------------------------------------------------------------------------------------------
hgs
parents: 38
diff changeset
  1520
//
hgs
parents: 38
diff changeset
  1521
bool QMPXVideoPlaybackControlsController::isRNLogoBitmapInControlList()
hgs
parents: 38
diff changeset
  1522
{
hgs
parents: 38
diff changeset
  1523
    bool exist = false;
hgs
parents: 38
diff changeset
  1524
hgs
parents: 38
diff changeset
  1525
    //
hgs
parents: 38
diff changeset
  1526
    // If we have a rn logo in the list, we are supposed to show the logo all the time
hgs
parents: 38
diff changeset
  1527
    // unless we are in the middle of orientation transition
hgs
parents: 38
diff changeset
  1528
    //
hgs
parents: 38
diff changeset
  1529
    for ( int i = 0 ; i < mControls.count() ; i++ )
hgs
parents: 38
diff changeset
  1530
    {
hgs
parents: 38
diff changeset
  1531
        if ( mControls[i]->controlIndex() == EMPXRealLogoBitmap )
hgs
parents: 38
diff changeset
  1532
        {
hgs
parents: 38
diff changeset
  1533
            exist = true;
hgs
parents: 38
diff changeset
  1534
            break;
hgs
parents: 38
diff changeset
  1535
        }
hgs
parents: 38
diff changeset
  1536
    }
hgs
parents: 38
diff changeset
  1537
hgs
parents: 38
diff changeset
  1538
    MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isRNLogoBitmapInControlList() [%d]"), exist);
hgs
parents: 38
diff changeset
  1539
hgs
parents: 38
diff changeset
  1540
    return exist;
hgs
parents: 38
diff changeset
  1541
}
hgs
parents: 38
diff changeset
  1542
hgs
parents: 38
diff changeset
  1543
// -------------------------------------------------------------------------------------------------
38
hgs
parents: 37
diff changeset
  1544
// QMPXVideoPlaybackControlsController::handleOrientationChanged()
hgs
parents: 37
diff changeset
  1545
// -------------------------------------------------------------------------------------------------
hgs
parents: 37
diff changeset
  1546
//
hgs
parents: 37
diff changeset
  1547
void QMPXVideoPlaybackControlsController::handleOrientationChanged( Qt::Orientation orientation )
hgs
parents: 37
diff changeset
  1548
{
hgs
parents: 37
diff changeset
  1549
    MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleOrientationChanged()"),
hgs
parents: 37
diff changeset
  1550
                   _L("old orientation %d, new orientation = %d"), mOrientation, orientation );
hgs
parents: 37
diff changeset
  1551
hgs
parents: 37
diff changeset
  1552
    Qt::Orientation  oldOrientaiton = mOrientation;
hgs
parents: 37
diff changeset
  1553
    mOrientation = orientation;
hgs
parents: 37
diff changeset
  1554
hgs
parents: 37
diff changeset
  1555
    if ( oldOrientaiton == Qt::Vertical && orientation == Qt::Horizontal )
hgs
parents: 37
diff changeset
  1556
    {
hgs
parents: 37
diff changeset
  1557
        showControls();
hgs
parents: 37
diff changeset
  1558
    }
hgs
parents: 37
diff changeset
  1559
}
hgs
parents: 37
diff changeset
  1560
30
hgs
parents:
diff changeset
  1561
// End of File