13 * |
13 * |
14 * Description: Implementation of MPXVideoPlaybackControlsController |
14 * Description: Implementation of MPXVideoPlaybackControlsController |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // Version : %version: da1mmcf#37 % |
18 // Version : %version: da1mmcf#39 % |
19 |
19 |
20 |
20 |
21 |
21 |
22 // INCLUDE FILES |
22 // INCLUDE FILES |
23 #include <coecntrl.h> |
23 #include <coecntrl.h> |
24 #include <bautils.h> |
24 #include <bautils.h> |
25 #include <barsread.h> |
25 #include <barsread.h> |
26 #include <f32file.h> |
26 #include <f32file.h> |
27 |
27 |
28 #include <QTimer> |
28 #include <QTimer> |
29 #include <QFileInfo> |
|
30 #include <thumbnailmanager_qt.h> |
29 #include <thumbnailmanager_qt.h> |
31 #include <xqserviceutil.h> |
30 #include <xqserviceutil.h> |
32 |
31 |
33 #include <hblabel.h> |
32 #include <hblabel.h> |
34 #include <hbiconitem.h> |
|
35 #include <hbratingslider.h> |
|
36 #include <hbiconanimator.h> |
|
37 #include <hbvolumesliderpopup.h> |
33 #include <hbvolumesliderpopup.h> |
38 #include <hbtransparentwindow.h> |
34 #include <hbtransparentwindow.h> |
39 #include <hbiconanimationmanager.h> |
35 #include <hbiconanimationmanager.h> |
40 #include <shareui.h> |
36 #include <shareui.h> |
|
37 #include <hbinstance.h> |
41 |
38 |
42 #include "mpxvideoviewwrapper.h" |
39 #include "mpxvideoviewwrapper.h" |
43 #include "hbvideobaseplaybackview.h" |
40 #include "hbvideobaseplaybackview.h" |
44 #include "mpxvideoplaybackcontrolbar.h" |
41 #include "mpxvideoplaybackcontrolbar.h" |
45 #include "mpxvideoplaybackcontrolpolicy.h" |
42 #include "mpxvideoplaybackcontrolpolicy.h" |
91 // |
88 // |
92 void QMPXVideoPlaybackControlsController::initializeController() |
89 void QMPXVideoPlaybackControlsController::initializeController() |
93 { |
90 { |
94 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::initializeController()")); |
91 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::initializeController()")); |
95 |
92 |
|
93 mOrientation = hbInstance->allMainWindows()[0]->orientation(); |
|
94 bool ok = connect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ), |
|
95 this, SLOT( handleOrientationChanged( Qt::Orientation ) ) ); |
|
96 |
|
97 MPX_DEBUG( |
|
98 _L("QMPXVideoPlaybackControlsController::initializeController() orientation = %d, ok =%d"), |
|
99 mOrientation, ok ); |
|
100 |
96 setParent( mView ); |
101 setParent( mView ); |
97 |
102 |
|
103 mView->hideItems( Hb::AllItems ); |
|
104 |
98 // |
105 // |
99 // Create layout loader |
106 // Create layout loader |
100 // |
107 // |
101 bool ok = false; |
108 ok = false; |
102 mLoader = new QMPXVideoPlaybackDocumentLoader( this ); |
109 mLoader = new QMPXVideoPlaybackDocumentLoader( this ); |
103 mLoader->load( KMPXPLAYBACKVIEW_XML, &ok ); |
110 mLoader->load( KMPXPLAYBACKVIEW_XML, &ok ); |
104 |
111 |
105 if ( ok ) |
112 if ( ok ) |
106 { |
113 { |
178 QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController() |
185 QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController() |
179 { |
186 { |
180 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()")); |
187 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()")); |
181 |
188 |
182 disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) ); |
189 disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) ); |
183 |
|
184 disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) ); |
190 disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) ); |
185 disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) ); |
191 disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) ); |
|
192 disconnect( hbInstance->allMainWindows()[0], SIGNAL( orientationChanged( Qt::Orientation ) ), |
|
193 this, SLOT( handleOrientationChanged( Qt::Orientation ) ) ); |
186 |
194 |
187 mView->setWidget( NULL ); |
195 mView->setWidget( NULL ); |
188 |
196 |
189 mControls.clear(); |
197 mControls.clear(); |
190 |
198 |
278 if ( ! mFileDetails->mAudioEnabled ) |
286 if ( ! mFileDetails->mAudioEnabled ) |
279 { |
287 { |
280 mVolumeControl->setValue( 0 ); |
288 mVolumeControl->setValue( 0 ); |
281 mVolumeControl->setEnabled( false ); |
289 mVolumeControl->setEnabled( false ); |
282 } |
290 } |
283 |
|
284 // |
|
285 // If title is not available, show clip name |
|
286 // |
|
287 QString title = mFileDetails->mTitle; |
|
288 |
|
289 if ( title.count() == 0 ) |
|
290 { |
|
291 QFileInfo fileInfo( mFileDetails->mClipName ); |
|
292 title = fileInfo.baseName (); |
|
293 } |
|
294 |
|
295 QGraphicsWidget *widget = mLoader->findWidget( QString( "title" ) ); |
|
296 HbLabel *titleLabel = qobject_cast<HbLabel*>( widget ); |
|
297 titleLabel->setPlainText( title ); |
|
298 } |
291 } |
299 |
292 |
300 // ------------------------------------------------------------------------------------------------- |
293 // ------------------------------------------------------------------------------------------------- |
301 // QMPXVideoPlaybackControlsController::handleEvent |
294 // QMPXVideoPlaybackControlsController::handleEvent |
302 // ------------------------------------------------------------------------------------------------- |
295 // ------------------------------------------------------------------------------------------------- |
576 case EMPXFileDetailsWidget: |
569 case EMPXFileDetailsWidget: |
577 { |
570 { |
578 QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) ); |
571 QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) ); |
579 QMPXVideoPlaybackFileDetailsWidget *fileDetails = |
572 QMPXVideoPlaybackFileDetailsWidget *fileDetails = |
580 qobject_cast<QMPXVideoPlaybackFileDetailsWidget*>( widget ); |
573 qobject_cast<QMPXVideoPlaybackFileDetailsWidget*>( widget ); |
581 fileDetails->initialize(); |
|
582 |
574 |
583 control = new QMPXVideoPlaybackFullScreenControl( this, |
575 control = new QMPXVideoPlaybackFullScreenControl( this, |
584 controlIndex, |
576 controlIndex, |
585 fileDetails, |
577 fileDetails, |
586 properties ); |
578 properties ); |
711 { |
703 { |
712 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::showControls()")); |
704 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::showControls()")); |
713 |
705 |
714 resetDisappearingTimers( EMPXTimerReset ); |
706 resetDisappearingTimers( EMPXTimerReset ); |
715 |
707 |
716 if ( ! mViewTransitionIsGoingOn ) |
708 if ( ! mViewTransitionIsGoingOn && mOrientation == Qt::Horizontal ) |
717 { |
709 { |
718 for ( int i = 0 ; i < mControls.count() ; i++ ) |
710 for ( int i = 0 ; i < mControls.count() ; i++ ) |
719 { |
711 { |
720 mControls[i]->setVisibility( mState ); |
712 mControls[i]->setVisibility( mState ); |
721 } |
713 } |
726 // QMPXVideoPlaybackControlsController::isVisible() |
718 // QMPXVideoPlaybackControlsController::isVisible() |
727 // ------------------------------------------------------------------------------------------------- |
719 // ------------------------------------------------------------------------------------------------- |
728 // |
720 // |
729 bool QMPXVideoPlaybackControlsController::isVisible() |
721 bool QMPXVideoPlaybackControlsController::isVisible() |
730 { |
722 { |
731 bool visible = EFalse; |
723 bool visible = false; |
732 |
724 |
733 for ( int i = 0 ; i < mControls.count() ; i++ ) |
725 for ( int i = 0 ; i < mControls.count() ; i++ ) |
734 { |
726 { |
735 if ( mControls[i]->controlIndex() == EMPXControlBar ) |
727 if ( mControls[i]->controlIndex() == EMPXControlBar ) |
736 { |
728 { |
737 if ( mControls[i]->isVisible() ) |
729 if ( mControls[i]->isVisible() ) |
738 { |
730 { |
739 visible = ETrue; |
731 visible = true; |
740 } |
732 } |
741 |
733 |
742 break; |
734 break; |
743 } |
735 } |
744 } |
736 } |
875 // QMPXVideoPlaybackControlsController::realFormat() |
867 // QMPXVideoPlaybackControlsController::realFormat() |
876 // ------------------------------------------------------------------------------------------------- |
868 // ------------------------------------------------------------------------------------------------- |
877 // |
869 // |
878 bool QMPXVideoPlaybackControlsController::realFormat( QString filename ) |
870 bool QMPXVideoPlaybackControlsController::realFormat( QString filename ) |
879 { |
871 { |
880 bool realFormat = EFalse; |
872 bool realFormat = false; |
881 |
873 |
882 if ( !filename.isNull() && !filename.isEmpty() ) |
874 if ( !filename.isNull() && !filename.isEmpty() ) |
883 { |
875 { |
884 if ( mFileDetails->mPlaybackMode == EMPXVideoStreaming || |
876 if ( mFileDetails->mPlaybackMode == EMPXVideoStreaming || |
885 mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming ) |
877 mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming ) |
902 // QMPXVideoPlaybackControlsController::realFormatForStreaming() |
894 // QMPXVideoPlaybackControlsController::realFormatForStreaming() |
903 // ------------------------------------------------------------------------------------------------- |
895 // ------------------------------------------------------------------------------------------------- |
904 // |
896 // |
905 bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des ) |
897 bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des ) |
906 { |
898 { |
907 bool realFormat = EFalse; |
899 bool realFormat = false; |
908 TParse filePath; |
900 TParse filePath; |
909 |
901 |
910 _LIT(KMPXRMEXT, ".R" ); |
902 _LIT(KMPXRMEXT, ".R" ); |
911 |
903 |
912 int err = filePath.Set( des, NULL, NULL ); |
904 int err = filePath.Set( des, NULL, NULL ); |
990 if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) || |
982 if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) || |
991 mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) ) |
983 mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) ) |
992 { |
984 { |
993 realFormat = true; |
985 realFormat = true; |
994 } |
986 } |
995 |
987 |
996 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormatForLocal() [%d]"), realFormat); |
988 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormatForLocal() [%d]"), realFormat); |
997 |
989 |
998 return realFormat; |
990 return realFormat; |
999 } |
991 } |
1000 |
992 |
1046 // QMPXVideoPlaybackControlsController::isSoftKeyVisible() |
1038 // QMPXVideoPlaybackControlsController::isSoftKeyVisible() |
1047 // ------------------------------------------------------------------------------------------------- |
1039 // ------------------------------------------------------------------------------------------------- |
1048 // |
1040 // |
1049 bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ ) |
1041 bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ ) |
1050 { |
1042 { |
1051 bool visible = EFalse; |
1043 bool visible = false; |
1052 |
1044 |
1053 for ( int i = 0 ; i < mControls.count() ; i++ ) |
1045 for ( int i = 0 ; i < mControls.count() ; i++ ) |
1054 { |
1046 { |
1055 if ( mControls[i]->controlIndex() == EMPXStatusPane ) |
1047 if ( mControls[i]->controlIndex() == EMPXStatusPane ) |
1056 { |
1048 { |
1057 if ( mControls[i]->isVisible() ) |
1049 if ( mControls[i]->isVisible() ) |
1058 { |
1050 { |
1059 visible = ETrue; |
1051 visible = true; |
1060 } |
1052 } |
1061 |
1053 |
1062 break; |
1054 break; |
1063 } |
1055 } |
1064 } |
1056 } |
1343 disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), |
1335 disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ), |
1344 this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ); |
1336 this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ); |
1345 } |
1337 } |
1346 |
1338 |
1347 // ------------------------------------------------------------------------------------------------- |
1339 // ------------------------------------------------------------------------------------------------- |
1348 // QMPXVideoPlaybackControlsController::isAttachOperation |
|
1349 // ------------------------------------------------------------------------------------------------- |
|
1350 // |
|
1351 bool QMPXVideoPlaybackControlsController::isAttachOperation() |
|
1352 { |
|
1353 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isAttachOperation() ret %d"), |
|
1354 mIsAttachOperation ); |
|
1355 |
|
1356 return mIsAttachOperation; |
|
1357 } |
|
1358 |
|
1359 // ------------------------------------------------------------------------------------------------- |
|
1360 // QMPXVideoPlaybackControlsController::attachVideo() |
1340 // QMPXVideoPlaybackControlsController::attachVideo() |
1361 // ------------------------------------------------------------------------------------------------- |
1341 // ------------------------------------------------------------------------------------------------- |
1362 // |
1342 // |
1363 void QMPXVideoPlaybackControlsController::attachVideo() |
1343 void QMPXVideoPlaybackControlsController::attachVideo() |
1364 { |
1344 { |
1398 QStringList fileList; |
1378 QStringList fileList; |
1399 fileList.append( mFileDetails->mClipName ); |
1379 fileList.append( mFileDetails->mClipName ); |
1400 dlg.send( fileList, true ); |
1380 dlg.send( fileList, true ); |
1401 } |
1381 } |
1402 |
1382 |
|
1383 // ------------------------------------------------------------------------------------------------- |
|
1384 // QMPXVideoPlaybackControlsController::handleOrientationChanged() |
|
1385 // ------------------------------------------------------------------------------------------------- |
|
1386 // |
|
1387 void QMPXVideoPlaybackControlsController::handleOrientationChanged( Qt::Orientation orientation ) |
|
1388 { |
|
1389 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleOrientationChanged()"), |
|
1390 _L("old orientation %d, new orientation = %d"), mOrientation, orientation ); |
|
1391 |
|
1392 Qt::Orientation oldOrientaiton = mOrientation; |
|
1393 mOrientation = orientation; |
|
1394 |
|
1395 if ( oldOrientaiton == Qt::Vertical && orientation == Qt::Horizontal ) |
|
1396 { |
|
1397 showControls(); |
|
1398 } |
|
1399 } |
|
1400 |
1403 // End of File |
1401 // End of File |