videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp
branchGCC_SURGE
changeset 48 ebbeb6bcda56
parent 47 45e72b57a2fd
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp	Tue Jun 15 13:09:36 2010 +0100
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp	Thu Jul 22 16:34:17 2010 +0100
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: da1mmcf#21 %
+// Version : %version: da1mmcf#24 %
 
 
 
@@ -41,11 +41,9 @@
 // QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar
 // -------------------------------------------------------------------------------------------------
 //
-QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar( 
+QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar(
         QMPXVideoPlaybackControlsController* controller )
     : mController( controller )
-    , mFrameItem( NULL )
-    , mDuration( -1 )
     , mDraggingPosition( 0 )
     , mSetPosition( -1 )
     , mNeedToResumeAfterSetPosition( false )
@@ -69,7 +67,7 @@
     if ( mSeekingTimer )
     {
         disconnect( mSeekingTimer, SIGNAL( timeout() ), this, SLOT( handleSeekingTimeout() ) );
-        
+
         if ( mSeekingTimer->isActive() )
         {
             mSeekingTimer->stop();
@@ -96,11 +94,11 @@
     if ( loader && ! mInitialized )
     {
         mInitialized = true;
-        mLiveStreaming = 
+        mLiveStreaming =
                 ( mController->fileDetails()->mPlaybackMode == EMPXVideoLiveStreaming )? true:false;
 
         //
-        // Create a timer for seeking. 
+        // Create a timer for seeking.
         // We will issue SetPosition every KSeekingTimeOut msec to show the current frame to user
         //
         mSeekingTimer = new QTimer();
@@ -120,7 +118,7 @@
 
         //
         // If we init the progress bar after pp sends the duration informatin
-        // we need to set the duration manually 
+        // we need to set the duration manually
         //
         durationChanged( (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier );
 
@@ -129,16 +127,14 @@
         //
         positionChanged( 0 );
 
-
         //
         // Set framedrawer for semi transparent background
         //
-        mFrameItem = new HbFrameItem ( parentItem() );
-        mFrameItem->setGeometry( boundingRect() );
-        mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
-        mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
-        mFrameItem->frameDrawer().setFillWholeRect( true );
-        mFrameItem->setVisible( false );
+        HbFrameItem *frameItem = new HbFrameItem();
+        frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_multimedia_trans" );
+        frameItem->frameDrawer().setFrameType( HbFrameDrawer::NinePieces );
+        frameItem->frameDrawer().setFillWholeRect( true );
+        mProgressSlider->setBackgroundItem( frameItem );
     }
 }
 
@@ -152,6 +148,7 @@
 
     if ( mLiveStreaming )
     {
+        mDuration = 0;
         mProgressSlider->setMaxText( "Live" );
     }
     else
@@ -254,7 +251,7 @@
 // QMPXVideoPlaybackProgressBar::handleSliderPressed
 // -------------------------------------------------------------------------------------------------
 //
-void QMPXVideoPlaybackProgressBar::handleSliderPressed() 
+void QMPXVideoPlaybackProgressBar::handleSliderPressed()
 {
     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::handleSliderPressed()"));
 
@@ -268,7 +265,7 @@
     if( mController->state() == EPbStatePlaying )
     {
         mNeedToResumeAfterSetPosition = true;
-        mController->handleCommand( EMPXPbvCmdCustomPause );   
+        mController->handleCommand( EMPXPbvCmdCustomPause );
     }
 }
 
@@ -276,7 +273,7 @@
 // QMPXVideoPlaybackProgressBar::handleSliderMoved
 // -------------------------------------------------------------------------------------------------
 //
-void QMPXVideoPlaybackProgressBar::handleSliderMoved( int value ) 
+void QMPXVideoPlaybackProgressBar::handleSliderMoved( int value )
 {
     MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::handleSliderMoved() position = %d"), value);
 
@@ -327,7 +324,7 @@
     {
         mSeekingTimer->stop();
     }
-    
+
     mController->resetDisappearingTimers( EMPXTimerReset );
     int value = mProgressSlider->sliderValue();
 
@@ -366,7 +363,7 @@
 {
     MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateControlsWithFileDetails()"));
 
-    if ( details->mPlaybackMode == EMPXVideoLiveStreaming )
+    if ( ! details->mPausableStream || ! details->mSeekable )
     {
         mProgressSlider->setEnabled( false );
     }
@@ -375,7 +372,8 @@
         mProgressSlider->setEnabled( true );
     }
 
-    mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse );
+    mProgressSlider->backgroundItem()->setVisible(
+            ( mController->viewMode() == EFullScreenView )? ETrue:EFalse );
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -391,18 +389,18 @@
         case EPbStatePlaying:
         case EPbStatePaused:
         {
-            if ( ! isEnabled() )
+            if ( ! mProgressSlider->isEnabled() )
             {
-                setEnabled( true );
+                mProgressSlider->setEnabled( true );
             }
 
             break;
         }
         default:
         {
-            if ( isEnabled() )
+            if ( mProgressSlider->isEnabled() )
             {
-                setEnabled( false );
+                mProgressSlider->setEnabled( false );
             }
             break;
         }