Qt: menus, add VolumeMute/VolumeUp/VolumeDown in the audio menu to match OSX Audio...
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 8 Feb 2009 00:11:11 +0000 (01:11 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 8 Feb 2009 00:11:11 +0000 (01:11 +0100)
We still have one more separator than OSX has.

modules/gui/qt4/actions_manager.cpp
modules/gui/qt4/actions_manager.hpp
modules/gui/qt4/components/controller_widget.cpp
modules/gui/qt4/menus.cpp

index 9e5cd8c..ee5bcb6 100644 (file)
@@ -27,6 +27,7 @@
 #endif
 
 #include <vlc_vout.h>
+#include <vlc_aout.h>
 #include <vlc_keys.h>
 
 #include "actions_manager.hpp"
@@ -167,4 +168,18 @@ void ActionsManager::frame()
         var_SetVoid( p_input, "frame-next" );
 }
 
+void ActionsManager::toggleMuteAudio()
+{
+     aout_VolumeMute( p_intf, NULL );
+}
+
+void ActionsManager::AudioUp()
+{
+    aout_VolumeUp( p_intf, 1, NULL );
+}
+
+void ActionsManager::AudioDown()
+{
+    aout_VolumeDown( p_intf, 2, NULL );
+}
 
index 6ab2089..9fa3e88 100644 (file)
@@ -75,9 +75,10 @@ private:
     ActionsManager( intf_thread_t  *_p_i, QObject *_parent );
     intf_thread_t       *p_intf;
 
-protected slots:
-    virtual void doAction( int );
-
+public slots:
+    void toggleMuteAudio();
+    void AudioUp();
+    void AudioDown();
 protected slots:
     void play();
     void fullscreen();
@@ -86,6 +87,7 @@ protected slots:
     void record();
     void frame();
 
+    virtual void doAction( int );
 };
 
 #endif
index 8cad93a..31f0063 100644 (file)
@@ -139,8 +139,6 @@ bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
         else
         {
             aout_VolumeMute( p_intf, NULL );
-            audio_volume_t i_volume;
-            aout_VolumeGet( p_intf, &i_volume );
         }
         e->accept();
         return true;
index 82e11eb..9d55d26 100644 (file)
@@ -40,6 +40,7 @@
 #include "dialogs_provider.hpp"  /* Dialogs display */
 #include "input_manager.hpp"     /* Input Management */
 #include "recents.hpp"           /* Recent Items */
+#include "actions_manager.hpp"
 
 #include <QMenu>
 #include <QMenuBar>
@@ -493,6 +494,17 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
 
     if( current->isEmpty() )
     {
+        QAction *action = current->addAction( qtr( "Mute Audio" ),
+                ActionsManager::getInstance( p_intf ), SLOT( toggleMuteAudio() ) );
+        action->setData( true );
+        action = current->addAction( qtr( "Increase Volume" ),
+                ActionsManager::getInstance( p_intf ), SLOT( AudioUp() ) );
+        action->setData( true );
+        action = current->addAction( qtr( "Decrease Volume" ),
+                ActionsManager::getInstance( p_intf ), SLOT( AudioDown() ) );
+        action->setData( true );
+
+        current->addSeparator();
         ACT_ADD( current, "visual", qtr( "&Visualizations" ) );
         current->addSeparator();
         ACT_ADD( current, "audio-es", qtr( "Audio &Track" ) );