]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.cpp
Qt: Fix SpeedLabel's tooltip
[vlc] / modules / gui / qt4 / components / interface_widgets.cpp
index ec5f29e9c24e851446ae03769c3eb4a78215496d..2409bf163dc99cd2aae26a65d096a11a7b5d010f 100644 (file)
@@ -291,12 +291,6 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
              this, updateArt( const QString& ) );
 }
 
-void BackgroundWidget::resizeEvent( QResizeEvent * event )
-{
-    updateArt( "" );
-    QWidget::resizeEvent( event );
-}
-
 void BackgroundWidget::updateArt( const QString& url )
 {
     if ( !url.isEmpty() )
@@ -310,6 +304,7 @@ void BackgroundWidget::updateArt( const QString& url )
         else
             pixmapUrl = QString( ":/logo/vlc128.png" );
     }
+    update();
 }
 
 void BackgroundWidget::paintEvent( QPaintEvent *e )
@@ -422,7 +417,7 @@ void VisualSelector::next()
 SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, QWidget *parent )
            : QLabel( parent ), p_intf( _p_intf )
 {
-    setToolTip( qtr( "Current playback speed.\nClick to adjust" ) );
+    tooltipStringPattern = qtr( "Current playback speed: %1\nClick to adjust" );
 
     /* Create the Speed Control Widget */
     speedControl = new SpeedControlWidget( p_intf, this );
@@ -462,7 +457,7 @@ void SpeedLabel::setRate( float rate )
     str.setNum( rate, 'f', 2 );
     str.append( "x" );
     setText( str );
-    setToolTip( str );
+    setToolTip( tooltipStringPattern.arg( str ) );
     speedControl->updateControls( rate );
 }
 
@@ -635,9 +630,10 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
     secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
                                                            : time );
 
-    QString timestr;
-    timestr.sprintf( " %s%s/%s ", (b_remainingTime && length) ? "-" : "",
-                     psz_time, ( !length && time ) ? "--:--" : psz_length );
+    QString timestr = QString( " %1%2/%3 " )
+            .arg( QString( (b_remainingTime && length) ? "-" : "" ) )
+            .arg( QString( psz_time ) )
+            .arg( QString( ( !length && time ) ? "--:--" : psz_length ) );
 
     setText( timestr );
 
@@ -656,9 +652,10 @@ void TimeLabel::setDisplayPosition( float pos )
     secstotimestr( psz_time,
                    ( b_remainingTime && cachedLength ?
                    cachedLength - time : time ) );
-    QString timestr;
-    timestr.sprintf( " %s%s/%s ", (b_remainingTime && cachedLength) ? "-" : "",
-                     psz_time, ( !cachedLength && time ) ? "--:--" : psz_length );
+    QString timestr = QString( " %1%2/%3 " )
+        .arg( QString( (b_remainingTime && cachedLength) ? "-" : "" ) )
+        .arg( QString( psz_time ) )
+        .arg( QString( ( !cachedLength && time ) ? "--:--" : psz_length ) );
 
     setText( timestr );
 }