]> git.sesse.net Git - vlc/commitdiff
Qt4 - Volume: if volume > 50% of the sliderBar, then show the highVolume Label.
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 8 Sep 2007 18:32:17 +0000 (18:32 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 8 Sep 2007 18:32:17 +0000 (18:32 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/main_interface.cpp

index 70fdc299c6e486aebbdc15c9af4cbc6a7bf84601..3708c49e538dcbbed6c7e1e436b3a7ea07486918 100644 (file)
@@ -462,18 +462,18 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
             prefs() );
     setupSmallButton( prefsButton );
     controlLayout->addWidget( prefsButton, 3, 13 );
-    
+
     controlLayout->setColumnStretch( 14, 5 );
 
     /* Volume */
     VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
 
-    QLabel *volMuteLabel = new QLabel;
+    volMuteLabel = new QLabel;
     volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
     volMuteLabel->setToolTip( qtr( "Mute" ) );
     volMuteLabel->installEventFilter( h );
 
-    /** TODO: 
+    /** TODO:
      * Change this slider to use a nice Amarok-like one 
      * Add a Context menu to change to the most useful %
      * **/
@@ -553,13 +553,16 @@ void ControlsWidget::setNavigation( int navigation )
 }
 
 static bool b_my_volume;
-void ControlsWidget::updateVolume( int sliderVolume )
+void ControlsWidget::updateVolume( int i_sliderVolume )
 {
     if( !b_my_volume )
     {
-        int i_res = sliderVolume * AOUT_VOLUME_MAX /
+        int i_res = i_sliderVolume * AOUT_VOLUME_MAX /
                             ( 2*volumeSlider->maximum() );
         aout_VolumeSet( p_intf, i_res );
+        if( i_sliderVolume < volumeSlider->maximum()/2 )
+            volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
+        else volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) );
     }
 }
 
index 760084103da402f2a934c48c77cb30f7997cc855..a5c8558a4e1e5243501824534e07ab9900fad173 100644 (file)
@@ -155,6 +155,7 @@ private:
     QPushButton         *playButton, *fullscreenButton;
     QPushButton         *slowerButton, *fasterButton;
     AdvControlsWidget   *advControls;
+    QLabel              *volMuteLabel;
 
     bool                 b_advancedVisible;
 private slots:
index 6515db8b5a1739570cc48c8fb29b575127c38e4b..8d58682f5e76c9af43a1b758fa204020a77896ff 100644 (file)
@@ -650,7 +650,7 @@ void MainInterface::toggleAdvanced()
 
 int MainInterface::getControlsVisibilityStatus()
 {
-    return(  (controls->isVisible() ? 0x2 : 0x0 ) 
+    return( (controls->isVisible() ? 0x2 : 0x0 )
                 + controls->b_advancedVisible );
 }