[vlc-commits] Qt: remove buffering info from TimeLabel

Francois Cartegnie git at videolan.org
Sun Mar 16 02:28:04 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Mar 16 02:24:42 2014 +0100| [00f76ba241a73ccfada32c3171e0d3da6b298619] | committer: Francois Cartegnie

Qt: remove buffering info from TimeLabel

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=00f76ba241a73ccfada32c3171e0d3da6b298619
---

 modules/gui/qt4/components/interface_widgets.cpp |   47 +---------------------
 modules/gui/qt4/components/interface_widgets.hpp |    8 ----
 2 files changed, 1 insertion(+), 54 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index e25be11..263c72d 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -730,8 +730,7 @@ void CoverArtLabel::clear()
 }
 
 TimeLabel::TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType  )
-    : ClickableQLabel(), p_intf( _p_intf ), bufTimer( new QTimer(this) ),
-      buffering( false ), showBuffering(false), bufVal( -1 ), displayType( _displayType )
+    : ClickableQLabel(), p_intf( _p_intf ), displayType( _displayType )
 {
     b_remainingTime = false;
     if( _displayType != TimeLabel::Elapsed )
@@ -758,22 +757,14 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType  )
     }
     setAlignment( Qt::AlignRight | Qt::AlignVCenter );
 
-    bufTimer->setSingleShot( true );
-
     CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
               this, setDisplayPosition( float, int64_t, int ) );
-    CONNECT( THEMIM->getIM(), cachingChanged( float ),
-              this, updateBuffering( float ) );
-    CONNECT( bufTimer, timeout(), this, updateBuffering() );
 
     setStyleSheet( "padding-left: 4px; padding-right: 4px;" );
 }
 
 void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
 {
-    showBuffering = false;
-    bufTimer->stop();
-
     if( pos == -1.f )
     {
         setMinimumSize( QSize( 0, 0 ) );
@@ -864,39 +855,3 @@ void TimeLabel::toggleTimeDisplay()
     getSettings()->setValue( "MainWindow/ShowRemainingTime", b_remainingTime );
 }
 
-
-void TimeLabel::updateBuffering( float _buffered )
-{
-    bufVal = _buffered;
-    if( !buffering || bufVal == 0 )
-    {
-        showBuffering = false;
-        buffering = true;
-        bufTimer->start(200);
-    }
-    else if( bufVal == 1 )
-    {
-        showBuffering = buffering = false;
-        bufTimer->stop();
-    }
-    update();
-}
-
-void TimeLabel::updateBuffering()
-{
-    showBuffering = true;
-    update();
-}
-
-void TimeLabel::paintEvent( QPaintEvent* event )
-{
-    if( showBuffering )
-    {
-        QRect r( rect() );
-        r.setLeft( r.width() * bufVal );
-        QPainter p( this );
-        p.setOpacity( 0.4 );
-        p.fillRect( r, palette().color( QPalette::Highlight ) );
-    }
-    QLabel::paintEvent( event );
-}
diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp
index d4be935..520039f 100644
--- a/modules/gui/qt4/components/interface_widgets.hpp
+++ b/modules/gui/qt4/components/interface_widgets.hpp
@@ -200,22 +200,14 @@ private:
     intf_thread_t *p_intf;
     bool b_remainingTime;
     int cachedLength;
-    QTimer *bufTimer;
-
-    bool buffering;
-    bool showBuffering;
-    float bufVal;
     TimeLabel::Display displayType;
 
     char psz_length[MSTRTIME_MAX_SIZE];
     char psz_time[MSTRTIME_MAX_SIZE];
     void toggleTimeDisplay();
-    void paintEvent( QPaintEvent* );
 private slots:
     void setDisplayPosition( float pos, int64_t time, int length );
     void setDisplayPosition( float pos );
-    void updateBuffering( float );
-    void updateBuffering();
 };
 
 class SpeedLabel : public QLabel



More information about the vlc-commits mailing list