]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/menus.cpp
Qt4 - Media Info. Re-add some info for DVB. Clean the in_Edit state that was stored...
[vlc] / modules / gui / qt4 / menus.cpp
index f4c17d6bdfcde28698602030fa8a262108d93ce3..055534b7e0f63fe41a2fae5d05f6ebd6efee9b85 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2006-2007 the VideoLAN team
  * $Id$
  *
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
  *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#ifndef WIN32
-#   include <signal.h>
-#endif
-
 #include <vlc_intf_strings.h>
 
 #include "main_interface.hpp"
@@ -171,20 +167,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
         bool playlist, bool adv_controls_enabled,
         bool visual_selector_enabled )
 {
-#ifndef WIN32
-    /* Ugly klugde
-     * Remove SIGCHLD from the ignored signal the time to initialise
-     * Qt because it call gconf to get the icon theme */
-    sigset_t set;
-
-    sigemptyset( &set );
-    sigaddset( &set, SIGCHLD );
-    pthread_sigmask( SIG_UNBLOCK, &set, NULL );
-#endif /* WIN32 */
     QMenuBar *bar = mi->menuBar();
-#ifndef WIN32
-    pthread_sigmask( SIG_BLOCK, &set, NULL );
-#endif /* WIN32 */
     BAR_ADD( FileMenu(), qtr("&Media") );
     if( playlist )
     {
@@ -241,10 +224,12 @@ QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
 {
     QMenu *menu = new QMenu();
     menu->addMenu( SDMenu( p_intf ) );
+    menu->addAction ( QIcon(":/pixmaps/vlc_playlist_16px.png"),
+                      qtr( "Show Playlist"), mi, SLOT( togglePlaylist() ) );
     menu->addSeparator();
 
-    DP_SADD( menu, qtr( I_PL_LOAD ), "", "", openPlaylist(), "Ctrl+L" );
-    DP_SADD( menu, qtr( I_PL_SAVE ), "", "", savePlaylist(), "Ctrl+K" );
+    DP_SADD( menu, qtr( I_PL_LOAD ), "", "", openPlaylist(), "Ctrl+X" );
+    DP_SADD( menu, qtr( I_PL_SAVE ), "", "", savePlaylist(), "Ctrl+Y" );
     menu->addSeparator();
     menu->addAction( qtr("Undock from interface"), mi,
             SLOT( undockPlaylist() ), qtr("Ctrl+U") );
@@ -253,7 +238,7 @@ QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
 
 /**
  * Tools/View Menu
- * This is kept in the same menu for now, but could change if it gets much 
+ * This is kept in the same menu for now, but could change if it gets much
  * longer.
  **/
 QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
@@ -283,25 +268,26 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
     if( mi )
     {
         QAction *adv = menu->addAction( qtr("Advanced controls" ),
-                mi, SLOT( advanced() ) );
+                mi, SLOT( toggleAdvanced() ) );
         adv->setCheckable( true );
         if( adv_controls_enabled ) adv->setChecked( true );
+
+        menu->addAction( qtr( "Hide Menus..." ), mi, SLOT( toggleMenus() ),
+                qtr( "Ctrl+H") );
+        menu->addSeparator();
+
 #if 0 /* For Visualisations. Not yet working */
         adv = menu->addAction( qtr("Visualizations selector" ),
                 mi, SLOT( visual() ) );
         adv->setCheckable( true );
         if( visual_selector_enabled ) adv->setChecked( true );
 #endif
-        QAction *plAction = menu->addAction ( qtr( "Playlist"), mi,
-                SLOT( playlist() ) );
-        plAction->setCheckable( true );
-
+        menu->addAction ( QIcon(":/pixmaps/vlc_playlist_16px.png"),
+                          qtr( "Playlist"), mi, SLOT( togglePlaylist() ),
+                          qtr( "Ctrl+L") );
     }
-    QAction *extAction = menu->addAction( qtr( I_MENU_EXT ), THEDP,
-                SLOT( extendedDialog() ), qtr( "Ctrl+E" ) );
-    extAction->setCheckable( true );
-
-    DP_SADD( menu, qtr( "Hide Menus..." ), "","",hideMenus(), "Ctrl+H" );
+    DP_SADD( menu, qtr( I_MENU_EXT ), "", ":/pixmaps/vlc_settings_16px.png",
+                 extendedDialog() ,  "Ctrl+E"  );
 
     menu->addSeparator();
     DP_SADD( menu, qtr("Preferences"), "", ":/pixmaps/vlc_preferences_16px.png",
@@ -425,30 +411,36 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
     for( int i_index = 0 ; i_index < p_list->i_count; i_index++ )
     {
         module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object ;
-        if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
+        if( module_IsCapable( p_parser, "services_discovery" ) )
             i_num++;
     }
     for( int i_index = 0 ; i_index < p_list->i_count; i_index++ )
     {
         module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object;
-        if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
+        if( !module_IsCapable( p_parser, "services_discovery" ) )
+            continue;
+
+        QAction *a = new QAction( qfu( module_GetLongName( p_parser ) ), menu );
+        a->setCheckable( true );
+        /* hack to handle submodules properly */
+        int i = -1;
+        while( p_parser->pp_shortcuts[++i] != NULL );
+        i--;
+        if( playlist_IsServicesDiscoveryLoaded( THEPL,
+                    i>=0?p_parser->pp_shortcuts[i]
+                    : module_GetObjName( p_parser ) ) )
+            a->setChecked( true );
+        CONNECT( a , triggered(), THEDP->SDMapper, map() );
+        THEDP->SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
+                                              module_GetObjName( p_parser ) );
+        menu->addAction( a );
+
+        if( !strcmp( p_parser->psz_object_name, "podcast" ) )
         {
-            QAction *a = new QAction( qfu( p_parser->psz_longname ), menu );
-            a->setCheckable( true );
-            /* hack to handle submodules properly */
-            int i = -1;
-            while( p_parser->pp_shortcuts[++i] != NULL );
-            i--;
-            if( playlist_IsServicesDiscoveryLoaded( THEPL,
-                        i>=0?p_parser->pp_shortcuts[i]
-                        : p_parser->psz_object_name ) )
-            {
-                a->setChecked( true );
-            }
-            CONNECT( a , triggered(), THEDP->SDMapper, map() );
-            THEDP->SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
-                    p_parser->psz_object_name );
-            menu->addAction( a );
+            QAction *b = new QAction( qfu( "Configure podcasts..." ), menu );
+            //b->setEnabled( a->isChecked() );
+            menu->addAction( b );
+            CONNECT( b, triggered(), THEDP, podcastConfigureDialog() );
         }
     }
     vlc_list_release( p_list );
@@ -486,9 +478,9 @@ QMenu *QVLCMenu::HelpMenu()
     i_last_separator = 0;
 
 #define POPUP_PLAY_ENTRIES( menu )\
-    vlc_value_t val; \
     if( p_input ) \
     { \
+        vlc_value_t val; \
         var_Get( p_input, "state", &val ); \
         if( val.i_int == PLAYING_S ) \
             MIM_SADD( menu, qtr("Pause"), "", ":/pixmaps/vlc_pause_16px.png", \
@@ -506,10 +498,7 @@ QMenu *QVLCMenu::HelpMenu()
             prev() ); \
     MIM_SADD( menu, qtr("Next"), "", ":/pixmaps/vlc_next_16px.png", next() );
 
-#define POPUP_STATIC_ENTRIES \
-    POPUP_PLAY_ENTRIES( menu ); \
-    \
-    menu->addSeparator(); \
+#define POPUP_STATIC_ENTRIES( menu ) \
     QMenu *intfmenu = InterfacesMenu( p_intf, NULL ); \
     intfmenu->setTitle( qtr("Interfaces" ) ); \
     menu->addMenu( intfmenu ); \
@@ -580,7 +569,9 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
 /* Navigation stuff, and general menus (open) */
 void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
 {
+    vlc_value_t val;
     POPUP_BOILERPLATE;
+
     if( p_input )
     {
         vlc_object_yield( p_input );
@@ -591,8 +582,12 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
 
     QMenu *menu = new QMenu();
     Populate( p_intf, menu, varnames, objects );
+
     menu->addSeparator();
-    POPUP_STATIC_ENTRIES;
+    POPUP_PLAY_ENTRIES( menu );
+
+    menu->addSeparator();
+    POPUP_STATIC_ENTRIES( menu );
 
     p_intf->p_sys->p_popup_menu = menu;
     menu->popup( QCursor::pos() );
@@ -642,7 +637,9 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
             QMenu *menu = new QMenu();
             Populate( p_intf, menu, varnames, objects );
             menu->addSeparator();
-            POPUP_STATIC_ENTRIES;
+            POPUP_PLAY_ENTRIES( menu );
+            menu->addSeparator();
+            POPUP_STATIC_ENTRIES( menu );
 
             p_intf->p_sys->p_popup_menu = menu;
         }
@@ -1015,4 +1012,6 @@ void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
     if( p_object == NULL ) return;
 
     var_Set( p_object, itemData->psz_var, itemData->val );
-    vlc_object_release( p_object );}
+    vlc_object_release( p_object );
+}
+