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