videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp
changeset 46 adbe7d5ba2f5
parent 28 c48470be1ba7
equal deleted inserted replaced
28:c48470be1ba7 46:adbe7d5ba2f5
    13 *
    13 *
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: da1mmcf#40 %
    18 // Version : %version: da1mmcf#41 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <coecntrl.h>
    23 #include <coecntrl.h>
    33 #include <hbvolumesliderpopup.h>
    33 #include <hbvolumesliderpopup.h>
    34 #include <hbtransparentwindow.h>
    34 #include <hbtransparentwindow.h>
    35 #include <hbiconanimationmanager.h>
    35 #include <hbiconanimationmanager.h>
    36 #include <shareui.h>
    36 #include <shareui.h>
    37 #include <hbinstance.h>
    37 #include <hbinstance.h>
       
    38 #include <hbtapgesture.h>
       
    39 #include <hbpangesture.h>
    38 
    40 
    39 #include "mpxvideoviewwrapper.h"
    41 #include "mpxvideoviewwrapper.h"
    40 #include "hbvideobaseplaybackview.h"
    42 #include "hbvideobaseplaybackview.h"
    41 #include "mpxvideoplaybackcontrolbar.h"
    43 #include "mpxvideoplaybackcontrolbar.h"
    42 #include "mpxvideoplaybackcontrolpolicy.h"
    44 #include "mpxvideoplaybackcontrolpolicy.h"
    94     mOrientation = hbInstance->allMainWindows()[0]->orientation();
    96     mOrientation = hbInstance->allMainWindows()[0]->orientation();
    95     bool ok = connect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ),
    97     bool ok = connect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ),
    96                        this, SLOT( handleOrientationChanged( Qt::Orientation ) ) );
    98                        this, SLOT( handleOrientationChanged( Qt::Orientation ) ) );
    97 
    99 
    98     MPX_DEBUG(
   100     MPX_DEBUG(
    99         _L("QMPXVideoPlaybackControlsController::initializeController() orientation = %d, ok =%d"), 
   101         _L("QMPXVideoPlaybackControlsController::initializeController() orientation = %d, ok =%d"),
   100         mOrientation, ok );
   102         mOrientation, ok );
   101 
   103 
   102     setParent( mView );
   104     setParent( mView );
   103 
   105 
   104     mView->hideItems( Hb::AllItems );
   106     mView->hideItems( Hb::AllItems );
   127         mLoader = NULL;
   129         mLoader = NULL;
   128     }
   130     }
   129 
   131 
   130     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
   132     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
   131 
   133 
       
   134     //
       
   135     // Controls dismissing timer
       
   136     //
   132     mControlsTimer = new QTimer( this );
   137     mControlsTimer = new QTimer( this );
   133     mControlsTimer->setInterval( KMPXControlsTimeOut );
   138     mControlsTimer->setInterval( KMPXControlsTimeOut );
   134     mControlsTimer->setSingleShot( false );
   139     mControlsTimer->setSingleShot( false );
   135     connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
   140     connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
   136 
   141 
   137     connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
       
   138 	
       
   139     mControlsPolicy = new QMPXVideoPlaybackControlPolicy();
   142     mControlsPolicy = new QMPXVideoPlaybackControlPolicy();
   140     
   143 
   141     mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
   144     mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
   142     connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   145     connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   143     mControlsConfig->createControlList();
   146     mControlsConfig->createControlList();
   144 
   147 
   145     //
   148     //
   150     mVolumeControl->setTimeout( KMPXControlsTimeOut );
   153     mVolumeControl->setTimeout( KMPXControlsTimeOut );
   151     mVolumeControl->setTickPosition( Hb::NoSliderTicks );
   154     mVolumeControl->setTickPosition( Hb::NoSliderTicks );
   152     mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
   155     mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
   153 
   156 
   154     //
   157     //
       
   158     // grab tap gesture
       
   159     //
       
   160     mView->grabGesture( Qt::TapGesture );
       
   161     connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
       
   162 
       
   163     //
       
   164     // grab pan gesture for playlist
       
   165     //
       
   166     if ( mFileDetails->mMultiItemPlaylist )
       
   167     {
       
   168         mView->grabGesture( Qt::PanGesture );
       
   169         connect( mView, SIGNAL( pannedToRight() ), this, SLOT( skipToPreviousVideoItem() ) );
       
   170         connect( mView, SIGNAL( pannedToLeft() ), this, SLOT( skipToNextVideoItem() ) );
       
   171     }
       
   172 
       
   173     //
   155     // if videoplayback is in service mode, create a videoservices instance
   174     // if videoplayback is in service mode, create a videoservices instance
   156     //
   175     //
   157     if ( XQServiceUtil::isService() && ! mVideoServices )
   176     if ( XQServiceUtil::isService() && ! mVideoServices )
   158     {
   177     {
   159         //
   178         //
   160         // obtain VideoServices instance 
   179         // obtain VideoServices instance
   161         //
   180         //
   162         mVideoServices = VideoServices::instance(); 
   181         mVideoServices = VideoServices::instance();
   163 
   182 
   164         //
   183         //
   165         // allow 'attach' operation only for non-streaming media clips
   184         // allow 'attach' operation only for non-streaming media clips
   166         //
   185         //
   167         if ( mVideoServices && mFileDetails->mPlaybackMode == EMPXVideoLocal )
   186         if ( mVideoServices && mFileDetails->mPlaybackMode == EMPXVideoLocal )
   168         {
   187         {
   169             //
   188             //
   170             // determine if this is 'attach' operation
   189             // determine if this is 'attach' operation
   171             //
   190             //
   172             mIsAttachOperation = ( mVideoServices->currentService() == VideoServices::EUriFetcher );
   191             mIsAttachOperation = ( mVideoServices->currentService() == VideoServices::EUriFetcher );
   173             
   192 
   174             if ( mIsAttachOperation )
   193             if ( mIsAttachOperation )
   175             {
   194             {
   176                 //
   195                 //
   177                 // connect signal filePath() to videoservices slot itemSelected()
   196                 // connect signal filePath() to videoservices slot itemSelected()
   178                 //
   197                 //
   179                 connect( this, SIGNAL( attachVideoPath( const QString& ) ), 
   198                 connect( this, SIGNAL( attachVideoPath( const QString& ) ),
   180                          mVideoServices, SLOT( itemSelected( const QString& ) ) );                        
   199                          mVideoServices, SLOT( itemSelected( const QString& ) ) );
   181             }
   200             }
   182         }
   201         }
   183     }
   202     }
   184 }
   203 }
   185 
   204 
   189 //
   208 //
   190 QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
   209 QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
   191 {
   210 {
   192     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()"));
   211     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()"));
   193 
   212 
       
   213     mView->ungrabGesture( Qt::TapGesture );
       
   214     disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
       
   215 
       
   216     if ( mFileDetails->mMultiItemPlaylist )
       
   217     {
       
   218         mView->ungrabGesture( Qt::PanGesture );
       
   219 
       
   220         disconnect( mView, SIGNAL( pannedToRight() ), this, SLOT( skipToNextVideoItem() ) );
       
   221         disconnect( mView, SIGNAL( pannedToLeft() ), this, SLOT( skipToPreviousVideoItem() ) );
       
   222     }
       
   223 
   194     disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   224     disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   195     disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
       
   196     disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
   225     disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
   197     disconnect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ),
   226     disconnect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ),
   198                 this, SLOT( handleOrientationChanged( Qt::Orientation ) ) );
   227                 this, SLOT( handleOrientationChanged( Qt::Orientation ) ) );
   199 
   228 
   200     mView->setWidget( NULL );
   229     mView->setWidget( NULL );
   207         mControlsTimer = NULL;
   236         mControlsTimer = NULL;
   208     }
   237     }
   209 
   238 
   210     if ( mRNLogoTimer )
   239     if ( mRNLogoTimer )
   211     {
   240     {
   212         disconnect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );        
   241         disconnect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );
   213 
   242 
   214         delete mRNLogoTimer;
   243         delete mRNLogoTimer;
   215         mRNLogoTimer = NULL;
   244         mRNLogoTimer = NULL;
   216     }
   245     }
   217 
   246 
   234     }
   263     }
   235 
   264 
   236     if ( mThumbnailManager )
   265     if ( mThumbnailManager )
   237     {
   266     {
   238         delete mThumbnailManager;
   267         delete mThumbnailManager;
   239         mThumbnailManager = NULL;                    
   268         mThumbnailManager = NULL;
   240     }
   269     }
   241 
   270 
   242     if ( mVolumeControl )
   271     if ( mVolumeControl )
   243     {
   272     {
   244         delete mVolumeControl;
   273         delete mVolumeControl;
   245         mVolumeControl = NULL;
   274         mVolumeControl = NULL;
   246     }
   275     }
   247     
   276 
   248     if ( mIsAttachOperation )
   277     if ( mIsAttachOperation )
   249     {
   278     {
   250         //
   279         //
   251         // disable connection for 'attach' operation
   280         // disable connection for 'attach' operation
   252         //
   281         //
   253         disconnect( this, SIGNAL( attachVideoPath( const QString& ) ), 
   282         disconnect( this, SIGNAL( attachVideoPath( const QString& ) ),
   254                     mVideoServices, SLOT( itemSelected( const QString& ) ) );    
   283                     mVideoServices, SLOT( itemSelected( const QString& ) ) );
   255     }
   284     }
   256     
   285 
   257     if ( mVideoServices )
   286     if ( mVideoServices )
   258     {    
   287     {
   259         //
   288         //
   260         // decrease videoservices instance count
   289         // decrease videoservices instance count
   261         //
   290         //
   262     	mVideoServices->decreaseReferenceCount();
   291     	mVideoServices->decreaseReferenceCount();
   263     	mVideoServices = 0;
   292     	mVideoServices = 0;
   272     QMPXVideoPlaybackViewFileDetails* details )
   301     QMPXVideoPlaybackViewFileDetails* details )
   273 {
   302 {
   274     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::addFileDetails"));
   303     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::addFileDetails"));
   275 
   304 
   276     mFileDetails = details;
   305     mFileDetails = details;
       
   306 
       
   307     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
   277 
   308 
   278     mControlsConfig->updateControlsWithFileDetails();
   309     mControlsConfig->updateControlsWithFileDetails();
   279 
   310 
   280     //
   311     //
   281     // for audio-only clips and tv-out, default view is flip view
   312     // for audio-only clips and tv-out, default view is flip view
   436 
   467 
   437                 break;
   468                 break;
   438             }
   469             }
   439             default:
   470             default:
   440             {
   471             {
   441                 break;    
   472                 break;
   442             }
   473             }
   443         }
   474         }
   444     }
   475     }
   445 }
   476 }
   446 
   477 
   480             //
   511             //
   481             //  Control exists in new list.
   512             //  Control exists in new list.
   482             //  Update the policy property based on file details and view mode to the controls
   513             //  Update the policy property based on file details and view mode to the controls
   483             //
   514             //
   484             TUint properties = 0;
   515             TUint properties = 0;
   485             mControlsPolicy->setControlProperties( 
   516             mControlsPolicy->setControlProperties(
   486                     mControls[i]->controlIndex(), properties, mFileDetails, mViewMode );
   517                     mControls[i]->controlIndex(), properties, mFileDetails, mViewMode );
   487             mControls[i]->updateControlProperties( properties );
   518             mControls[i]->updateControlProperties( properties );
   488 
   519 
   489             //
   520             //
   490             //  Control exists in new list.
   521             //  Control exists in new list.
   565         {
   596         {
   566             //
   597             //
   567             // Status key (signal + title + back key)
   598             // Status key (signal + title + back key)
   568             //
   599             //
   569             control = new QMPXVideoPlaybackStatusPaneControl( this,
   600             control = new QMPXVideoPlaybackStatusPaneControl( this,
   570                                                               controlIndex, 
   601                                                               controlIndex,
   571                                                               NULL,
   602                                                               NULL,
   572                                                               properties );
   603                                                               properties );
   573             mControls.append( control );
   604             mControls.append( control );
   574 
   605 
   575             break;
   606             break;
   578         {
   609         {
   579             //
   610             //
   580             // Button bar
   611             // Button bar
   581             //
   612             //
   582             QGraphicsWidget *widget = mLoader->findWidget( QString( "controlBarLayout" ) );
   613             QGraphicsWidget *widget = mLoader->findWidget( QString( "controlBarLayout" ) );
   583             QMPXVideoPlaybackControlBar *controlBar = 
   614             QMPXVideoPlaybackControlBar *controlBar =
   584                 qobject_cast<QMPXVideoPlaybackControlBar*>( widget );
   615                 qobject_cast<QMPXVideoPlaybackControlBar*>( widget );
   585             controlBar->initialize();
   616             controlBar->initialize();
   586 
   617 
   587             control = new QMPXVideoPlaybackFullScreenControl( this,
   618             control = new QMPXVideoPlaybackFullScreenControl( this,
   588                                                               controlIndex,
   619                                                               controlIndex,
   593             break;
   624             break;
   594         }
   625         }
   595         case EMPXFileDetailsWidget:
   626         case EMPXFileDetailsWidget:
   596         {
   627         {
   597             QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) );
   628             QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) );
   598             QMPXVideoPlaybackFileDetailsWidget *fileDetails = 
   629             QMPXVideoPlaybackFileDetailsWidget *fileDetails =
   599                 qobject_cast<QMPXVideoPlaybackFileDetailsWidget*>( widget );
   630                 qobject_cast<QMPXVideoPlaybackFileDetailsWidget*>( widget );
   600 
   631 
   601             control = new QMPXVideoPlaybackFullScreenControl( this,
   632             control = new QMPXVideoPlaybackFullScreenControl( this,
   602                                                               controlIndex,
   633                                                               controlIndex,
   603                                                               fileDetails,
   634                                                               fileDetails,
   637             break;
   668             break;
   638         }
   669         }
   639         case EMPXDetailsViewPlaybackWindow:
   670         case EMPXDetailsViewPlaybackWindow:
   640         {
   671         {
   641             QGraphicsWidget *widget = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
   672             QGraphicsWidget *widget = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
   642             QMPXVideoPlaybackDetailsPlaybackWindow *detailsPlaybackWindow = 
   673             QMPXVideoPlaybackDetailsPlaybackWindow *detailsPlaybackWindow =
   643                     qobject_cast<QMPXVideoPlaybackDetailsPlaybackWindow*>( widget );
   674                     qobject_cast<QMPXVideoPlaybackDetailsPlaybackWindow*>( widget );
   644             detailsPlaybackWindow->initialize();
   675             detailsPlaybackWindow->initialize();
   645 
   676 
   646             control = new QMPXVideoPlaybackFullScreenControl( this,
   677             control = new QMPXVideoPlaybackFullScreenControl( this,
   647                                                               controlIndex,
   678                                                               controlIndex,
   662 
   693 
   663 {
   694 {
   664     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleTappedOnScreen()"));
   695     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleTappedOnScreen()"));
   665 
   696 
   666     //
   697     //
   667     //  Toggle visibility only if the followings are true 
   698     // If we are in full screen view, toggle the visibility when playing and paused
   668     //  - TV-Out is not connected
   699     // If we are in details view, issue playpause
   669     //  - Video is available
   700     // If we are in audio only view, ignore
   670     //  - We are in playing or paused state
   701     //
   671     //
   702     switch( mViewMode )
   672     if ( ! isTvOutConnected() &&
   703     {
   673          mFileDetails->mVideoEnabled &&
   704         case EFullScreenView:
   674          ( mState == EPbStatePlaying || mState == EPbStatePaused ) )
   705         {
   675     {
   706             if ( mState == EPbStatePlaying || mState == EPbStatePaused )
   676         if ( mViewMode == EFullScreenView )
       
   677         {
       
   678             if ( isVisible() )
       
   679             {
   707             {
   680                 //
   708                 if ( isVisible() )
   681                 // If the volume control is visible, hide it
       
   682                 //
       
   683                 if ( mVolumeControl->isVisible() )
       
   684                 {
   709                 {
   685                     mVolumeControl->setVisible( false );
   710                     //
       
   711                     // If the volume control is visible, hide it
       
   712                     //
       
   713                     if ( mVolumeControl->isVisible() )
       
   714                     {
       
   715                         mVolumeControl->setVisible( false );
       
   716                     }
       
   717 
       
   718                     hideAllControls();
   686                 }
   719                 }
   687 
   720                 else
   688                 hideAllControls();
   721                 {
       
   722                     showControls();
       
   723                 }
   689             }
   724             }
   690             else
   725 
   691             {
   726             break;
   692                 showControls();
   727         }
   693             }            
   728         case EDetailsView:
       
   729         {
       
   730             handleCommand( EMPXPbvCmdPlayPause );
       
   731 
       
   732             break;
   694         }
   733         }
   695     }
   734     }
   696 }
   735 }
   697 
   736 
   698 // -------------------------------------------------------------------------------------------------
   737 // -------------------------------------------------------------------------------------------------
   751     {
   790     {
   752         for ( int i = 0 ; i < mControls.count() ; i++ )
   791         for ( int i = 0 ; i < mControls.count() ; i++ )
   753         {
   792         {
   754             mControls[i]->setVisibility( mState );
   793             mControls[i]->setVisibility( mState );
   755         }
   794         }
   756     }        
   795     }
   757 }
   796 }
   758 
   797 
   759 // -------------------------------------------------------------------------------------------------
   798 // -------------------------------------------------------------------------------------------------
   760 //   QMPXVideoPlaybackControlsController::isVisible()
   799 //   QMPXVideoPlaybackControlsController::isVisible()
   761 // -------------------------------------------------------------------------------------------------
   800 // -------------------------------------------------------------------------------------------------
   784 
   823 
   785 // -------------------------------------------------------------------------------------------------
   824 // -------------------------------------------------------------------------------------------------
   786 //   QMPXVideoPlaybackControlsController::handleCommand()
   825 //   QMPXVideoPlaybackControlsController::handleCommand()
   787 // -------------------------------------------------------------------------------------------------
   826 // -------------------------------------------------------------------------------------------------
   788 //
   827 //
   789 void QMPXVideoPlaybackControlsController::handleCommand( 
   828 void QMPXVideoPlaybackControlsController::handleCommand(
   790         TMPXVideoPlaybackViewCommandIds command, int value )
   829         TMPXVideoPlaybackViewCommandIds command, int value )
   791 {
   830 {
   792     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
   831     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
   793 
   832 
   794     switch( command )
   833     switch( command )
   795     {
   834     {
   796         case EMPXPbvCmdSetPosition:
   835         case EMPXPbvCmdSetPosition:
   797         {
   836         {
   798             TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyPosition, 
   837             TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyPosition,
   799                                                      value * KPbMilliMultiplier ) );
   838                                                      value * KPbMilliMultiplier ) );
   800             break;
   839             break;
   801         }
   840         }
   802         case EMPXPbvCmdSetVolume:
   841         case EMPXPbvCmdSetVolume:
   803         {
   842         {
   804             TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyVolume, value ) );
   843             TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyVolume, value ) );
   805             break;            
   844             break;
   806         }
   845         }
   807         default:
   846         default:
   808         {
   847         {
   809             TRAP_IGNORE( mViewWrapper->HandleCommandL( command ) );
   848             TRAP_IGNORE( mViewWrapper->HandleCommandL( command ) );
   810             break;
   849             break;
   968                     if ( fileName->Des()[j]== '\\' )
  1007                     if ( fileName->Des()[j]== '\\' )
   969                     {
  1008                     {
   970                         fileName->Des()[j]='/';
  1009                         fileName->Des()[j]='/';
   971                     }
  1010                     }
   972                 }
  1011                 }
   973                 err = filePath.Set( fileName->Des(), NULL, NULL );                
  1012                 err = filePath.Set( fileName->Des(), NULL, NULL );
   974             }
  1013             }
   975 
  1014 
   976             if ( fileName )
  1015             if ( fileName )
   977             {
  1016             {
   978                 delete fileName;
  1017                 delete fileName;
  1015 // -------------------------------------------------------------------------------------------------
  1054 // -------------------------------------------------------------------------------------------------
  1016 //
  1055 //
  1017 bool QMPXVideoPlaybackControlsController::realFormatForLocal()
  1056 bool QMPXVideoPlaybackControlsController::realFormatForLocal()
  1018 {
  1057 {
  1019     bool realFormat = false;
  1058     bool realFormat = false;
  1020     
  1059 
  1021     QString real( "real" );
  1060     QString real( "real" );
  1022     QString rn( "rn" );
  1061     QString rn( "rn" );
  1023     
  1062 
  1024     if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) ||
  1063     if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) ||
  1025          mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) )
  1064          mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) )
  1026     {
  1065     {
  1027         realFormat = true;
  1066         realFormat = true;
  1028     }
  1067     }
  1121     {
  1160     {
  1122         generateThumbNail();
  1161         generateThumbNail();
  1123     }
  1162     }
  1124 
  1163 
  1125     //
  1164     //
  1126     // Change the view. 
  1165     // Change the view.
  1127     // If Tv-out is connected, go to AudioOnlyView.
  1166     // If Tv-out is connected, go to AudioOnlyView.
  1128     // If not, go back to default view.
  1167     // If not, go back to default view.
  1129     //
  1168     //
  1130     TPlaybackViewMode viewMode = EFullScreenView;
  1169     TPlaybackViewMode viewMode = EFullScreenView;
  1131 
  1170 
  1139 
  1178 
  1140 // -------------------------------------------------------------------------------------------------
  1179 // -------------------------------------------------------------------------------------------------
  1141 //   QMPXVideoPlaybackControlsController::changeViewMode
  1180 //   QMPXVideoPlaybackControlsController::changeViewMode
  1142 // -------------------------------------------------------------------------------------------------
  1181 // -------------------------------------------------------------------------------------------------
  1143 //
  1182 //
  1144 void QMPXVideoPlaybackControlsController::changeViewMode( 
  1183 void QMPXVideoPlaybackControlsController::changeViewMode(
  1145         TPlaybackViewMode viewMode, bool transitionEffect )
  1184         TPlaybackViewMode viewMode, bool transitionEffect )
  1146 {
  1185 {
  1147     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode( %d, %d )"),
  1186     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode( %d, %d )"),
  1148             viewMode, transitionEffect );
  1187             viewMode, transitionEffect );
  1149 
  1188 
  1213 //
  1252 //
  1214 void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
  1253 void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
  1215 {
  1254 {
  1216     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()"));
  1255     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()"));
  1217 
  1256 
  1218     handleCommand( EMPXPbvCmdPreviousListItem );
  1257     if ( mViewMode == EFullScreenView )
       
  1258     {
       
  1259         handleCommand( EMPXPbvCmdPreviousListItem );
       
  1260     }
  1219 }
  1261 }
  1220 
  1262 
  1221 // -------------------------------------------------------------------------------------------------
  1263 // -------------------------------------------------------------------------------------------------
  1222 //   QMPXVideoPlaybackControlsController::skipToNextVideoItem
  1264 //   QMPXVideoPlaybackControlsController::skipToNextVideoItem
  1223 // -------------------------------------------------------------------------------------------------
  1265 // -------------------------------------------------------------------------------------------------
  1224 //
  1266 //
  1225 void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
  1267 void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
  1226 {
  1268 {
  1227     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToNextVideoItem()"));
  1269     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToNextVideoItem()"));
  1228 
  1270 
  1229     handleCommand( EMPXPbvCmdNextListItem );
  1271     if ( mViewMode == EFullScreenView )
       
  1272     {
       
  1273         handleCommand( EMPXPbvCmdNextListItem );
       
  1274     }
  1230 }
  1275 }
  1231 
  1276 
  1232 // -------------------------------------------------------------------------------------------------
  1277 // -------------------------------------------------------------------------------------------------
  1233 //   QMPXVideoPlaybackControlsController::updateVideoRect()
  1278 //   QMPXVideoPlaybackControlsController::updateVideoRect()
  1234 // -------------------------------------------------------------------------------------------------
  1279 // -------------------------------------------------------------------------------------------------
  1244 
  1289 
  1245         QRectF rect;
  1290         QRectF rect;
  1246 
  1291 
  1247         MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRect() : mViewMode = %d )"),
  1292         MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRect() : mViewMode = %d )"),
  1248                 mViewMode );
  1293                 mViewMode );
  1249 			
  1294 
  1250         if ( mViewMode == EDetailsView )
  1295         if ( mViewMode == EDetailsView )
  1251         {
  1296         {
  1252             QGraphicsWidget *parent = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
  1297             QGraphicsWidget *parent = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
  1253             QGraphicsWidget *child = mLoader->findWidget( QString( "small_transparentWindow" ) );
  1298             QGraphicsWidget *child = mLoader->findWidget( QString( "small_transparentWindow" ) );
  1254 
  1299 
  1258         {
  1303         {
  1259             QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
  1304             QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
  1260             rect = widget->geometry();
  1305             rect = widget->geometry();
  1261         }
  1306         }
  1262 
  1307 
  1263         mViewWrapper->UpdateVideoRect( 
  1308         mViewWrapper->UpdateVideoRect(
  1264                 rect.x(), rect.y(), rect.width(), rect.height(), transitionEffect );
  1309                 rect.x(), rect.y(), rect.width(), rect.height(), transitionEffect );
  1265     }
  1310     }
  1266 }
  1311 }
  1267 
  1312 
  1268 // -------------------------------------------------------------------------------------------------
  1313 // -------------------------------------------------------------------------------------------------
  1293 
  1338 
  1294         if ( mFileDetails->mTvOutConnected )
  1339         if ( mFileDetails->mTvOutConnected )
  1295         {
  1340         {
  1296             tvOutBitmap->setVisible( true );
  1341             tvOutBitmap->setVisible( true );
  1297         }
  1342         }
  1298         else if ( mFileDetails->mRNFormat ) 
  1343         else if ( mFileDetails->mRNFormat )
  1299         {
  1344         {
  1300             realAudioOnlyBitmap->setVisible( true );
  1345             realAudioOnlyBitmap->setVisible( true );
  1301         }
  1346         }
  1302         else if ( mFileDetails->mPartialPlayback )
  1347         else if ( mFileDetails->mPartialPlayback )
  1303         {
  1348         {
  1305         }
  1350         }
  1306         else
  1351         else
  1307         {
  1352         {
  1308             audioOnlyBitmap->setVisible( true );
  1353             audioOnlyBitmap->setVisible( true );
  1309         }
  1354         }
  1310     }    
  1355     }
  1311 }
  1356 }
  1312 
  1357 
  1313 // -------------------------------------------------------------------------------------------------
  1358 // -------------------------------------------------------------------------------------------------
  1314 //   QMPXVideoPlaybackControlsController::generateThumbNail()
  1359 //   QMPXVideoPlaybackControlsController::generateThumbNail()
  1315 // -------------------------------------------------------------------------------------------------
  1360 // -------------------------------------------------------------------------------------------------
  1323     //
  1368     //
  1324     if ( mFileDetails->mPlaybackMode == EMPXVideoLocal )
  1369     if ( mFileDetails->mPlaybackMode == EMPXVideoLocal )
  1325     {
  1370     {
  1326         if ( mThumbNailState == EThumbNailEmpty )
  1371         if ( mThumbNailState == EThumbNailEmpty )
  1327         {
  1372         {
  1328             mThumbnailManager = new ThumbnailManager(); ; 
  1373             mThumbnailManager = new ThumbnailManager(); ;
  1329 
  1374 
  1330             mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
  1375             mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
  1331             mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
  1376             mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
  1332          
  1377 
  1333             if ( connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), 
  1378             if ( connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
  1334                           this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ) )
  1379                           this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ) )
  1335             {
  1380             {
  1336                 mThumbnailManager->getThumbnail( mFileDetails->mClipName );
  1381                 mThumbnailManager->getThumbnail( mFileDetails->mClipName );
  1337                 mThumbNailState = EThumbNailRequsted;
  1382                 mThumbNailState = EThumbNailRequsted;
  1338             }
  1383             }
  1346 
  1391 
  1347 // -------------------------------------------------------------------------------------------------
  1392 // -------------------------------------------------------------------------------------------------
  1348 // QMPXVideoPlaybackControlsController::handleThumbnailReady()
  1393 // QMPXVideoPlaybackControlsController::handleThumbnailReady()
  1349 // -------------------------------------------------------------------------------------------------
  1394 // -------------------------------------------------------------------------------------------------
  1350 //
  1395 //
  1351 void QMPXVideoPlaybackControlsController::handleThumbnailReady( 
  1396 void QMPXVideoPlaybackControlsController::handleThumbnailReady(
  1352         QPixmap tnData, void *internal , int id, int error )
  1397         QPixmap tnData, void *internal , int id, int error )
  1353 {
  1398 {
  1354     Q_UNUSED( internal );
  1399     Q_UNUSED( internal );
  1355     Q_UNUSED( id );
  1400     Q_UNUSED( id );
  1356 
  1401 
  1372         mThumbNailState = EThumbNailNotAvailable;
  1417         mThumbNailState = EThumbNailNotAvailable;
  1373     }
  1418     }
  1374 
  1419 
  1375     setDefaultBitmap();
  1420     setDefaultBitmap();
  1376 
  1421 
  1377     disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), 
  1422     disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
  1378                 this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) );
  1423                 this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) );
  1379 }
  1424 }
  1380 
  1425 
  1381 // -------------------------------------------------------------------------------------------------
  1426 // -------------------------------------------------------------------------------------------------
  1382 // QMPXVideoPlaybackControlsController::attachVideo()
  1427 // QMPXVideoPlaybackControlsController::attachVideo()
  1384 //
  1429 //
  1385 void QMPXVideoPlaybackControlsController::attachVideo()
  1430 void QMPXVideoPlaybackControlsController::attachVideo()
  1386 {
  1431 {
  1387     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()"),
  1432     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::attachVideo()"),
  1388                    _L("file = %s"), mFileDetails->mClipName.data() );
  1433                    _L("file = %s"), mFileDetails->mClipName.data() );
  1389     
  1434 
  1390     //
  1435     //
  1391     // close playback view
  1436     // close playback view
  1392     //
  1437     //
  1393     mView->closePlaybackView();
  1438     mView->closePlaybackView();
  1394 	
  1439 
  1395     //
  1440     //
  1396     // emit signal to launch videoservices itemSelected() slot
  1441     // emit signal to launch videoservices itemSelected() slot
  1397     //
  1442     //
  1398     emit( attachVideoPath( mFileDetails->mClipName ) );
  1443     emit( attachVideoPath( mFileDetails->mClipName ) );
  1399     
  1444 
  1400 }
  1445 }
  1401 
  1446 
  1402 // -------------------------------------------------------------------------------------------------
  1447 // -------------------------------------------------------------------------------------------------
  1403 // QMPXVideoPlaybackControlsController::sendVideo()
  1448 // QMPXVideoPlaybackControlsController::sendVideo()
  1404 // -------------------------------------------------------------------------------------------------
  1449 // -------------------------------------------------------------------------------------------------
  1405 //
  1450 //
  1406 void QMPXVideoPlaybackControlsController::sendVideo()
  1451 void QMPXVideoPlaybackControlsController::sendVideo()
  1407 {
  1452 {
  1408     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()"),
  1453     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::sendVideo()"),
  1409                    _L("file = %s"), mFileDetails->mClipName.data() );
  1454                    _L("file = %s"), mFileDetails->mClipName.data() );
  1410     
  1455 
  1411     //
  1456     //
  1412     // pause playback
  1457     // pause playback
  1413     //
  1458     //
  1414     handleCommand( EMPXPbvCmdPause );
  1459     handleCommand( EMPXPbvCmdPause );
  1415     
  1460 
  1416     // 
  1461     //
  1417     // send video to shareUI
  1462     // send video to shareUI
  1418     //
  1463     //
  1419     ShareUi dlg;
  1464     ShareUi dlg;
  1420     QStringList fileList;
  1465     QStringList fileList;
  1421     fileList.append( mFileDetails->mClipName );
  1466     fileList.append( mFileDetails->mClipName );
  1422     dlg.send( fileList, true );   
  1467     dlg.send( fileList, true );
  1423 }
  1468 }
  1424 
  1469 
  1425 // -------------------------------------------------------------------------------------------------
  1470 // -------------------------------------------------------------------------------------------------
  1426 // QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()
  1471 // QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()
  1427 // -------------------------------------------------------------------------------------------------
  1472 // -------------------------------------------------------------------------------------------------
  1441         }
  1486         }
  1442 
  1487 
  1443         mRNLogoTimer = new QTimer( this );
  1488         mRNLogoTimer = new QTimer( this );
  1444         mRNLogoTimer->setInterval( KMPXRNLogoTimeOut );
  1489         mRNLogoTimer->setInterval( KMPXRNLogoTimeOut );
  1445         mRNLogoTimer->setSingleShot( true );
  1490         mRNLogoTimer->setSingleShot( true );
  1446         connect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );        
  1491         connect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );
  1447 
  1492 
  1448         mRNLogoTimer->start();
  1493         mRNLogoTimer->start();
  1449     }
  1494     }
  1450 }
  1495 }
  1451 
  1496