videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolscontroller.cpp
changeset 66 adb51f74b890
parent 63 4707a0db12f6
child 67 72c709219fcd
equal deleted inserted replaced
63:4707a0db12f6 66:adb51f74b890
    13 *
    13 *
    14 * Description:  Implementation of VideoPlaybackControlsController
    14 * Description:  Implementation of VideoPlaybackControlsController
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: da1mmcf#54 %
    18 // Version : %version: da1mmcf#57 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <coecntrl.h>
    23 #include <coecntrl.h>
    27 
    27 
    28 #include <QTimer>
    28 #include <QTimer>
    29 #include <thumbnailmanager_qt.h>
    29 #include <thumbnailmanager_qt.h>
    30 
    30 
    31 #include <hblabel.h>
    31 #include <hblabel.h>
    32 #include <hbvolumesliderpopup.h>
       
    33 #include <hbtransparentwindow.h>
    32 #include <hbtransparentwindow.h>
    34 #include <hbiconanimationmanager.h>
    33 #include <hbiconanimationmanager.h>
    35 #include <shareui.h>
    34 #include <shareui.h>
    36 #include <hbinstance.h>
    35 #include <hbinstance.h>
    37 #include <hbtapgesture.h>
    36 #include <hbtapgesture.h>
    38 #include <hbpangesture.h>
    37 #include <hbpangesture.h>
    39 
    38 
    40 #include "mpxvideoviewwrapper.h"
    39 #include "videoservices.h"
    41 #include "videobaseplaybackview.h"
    40 #include "videobaseplaybackview.h"
    42 #include "videoplaybackcontrolbar.h"
    41 #include "videoplaybackcontrolbar.h"
    43 #include "videoplaybackcontrolpolicy.h"
    42 #include "videoplaybackcontrolpolicy.h"
       
    43 #include "videoplaybackvolumecontrol.h"
    44 #include "videoplaybackdocumentloader.h"
    44 #include "videoplaybackdocumentloader.h"
    45 #include "videoplaybackviewfiledetails.h"
    45 #include "videoplaybackviewfiledetails.h"
    46 #include "videoplaybackstatuspanecontrol.h"
    46 #include "videoplaybackstatuspanecontrol.h"
    47 #include "videoplaybackfiledetailswidget.h"
    47 #include "videoplaybackfiledetailswidget.h"
    48 #include "videoplaybackfullscreencontrol.h"
    48 #include "videoplaybackfullscreencontrol.h"
    49 #include "videoplaybackcontrolscontroller.h"
    49 #include "videoplaybackcontrolscontroller.h"
    50 #include "videoplaybackcontrolconfiguration.h"
    50 #include "videoplaybackcontrolconfiguration.h"
    51 #include "videoplaybackdetailsplaybackwindow.h"
    51 #include "videoplaybackdetailsplaybackwindow.h"
    52 #include "videoservices.h"
       
    53 
    52 
    54 
    53 
    55 // ================= MEMBER FUNCTIONS ==============================================================
    54 // ================= MEMBER FUNCTIONS ==============================================================
    56 
    55 
    57 // -------------------------------------------------------------------------------------------------
    56 // -------------------------------------------------------------------------------------------------
   146     mControlsConfig = new VideoPlaybackControlConfiguration( this );
   145     mControlsConfig = new VideoPlaybackControlConfiguration( this );
   147     connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   146     connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   148     mControlsConfig->createControlList();
   147     mControlsConfig->createControlList();
   149 
   148 
   150     //
   149     //
   151     // Create volume popup control
       
   152     //
       
   153     mVolumeControl = new HbVolumeSliderPopup();
       
   154     mVolumeControl->setVisible( false );
       
   155     mVolumeControl->setTimeout( KControlsTimeOut );
       
   156     mVolumeControl->setTickPosition( Hb::NoSliderTicks );
       
   157     mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
       
   158 
       
   159     //
       
   160     // grab tap gesture
   150     // grab tap gesture
   161     //
   151     //
   162     mView->grabGesture( Qt::TapGesture );
   152     mView->grabGesture( Qt::TapGesture );
   163     connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
   153     connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
   164 
   154 
   281         // decrease videoservices instance count
   271         // decrease videoservices instance count
   282         //
   272         //
   283     	mVideoServices->decreaseReferenceCount();
   273     	mVideoServices->decreaseReferenceCount();
   284     	mVideoServices = 0;
   274     	mVideoServices = 0;
   285     }
   275     }
   286     
   276 
   287     if( mShareUi )
   277     if( mShareUi )
   288     {
   278     {
   289         delete mShareUi;
   279         delete mShareUi;
   290         mShareUi = NULL;
   280         mShareUi = NULL;
   291     }
   281     }
   293 
   283 
   294 // -------------------------------------------------------------------------------------------------
   284 // -------------------------------------------------------------------------------------------------
   295 // VideoPlaybackControlsController::addFileDetails()
   285 // VideoPlaybackControlsController::addFileDetails()
   296 // -------------------------------------------------------------------------------------------------
   286 // -------------------------------------------------------------------------------------------------
   297 //
   287 //
   298 void VideoPlaybackControlsController::addFileDetails(
   288 void VideoPlaybackControlsController::addFileDetails( VideoPlaybackViewFileDetails* details )
   299     VideoPlaybackViewFileDetails* details )
       
   300 {
   289 {
   301     MPX_ENTER_EXIT(_L("VideoPlaybackControlsController::addFileDetails"));
   290     MPX_ENTER_EXIT(_L("VideoPlaybackControlsController::addFileDetails"));
   302 
   291 
   303     mFileDetailsAdded = true;
   292     mFileDetailsAdded = true;
   304 
   293 
   307     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
   296     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
   308 
   297 
   309     mControlsConfig->updateControlsWithFileDetails();
   298     mControlsConfig->updateControlsWithFileDetails();
   310 
   299 
   311     evaluateAndChangeViewMode();
   300     evaluateAndChangeViewMode();
   312 
       
   313     //
       
   314     // Dimmed the volume control if it is video only
       
   315     //
       
   316     if ( ! mFileDetails->mAudioEnabled )
       
   317     {
       
   318         mVolumeControl->setValue( 0 );
       
   319         mVolumeControl->setEnabled( false );
       
   320     }
       
   321 
   301 
   322     //
   302     //
   323     // grab pan gesture for playlist and seekable(skippable) clip
   303     // grab pan gesture for playlist and seekable(skippable) clip
   324     //
   304     //
   325     if ( mFileDetails->mMultiItemPlaylist && mFileDetails->mSeekable )
   305     if ( mFileDetails->mMultiItemPlaylist && mFileDetails->mSeekable )
   690                 widget = mLoader->findWidget( QString( "bitmapLayout" ) );
   670                 widget = mLoader->findWidget( QString( "bitmapLayout" ) );
   691 
   671 
   692                 MPX_DEBUG(_L("    EIndicatorBitmap load IndicatorBitmaps ok = %d"), ok);
   672                 MPX_DEBUG(_L("    EIndicatorBitmap load IndicatorBitmaps ok = %d"), ok);
   693             }
   673             }
   694 
   674 
   695             widget = mLoader->findWidget( QString( "bitmapLayout" ) );
       
   696 
       
   697             HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
   675             HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
   698 
   676 
   699             setDefaultBitmap();
   677             setDefaultBitmap();
   700 
   678 
   701             control = new VideoPlaybackFullScreenControl( this,
   679             control = new VideoPlaybackFullScreenControl( this,
   768                 if ( isVisible() )
   746                 if ( isVisible() )
   769                 {
   747                 {
   770                     //
   748                     //
   771                     // If the volume control is visible, hide it
   749                     // If the volume control is visible, hide it
   772                     //
   750                     //
   773                     if ( mVolumeControl->isVisible() )
   751                     if ( mVolumeControl && mVolumeControl->isVisible() )
   774                     {
   752                     {
   775                         mVolumeControl->setVisible( false );
   753                         mVolumeControl->setVisible( false );
   776                     }
   754                     }
   777 
   755 
   778                     hideAllControls();
   756                     hideAllControls();
   931 //
   909 //
   932 void VideoPlaybackControlsController::volumeChanged( int volume )
   910 void VideoPlaybackControlsController::volumeChanged( int volume )
   933 {
   911 {
   934     MPX_DEBUG(_L("VideoPlaybackControlsController::volumeChanged() [%d]"), volume);
   912     MPX_DEBUG(_L("VideoPlaybackControlsController::volumeChanged() [%d]"), volume);
   935 
   913 
   936     if ( mVolumeControl )
   914     if ( ! mVolumeControl )
   937     {
   915     {
   938         mVolumeControl->setValue( volume );
   916         mVolumeControl = new VideoPlaybackVolumeControl( this );
   939     }
   917     }
       
   918 
       
   919     mVolumeControl->volumeChanged( volume );
   940 }
   920 }
   941 
   921 
   942 // -------------------------------------------------------------------------------------------------
   922 // -------------------------------------------------------------------------------------------------
   943 //   VideoPlaybackControlsController::showVolumeControls()
   923 //   VideoPlaybackControlsController::showVolumeControls()
   944 // -------------------------------------------------------------------------------------------------
   924 // -------------------------------------------------------------------------------------------------
   945 //
   925 //
   946 void VideoPlaybackControlsController::showVolumeControls()
   926 void VideoPlaybackControlsController::showVolumeControls()
   947 {
   927 {
   948     MPX_DEBUG(_L("VideoPlaybackControlsController::showVolumeControls()"));
   928     MPX_DEBUG(_L("VideoPlaybackControlsController::showVolumeControls()"));
   949 
   929 
   950     if ( mVolumeControl )
   930     if ( ! mVolumeControl )
   951     {
   931     {
   952         mVolumeControl->setVisible( true );
   932         mVolumeControl = new VideoPlaybackVolumeControl( this );
   953     }
   933     }
       
   934 
       
   935     mVolumeControl->setVisible( true );
   954 }
   936 }
   955 
   937 
   956 // -------------------------------------------------------------------------------------------------
   938 // -------------------------------------------------------------------------------------------------
   957 //   VideoPlaybackControlsController::durationChanged()
   939 //   VideoPlaybackControlsController::durationChanged()
   958 // -------------------------------------------------------------------------------------------------
   940 // -------------------------------------------------------------------------------------------------
  1220 // -------------------------------------------------------------------------------------------------
  1202 // -------------------------------------------------------------------------------------------------
  1221 //
  1203 //
  1222 void VideoPlaybackControlsController::evaluateAndChangeViewMode(
  1204 void VideoPlaybackControlsController::evaluateAndChangeViewMode(
  1223         TPlaybackViewMode viewMode, bool transitionEffect )
  1205         TPlaybackViewMode viewMode, bool transitionEffect )
  1224 {
  1206 {
  1225     MPX_DEBUG(_L("VideoPlaybackControlsController::changeViewMode( %d, %d )"),
  1207     MPX_DEBUG(_L("VideoPlaybackControlsController::evaluateAndChangeViewMode( %d, %d )"),
  1226             viewMode, transitionEffect );
  1208             viewMode, transitionEffect );
  1227 
  1209 
  1228     switch ( viewMode )
  1210     switch ( viewMode )
  1229     {
  1211     {
  1230         case EFullScreenView:
  1212         case EFullScreenView:
  1359         {
  1341         {
  1360             QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
  1342             QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
  1361             rect = widget->geometry();
  1343             rect = widget->geometry();
  1362         }
  1344         }
  1363 
  1345 
       
  1346         //
       
  1347         // Turn off the transition effect since it hits performance with high resolution clip
       
  1348         // Need to test again with transition effect on with IVE 3.5
       
  1349         //
  1364         mViewWrapper->UpdateVideoRect(
  1350         mViewWrapper->UpdateVideoRect(
  1365                 rect.x(), rect.y(), rect.width(), rect.height(), transitionEffect );
  1351                 rect.x(), rect.y(), rect.width(), rect.height(), false );
  1366     }
  1352     }
  1367 }
  1353 }
  1368 
  1354 
  1369 // -------------------------------------------------------------------------------------------------
  1355 // -------------------------------------------------------------------------------------------------
  1370 //   VideoPlaybackControlsController::setDefaultBitmap()
  1356 //   VideoPlaybackControlsController::setDefaultBitmap()