]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller_widget.cpp
Qt4: remove audio/video port from RTP streaming wizard
[vlc] / modules / gui / qt4 / components / controller_widget.cpp
index 5276cd8acf01d2a0fe8003eb79a6abb0d082ad29..d6916bae3860d69f2c9df5dd7bbcc315ca828e45 100644 (file)
@@ -42,8 +42,8 @@
 
 SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
                           bool b_shiny, bool b_special )
-                         : QWidget( _parent ), b_my_volume( false ),
-                           p_intf( _p_intf)
+                         : QWidget( _parent ), p_intf( _p_intf),
+                           b_my_volume( false )
 {
     /* We need a layout for this widget */
     QHBoxLayout *layout = new QHBoxLayout( this );
@@ -111,8 +111,8 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
         layout->addWidget( volumeSlider, 0, Qt::AlignBottom  );
 
     /* Set the volume from the config */
-    volumeSlider->setValue( config_GetInt( p_intf, "volume" ) ) *
-                              VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
+    volumeSlider->setValue( qRound( ( (qreal)config_GetInt( p_intf, "volume" ) ) *
+                              VOLUME_MAX / (AOUT_VOLUME_MAX/2) ) );
 
     /* Force the update at build time in order to have a muted icon if needed */
     updateVolume( volumeSlider->value() );
@@ -133,12 +133,14 @@ void SoundWidget::updateVolume( int i_sliderVolume )
     if( !b_my_volume )
     {
         int i_res = i_sliderVolume  * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
-        aout_VolumeSet( p_intf, i_res );
+        playlist_t *p_playlist = pl_Hold( p_intf );
+        aout_VolumeSet( p_playlist, i_res );
+        pl_Release( p_intf );
     }
     if( i_sliderVolume == 0 )
     {
         volMuteLabel->setPixmap( QPixmap(":/toolbar/volume-muted" ) );
-        volMuteLabel->setToolTip( qtr( "Unmute" ) );
+        volMuteLabel->setToolTip(qfu(vlc_pgettext("Tooltip|Unmute", "Unmute")));
         return;
     }
 
@@ -147,14 +149,17 @@ void SoundWidget::updateVolume( int i_sliderVolume )
     else if( i_sliderVolume > (VOLUME_MAX * 2 / 3 ) )
         volMuteLabel->setPixmap( QPixmap( ":/toolbar/volume-high" ) );
     else volMuteLabel->setPixmap( QPixmap( ":/toolbar/volume-medium" ) );
-    volMuteLabel->setToolTip( qtr( "Mute" ) );
+    volMuteLabel->setToolTip( qfu(vlc_pgettext("Tooltip|Mute", "Mute")) );
 }
 
 void SoundWidget::updateVolume()
 {
     /* Audio part */
     audio_volume_t i_volume;
-    aout_VolumeGet( p_intf, &i_volume );
+    playlist_t *p_playlist = pl_Hold( p_intf );
+
+    aout_VolumeGet( p_playlist, &i_volume );
+    pl_Release( p_intf );
     i_volume = ( ( i_volume + 1 ) *  VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
     int i_gauge = volumeSlider->value();
     b_my_volume = false;
@@ -168,6 +173,7 @@ void SoundWidget::updateVolume()
 
 void SoundWidget::showVolumeMenu( QPoint pos )
 {
+    volumeMenu->setFixedHeight( volumeMenu->sizeHint().height() );
     volumeMenu->exec( QCursor::pos() - pos - QPoint( 0, volumeMenu->height()/2 )
                           + QPoint( width(), height() /2) );
 }
@@ -184,7 +190,10 @@ bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
         }
         else
         {
-            aout_VolumeMute( p_intf, NULL );
+            playlist_t *p_playlist = pl_Hold( p_intf );
+
+            aout_ToggleMute( p_playlist, NULL );
+            pl_Release( p_intf );
         }
         e->accept();
         return true;