]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/menus.cpp
Do not read directory twice. This solves #1761 but this may not be the real solution...
[vlc] / modules / gui / qt4 / menus.cpp
index 327713710a18721c3fcbaacecb13249c71adc255..35ebb977b626ab4fe7b035bf7db60677f24af0bd 100644 (file)
@@ -191,7 +191,9 @@ static int VideoAutoMenuBuilder( vlc_object_t *p_object,
     PUSH_VAR( "aspect-ratio" );
     PUSH_VAR( "crop" );
     PUSH_VAR( "video-on-top" );
+#ifdef WIN32
     PUSH_VAR( "directx-wallpaper" );
+#endif
     PUSH_VAR( "video-snapshot" );
 
     if( p_object )
@@ -232,17 +234,6 @@ static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
     return NULL;
 }
 
-static QAction * FindActionWithText( QMenu *menu, QString &text )
-{
-    QAction *action;
-    foreach( action, menu->actions() )
-    {
-        if( action->text() == text )
-            return action;
-    }
-    return NULL;
-}
-
 /*****************************************************************************
  * All normal menus
  * Simple Code
@@ -273,12 +264,15 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
        setDesktopAware set to false */
     QMenuBar *bar = mi->menuBar();
     BAR_ADD( FileMenu(), qtr( "&Media" ) );
-    BAR_ADD( PlaylistMenu( p_intf, mi ), qtr( "&Playlist" ) );
-    BAR_ADD( ToolsMenu( p_intf, NULL, mi, visual_selector_enabled, true ),
-             qtr( "&Tools" ) );
+
     BAR_DADD( AudioMenu( p_intf, NULL ), qtr( "&Audio" ), 1 );
     BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 2 );
     BAR_DADD( NavigMenu( p_intf, NULL ), qtr( "P&layback" ), 3 );
+
+    BAR_ADD( PlaylistMenu( p_intf, mi ), qtr( "&Playlist" ) );
+    BAR_ADD( ToolsMenu( p_intf, NULL, mi, visual_selector_enabled, true ),
+             qtr( "&Tools" ) );
+
     BAR_ADD( HelpMenu( NULL ), qtr( "&Help" ) );
 }
 #undef BAR_ADD
@@ -295,7 +289,7 @@ QMenu *QVLCMenu::FileMenu()
     addDPStaticEntry( menu, qtr( "&Open File..." ), "",
         ":/file-asym", SLOT( openFileDialog() ), "Ctrl+O" );
     addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "",
-        ":/folder-grey", SLOT( PLAppendDir() ), "Ctrl+F" );
+        ":/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" );
     addDPStaticEntry( menu, qtr( "Open &Disc..." ), "",
         ":/disc", SLOT( openDiscDialog() ), "Ctrl+D" );
     addDPStaticEntry( menu, qtr( "Open &Network..." ), "",
@@ -305,11 +299,11 @@ QMenu *QVLCMenu::FileMenu()
         "Ctrl+C" );
     menu->addSeparator();
 
+    addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
+        SLOT( openThenTranscodingDialogs() ), "Ctrl+R" );
     addDPStaticEntry( menu, qtr( "&Streaming..." ), "",
         ":/stream", SLOT( openThenStreamingDialogs() ),
         "Ctrl+S" );
-    addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
-        SLOT( openThenTranscodingDialogs() ), "Ctrl+R" );
     menu->addSeparator();
 
     addDPStaticEntry( menu, qtr( "&Quit" ) , "",
@@ -506,7 +500,9 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
         ACT_ADD( current, "aspect-ratio", qtr( "&Aspect Ratio" ) );
         ACT_ADD( current, "crop", qtr( "&Crop" ) );
         ACT_ADD( current, "video-on-top", qtr( "Always &On Top" ) );
-        /* ACT_ADD( current, "directx-wallpaper", qtr( "DirectX Wallpaper" ) ); */
+#ifdef WIN32
+        ACT_ADD( current, "directx-wallpaper", qtr( "DirectX Wallpaper" ) );
+#endif
         ACT_ADD( current, "video-snapshot", qtr( "Sna&pshot" ) );
         /* ACT_ADD( current, "ffmpeg-pp-q", qtr( "Decoder" ) ); */
     }
@@ -681,7 +677,7 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu )
     addDPStaticEntry( openmenu, qtr( "&Open File..." ), "",
         ":/file-asym", SLOT( openFileDialog() ) );
     addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ), "",
-        ":/folder-grey", SLOT( PLAppendDir() ) );
+        ":/folder-grey", SLOT( PLOpenDir() ) );
     addDPStaticEntry( openmenu, qtr( "Open &Disc..." ), "",
         ":/disc", SLOT( openDiscDialog() ) );
     addDPStaticEntry( openmenu, qtr( "Open &Network..." ), "",
@@ -857,6 +853,25 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
                 action->setCheckable( true );
                 action->setChecked( mi->isFullScreen() );
             }
+            else /* We are using the skins interface.
+                    If not, this entry will not show. */
+            {
+                objects.clear();
+                varnames.clear();
+                vlc_object_t *p_object = ( vlc_object_t* )
+                     vlc_object_find( p_intf, VLC_OBJECT_INTF, FIND_PARENT );
+                if( p_object )
+                {
+                    objects.push_back( p_object->i_object_id );
+                    varnames.push_back( "intf-skins" );
+                    Populate( p_intf, submenu, varnames, objects );
+                    vlc_object_release( p_object );
+                }
+                else
+                {
+                    msg_Dbg( p_intf, "could not find parent interface" );
+                }
+            }
             menu->addMenu( submenu );
         }
 
@@ -1157,7 +1172,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
     }
 
     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
-                &val_list, &text_list ) < 0 )
+                    &val_list, &text_list ) < 0 )
     {
         return VLC_EGENERIC;
     }
@@ -1236,18 +1251,11 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
     QAction *action = FindActionWithVar( menu, psz_var );
     if( !action )
     {
-        /* This is a value */
-        action = FindActionWithText( menu, text );
-        if( !action )
-        {
-            action = new QAction( text, menu );
-            menu->addAction( action );
-        }
+        action = new QAction( text, menu );
+        menu->addAction( action );
     }
 
-    /* FIXME action->setText( text ); */
     action->setToolTip( help );
-
     action->setEnabled( i_object_id != 0 );
 
     if( i_item_type == ITEM_CHECK )