[vlc-devel] commit: Qt: menu, code simplification. (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Feb 20 01:19:30 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at sasmira.jbkempf.com> | Fri Feb 20 01:18:22 2009 +0100| [087123fe974490145e8c1a50ec726cd4c7dd3187] | committer: Jean-Baptiste Kempf 

Qt: menu, code simplification.

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

 modules/gui/qt4/actions_manager.hpp |    2 +-
 modules/gui/qt4/menus.cpp           |   30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/gui/qt4/actions_manager.hpp b/modules/gui/qt4/actions_manager.hpp
index 9fa3e88..463edc5 100644
--- a/modules/gui/qt4/actions_manager.hpp
+++ b/modules/gui/qt4/actions_manager.hpp
@@ -79,8 +79,8 @@ public slots:
     void toggleMuteAudio();
     void AudioUp();
     void AudioDown();
-protected slots:
     void play();
+protected slots:
     void fullscreen();
     void snapshot();
     void playlist();
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index a6c2319..1db4644 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -614,6 +614,7 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
 
     }
 
+    /* */
     input_thread_t *p_object;
     vector<vlc_object_t *> objects;
     vector<const char *> varnames;
@@ -622,15 +623,20 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
     if( p_object )
         vlc_object_hold( p_object );
     InputAutoMenuBuilder( p_object, objects, varnames );
+
+    /* Title and so on */
     PUSH_VAR( "prev-title" );
     PUSH_VAR( "next-title" );
     PUSH_VAR( "prev-chapter" );
     PUSH_VAR( "next-chapter" );
+
+    menu->addSeparator();
+
     EnableStaticEntries( menu, ( p_object != NULL ) );
+
     if( p_object )
-    {
         vlc_object_release( p_object );
-    }
+
     return Populate( p_intf, menu, varnames, objects );
 }
 
@@ -715,23 +721,17 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
                                         intf_thread_t *p_intf,
                                         input_thread_t *p_input )
 {
-    if( p_input )
+    if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S )
+    {
+        QAction *action = menu->addAction( qtr( "Play" ),
+                ActionsManager::getInstance( p_intf ), SLOT( play() ) );
+        action->setIcon( QIcon( ":/play" ) );
+    }
+    else
     {
-        vlc_value_t val;
-        var_Get( p_input, "state", &val );
-        if( val.i_int == PLAYING_S )
             addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
                     ":/pause", SLOT( togglePlayPause() ) );
-        else
-            addMIMStaticEntry( p_intf, menu, qtr( "Play" ),
-                    ":/play", SLOT( togglePlayPause() ) );
     }
-    else if( THEPL->items.i_size )
-        addMIMStaticEntry( p_intf, menu, qtr( "Play" ),
-                ":/play", SLOT( togglePlayPause() ) );
-    else
-        addDPStaticEntry( menu, qtr( "Play" ),
-                ":/play", SLOT( openDialog() ) );
 
     addMIMStaticEntry( p_intf, menu, qtr( "Stop" ),
             ":/stop", SLOT( stop() ) );




More information about the vlc-devel mailing list