[vlc-commits] commit: Qt: correctly implement play-and-exit in menu (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Mon Nov 15 22:43:48 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Nov 15 22:20:09 2010 +0100| [5e85bff1849e4391b6598bfbcc5a6c65cd1e151d] | committer: Jean-Baptiste Kempf 

Qt: correctly implement play-and-exit in menu

This calls a var_GetBool each time a menu is redrawn. This may be not
optimal. Maybe a callback on "play-and-exit" would be better?
Do we care about the performance on that part (menu display)?
Close #3842

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

 modules/gui/qt4/input_manager.cpp |    4 ++++
 modules/gui/qt4/input_manager.hpp |    1 +
 modules/gui/qt4/menus.cpp         |   11 ++++-------
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index c6ed2b0..1cefa87 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -1146,6 +1146,10 @@ void MainInputManager::activatePlayQuit( bool b_exit )
     var_SetBool( THEPL, "play-and-exit", b_exit );
 }
 
+bool MainInputManager::getPlayExitState()
+{
+    return var_GetBool( THEPL, "play-and-exit" );
+}
 
 /****************************
  * Static callbacks for MIM *
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 3654984..65a32e1 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -265,6 +265,7 @@ public:
     vout_thread_t* getVout();
     aout_instance_t *getAout();
 
+    bool getPlayExitState();
 private:
     MainInputManager( intf_thread_t * );
     virtual ~MainInputManager();
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 2e5d085..f3e5cd6 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -487,13 +487,10 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface
     action->setChecked( mi->isPlDocked() );
     CONNECT( action, triggered( bool ), mi, dockPlaylist( bool ) );
 
-    if( !current )
-    // I don't want to manage consistency between menus, so no popup-menu
-    {
-        action = menu->addAction( qtr( "Quit after Playback" ) );
-        action->setCheckable( true );
-        CONNECT( action, triggered( bool ), THEMIM, activatePlayQuit( bool ) );
-    }
+    action = menu->addAction( qtr( "Quit after Playback" ) );
+    action->setCheckable( true );
+    action->setChecked( THEMIM->getPlayExitState() );
+    CONNECT( action, triggered( bool ), THEMIM, activatePlayQuit( bool ) );
 
 #if 0 /* For Visualisations. Not yet working */
     adv = menu->addAction( qtr( "Visualizations selector" ),



More information about the vlc-commits mailing list