equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: Implementation of QMPXVideoPlaybackProgressBar |
14 * Description: Implementation of QMPXVideoPlaybackProgressBar |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // Version : %version: da1mmcf#23 % |
18 // Version : %version: da1mmcf#24 % |
19 |
19 |
20 |
20 |
21 |
21 |
22 |
22 |
23 #include <QTime> |
23 #include <QTime> |
39 |
39 |
40 // ------------------------------------------------------------------------------------------------- |
40 // ------------------------------------------------------------------------------------------------- |
41 // QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar |
41 // QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar |
42 // ------------------------------------------------------------------------------------------------- |
42 // ------------------------------------------------------------------------------------------------- |
43 // |
43 // |
44 QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar( |
44 QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar( |
45 QMPXVideoPlaybackControlsController* controller ) |
45 QMPXVideoPlaybackControlsController* controller ) |
46 : mController( controller ) |
46 : mController( controller ) |
47 , mDuration( -1 ) |
|
48 , mDraggingPosition( 0 ) |
47 , mDraggingPosition( 0 ) |
49 , mSetPosition( -1 ) |
48 , mSetPosition( -1 ) |
50 , mNeedToResumeAfterSetPosition( false ) |
49 , mNeedToResumeAfterSetPosition( false ) |
51 , mInitialized( false ) |
50 , mInitialized( false ) |
52 , mSliderDragging( false ) |
51 , mSliderDragging( false ) |
66 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()")); |
65 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()")); |
67 |
66 |
68 if ( mSeekingTimer ) |
67 if ( mSeekingTimer ) |
69 { |
68 { |
70 disconnect( mSeekingTimer, SIGNAL( timeout() ), this, SLOT( handleSeekingTimeout() ) ); |
69 disconnect( mSeekingTimer, SIGNAL( timeout() ), this, SLOT( handleSeekingTimeout() ) ); |
71 |
70 |
72 if ( mSeekingTimer->isActive() ) |
71 if ( mSeekingTimer->isActive() ) |
73 { |
72 { |
74 mSeekingTimer->stop(); |
73 mSeekingTimer->stop(); |
75 } |
74 } |
76 |
75 |
93 // Don't need to initialize buttons once it gets initialized |
92 // Don't need to initialize buttons once it gets initialized |
94 // |
93 // |
95 if ( loader && ! mInitialized ) |
94 if ( loader && ! mInitialized ) |
96 { |
95 { |
97 mInitialized = true; |
96 mInitialized = true; |
98 mLiveStreaming = |
97 mLiveStreaming = |
99 ( mController->fileDetails()->mPlaybackMode == EMPXVideoLiveStreaming )? true:false; |
98 ( mController->fileDetails()->mPlaybackMode == EMPXVideoLiveStreaming )? true:false; |
100 |
99 |
101 // |
100 // |
102 // Create a timer for seeking. |
101 // Create a timer for seeking. |
103 // We will issue SetPosition every KSeekingTimeOut msec to show the current frame to user |
102 // We will issue SetPosition every KSeekingTimeOut msec to show the current frame to user |
104 // |
103 // |
105 mSeekingTimer = new QTimer(); |
104 mSeekingTimer = new QTimer(); |
106 mSeekingTimer->setSingleShot( false ); |
105 mSeekingTimer->setSingleShot( false ); |
107 mSeekingTimer->setInterval( KSeekingTimeOut ); |
106 mSeekingTimer->setInterval( KSeekingTimeOut ); |
117 connect( mProgressSlider, SIGNAL( sliderReleased() ), this, SLOT( handleSliderReleased() ) ); |
116 connect( mProgressSlider, SIGNAL( sliderReleased() ), this, SLOT( handleSliderReleased() ) ); |
118 connect( mProgressSlider, SIGNAL( sliderMoved( int ) ), this, SLOT( handleSliderMoved( int ) ) ); |
117 connect( mProgressSlider, SIGNAL( sliderMoved( int ) ), this, SLOT( handleSliderMoved( int ) ) ); |
119 |
118 |
120 // |
119 // |
121 // If we init the progress bar after pp sends the duration informatin |
120 // If we init the progress bar after pp sends the duration informatin |
122 // we need to set the duration manually |
121 // we need to set the duration manually |
123 // |
122 // |
124 durationChanged( (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier ); |
123 durationChanged( (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier ); |
125 |
124 |
126 // |
125 // |
127 // Set the position to 0 until we get position information |
126 // Set the position to 0 until we get position information |
133 // |
132 // |
134 HbFrameItem *frameItem = new HbFrameItem(); |
133 HbFrameItem *frameItem = new HbFrameItem(); |
135 frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" ); |
134 frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" ); |
136 frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces ); |
135 frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces ); |
137 frameItem->frameDrawer().setFillWholeRect( true ); |
136 frameItem->frameDrawer().setFillWholeRect( true ); |
138 setBackgroundItem( frameItem ); |
137 mProgressSlider->setBackgroundItem( frameItem ); |
139 } |
138 } |
140 } |
139 } |
141 |
140 |
142 // ------------------------------------------------------------------------------------------------- |
141 // ------------------------------------------------------------------------------------------------- |
143 // QMPXVideoPlaybackProgressBar::durationChanged |
142 // QMPXVideoPlaybackProgressBar::durationChanged |
147 { |
146 { |
148 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::durationChanged duration = %d"), duration ); |
147 MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::durationChanged duration = %d"), duration ); |
149 |
148 |
150 if ( mLiveStreaming ) |
149 if ( mLiveStreaming ) |
151 { |
150 { |
|
151 mDuration = 0; |
152 mProgressSlider->setMaxText( "Live" ); |
152 mProgressSlider->setMaxText( "Live" ); |
153 } |
153 } |
154 else |
154 else |
155 { |
155 { |
156 mDuration = duration; |
156 mDuration = duration; |
249 |
249 |
250 // ------------------------------------------------------------------------------------------------- |
250 // ------------------------------------------------------------------------------------------------- |
251 // QMPXVideoPlaybackProgressBar::handleSliderPressed |
251 // QMPXVideoPlaybackProgressBar::handleSliderPressed |
252 // ------------------------------------------------------------------------------------------------- |
252 // ------------------------------------------------------------------------------------------------- |
253 // |
253 // |
254 void QMPXVideoPlaybackProgressBar::handleSliderPressed() |
254 void QMPXVideoPlaybackProgressBar::handleSliderPressed() |
255 { |
255 { |
256 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::handleSliderPressed()")); |
256 MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::handleSliderPressed()")); |
257 |
257 |
258 mSliderDragging = true; |
258 mSliderDragging = true; |
259 |
259 |
263 // Pause the playback if it's playing |
263 // Pause the playback if it's playing |
264 // |
264 // |
265 if( mController->state() == EPbStatePlaying ) |
265 if( mController->state() == EPbStatePlaying ) |
266 { |
266 { |
267 mNeedToResumeAfterSetPosition = true; |
267 mNeedToResumeAfterSetPosition = true; |
268 mController->handleCommand( EMPXPbvCmdCustomPause ); |
268 mController->handleCommand( EMPXPbvCmdCustomPause ); |
269 } |
269 } |
270 } |
270 } |
271 |
271 |
272 // ------------------------------------------------------------------------------------------------- |
272 // ------------------------------------------------------------------------------------------------- |
273 // QMPXVideoPlaybackProgressBar::handleSliderMoved |
273 // QMPXVideoPlaybackProgressBar::handleSliderMoved |
274 // ------------------------------------------------------------------------------------------------- |
274 // ------------------------------------------------------------------------------------------------- |
275 // |
275 // |
276 void QMPXVideoPlaybackProgressBar::handleSliderMoved( int value ) |
276 void QMPXVideoPlaybackProgressBar::handleSliderMoved( int value ) |
277 { |
277 { |
278 MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::handleSliderMoved() position = %d"), value); |
278 MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::handleSliderMoved() position = %d"), value); |
279 |
279 |
280 updatePostion( value ); |
280 updatePostion( value ); |
281 |
281 |
322 |
322 |
323 if ( mSeekingTimer && mSeekingTimer->isActive() ) |
323 if ( mSeekingTimer && mSeekingTimer->isActive() ) |
324 { |
324 { |
325 mSeekingTimer->stop(); |
325 mSeekingTimer->stop(); |
326 } |
326 } |
327 |
327 |
328 mController->resetDisappearingTimers( EMPXTimerReset ); |
328 mController->resetDisappearingTimers( EMPXTimerReset ); |
329 int value = mProgressSlider->sliderValue(); |
329 int value = mProgressSlider->sliderValue(); |
330 |
330 |
331 if ( value >= mDuration ) |
331 if ( value >= mDuration ) |
332 { |
332 { |
362 QMPXVideoPlaybackViewFileDetails* details ) |
362 QMPXVideoPlaybackViewFileDetails* details ) |
363 { |
363 { |
364 MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateControlsWithFileDetails()")); |
364 MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateControlsWithFileDetails()")); |
365 |
365 |
366 if ( ! details->mPausableStream || ! details->mSeekable ) |
366 if ( ! details->mPausableStream || ! details->mSeekable ) |
367 { |
367 { |
368 mProgressSlider->setEnabled( false ); |
368 mProgressSlider->setEnabled( false ); |
369 } |
369 } |
370 else if ( ! mProgressSlider->isEnabled() ) |
370 else if ( ! mProgressSlider->isEnabled() ) |
371 { |
371 { |
372 mProgressSlider->setEnabled( true ); |
372 mProgressSlider->setEnabled( true ); |
373 } |
373 } |
374 |
374 |
375 backgroundItem()->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse ); |
375 mProgressSlider->backgroundItem()->setVisible( |
|
376 ( mController->viewMode() == EFullScreenView )? ETrue:EFalse ); |
376 } |
377 } |
377 |
378 |
378 // ------------------------------------------------------------------------------------------------- |
379 // ------------------------------------------------------------------------------------------------- |
379 // QMPXVideoPlaybackProgressBar::updateState() |
380 // QMPXVideoPlaybackProgressBar::updateState() |
380 // ------------------------------------------------------------------------------------------------- |
381 // ------------------------------------------------------------------------------------------------- |
386 switch ( state ) |
387 switch ( state ) |
387 { |
388 { |
388 case EPbStatePlaying: |
389 case EPbStatePlaying: |
389 case EPbStatePaused: |
390 case EPbStatePaused: |
390 { |
391 { |
391 if ( ! isEnabled() ) |
392 if ( ! mProgressSlider->isEnabled() ) |
392 { |
393 { |
393 setEnabled( true ); |
394 mProgressSlider->setEnabled( true ); |
394 } |
395 } |
395 |
396 |
396 break; |
397 break; |
397 } |
398 } |
398 default: |
399 default: |
399 { |
400 { |
400 if ( isEnabled() ) |
401 if ( mProgressSlider->isEnabled() ) |
401 { |
402 { |
402 setEnabled( false ); |
403 mProgressSlider->setEnabled( false ); |
403 } |
404 } |
404 break; |
405 break; |
405 } |
406 } |
406 } |
407 } |
407 } |
408 } |