#include "menus.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
+#include "recents.hpp"
#include <QMenu>
#include <QMenuBar>
#include <QActionGroup>
#include <QSignalMapper>
#include <QSystemTrayIcon>
+#include <QList>
/*
This file defines the main menus and the pop-up menu (right-click menu)
A QSignalMapper decides when to rebuild those menus cf MenuFunc in the .hpp
Just before one of those menus are aboutToShow(), they are rebuild.
-
-
*/
enum
* that doesn't update the QAction checked state when QMenu is hidden */
QAction *QVLCMenu::minimalViewAction = NULL;
-// Add static entries to menus
+QMenu *QVLCMenu::recentsMenu = NULL;
+
+/****************************************************************************
+ * Menu code helpers:
+ ****************************************************************************
+ * Add static entries to DP in menus
+ ***************************************************************************/
void addDPStaticEntry( QMenu *menu,
const QString text,
const char *help,
action->setData( "_static_" );
}
-void addMIMStaticEntry( intf_thread_t *p_intf,
- QMenu *menu,
- const QString text,
- const char *help,
- const char *icon,
- const char *member )
-{
- if( strlen( icon ) > 0 )
- {
- QAction *action = menu->addAction( text, THEMIM, member );
- action->setIcon( QIcon( icon ) );
- }
- else
- {
- menu->addAction( text, THEMIM, member );
- }
-}
-
void EnableDPStaticEntries( QMenu *menu, bool enable = true )
{
- if( !menu )
- return;
+ if( !menu ) return;
QAction *action;
foreach( action, menu->actions() )
else
i_ret++;
}
+ return i_ret;
+}
+
+/***
+ * Same for MIM
+ ***/
+void addMIMStaticEntry( intf_thread_t *p_intf,
+ QMenu *menu,
+ const QString text,
+ const char *help,
+ const char *icon,
+ const char *member )
+{
+ if( strlen( icon ) > 0 )
+ {
+ QAction *action = menu->addAction( text, THEMIM, member );
+ action->setIcon( QIcon( icon ) );
+ }
+ else
+ {
+ menu->addAction( text, THEMIM, member );
+ }
}
/*****************************************************************************
#endif
PUSH_VAR( "video-snapshot" );
+ /* Special case for postproc */
if( p_object )
{
/* p_object is the vout, so the decoder is our parent and the
gives the QProcess::destroyed timeout issue on Cleanlooks style with
setDesktopAware set to false */
QMenuBar *bar = mi->menuBar();
- BAR_ADD( FileMenu(), qtr( "&Media" ) );
+ BAR_ADD( FileMenu( p_intf ), qtr( "&Media" ) );
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( ToolsMenu( p_intf ), qtr( "&Tools" ) );
+ BAR_ADD( ViewMenu( p_intf, NULL, mi, visual_selector_enabled, true ),
+ qtr( "V&iew" ) );
BAR_ADD( HelpMenu( NULL ), qtr( "&Help" ) );
}
* Media ( File ) Menu
* Opening, streaming and quit
**/
-QMenu *QVLCMenu::FileMenu()
+QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
addDPStaticEntry( menu, qtr( "&Open File..." ), "",
- ":/file-asym", SLOT( openFileDialog() ), "Ctrl+O" );
+#ifdef WIN32
+ ":/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" );
+ addDPStaticEntry( menu, qtr( "Advanced Open File..." ), "",
+ ":/file-asym", SLOT( openFileDialog() ), "" );
+#else
+ ":/file-asym", SLOT( openFileDialog() ), "Ctrl+0" );
+#endif
addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "",
":/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" );
addDPStaticEntry( menu, qtr( "Open &Disc..." ), "",
addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "",
":/capture-card", SLOT( openCaptureDialog() ),
"Ctrl+C" );
+
+ recentsMenu = new QMenu( qtr( "Recently played" ), menu );
+ updateRecents( p_intf );
+ menu->addMenu( recentsMenu );
menu->addSeparator();
addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
- SLOT( openThenTranscodingDialogs() ), "Ctrl+R" );
+ SLOT( openAndTranscodingDialogs() ), "Ctrl+R" );
addDPStaticEntry( menu, qtr( "&Streaming..." ), "",
- ":/stream", SLOT( openThenStreamingDialogs() ),
+ ":/stream", SLOT( openAndStreamingDialogs() ),
"Ctrl+S" );
menu->addSeparator();
}
/* Playlist/MediaLibrary Control */
-QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi )
+QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
- menu->addMenu( SDMenu( p_intf ) );
- menu->addAction( QIcon( ":/playlist_menu" ),
- qtr( "Show P&laylist" ), mi, SLOT( togglePlaylist() ) );
+
+ addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", ":/settings",
+ SLOT( extendedDialog() ), "Ctrl+E" );
+ addDPStaticEntry( menu, qtr( I_MENU_MSG ), "",
+ ":/messages", SLOT( messagesDialog() ),
+ "Ctrl+M" );
+ addDPStaticEntry( menu, qtr( "Plugins and extensions" ), "",
+ "", SLOT( pluginDialog() ),
+ "" );
+ addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", ":/info",
+ SLOT( mediaInfoDialog() ), "Ctrl+I" );
+ addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) , "",
+ ":/info", SLOT( mediaCodecDialog() ), "Ctrl+J" );
+ addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","",
+ SLOT( bookmarksDialog() ), "Ctrl+B" );
+#ifdef ENABLE_VLM
+ addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", "", SLOT( vlmDialog() ),
+ "Ctrl+W" );
+#endif
menu->addSeparator();
- addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ),
- "Ctrl+X" );
- addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ),
- "Ctrl+Y" );
- /*menu->addSeparator();
- menu->addAction( qtr( "Undock from Interface" ), mi,
- SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/
+ addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ), "",
+ ":/preferences", SLOT( toolbarDialog() ), "" );
+ addDPStaticEntry( menu, qtr( "&Preferences..." ), "",
+ ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
+
return menu;
}
* longer.
* This menu can be an interface menu but also a right click menu.
**/
-QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
+QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
QMenu *current,
MainInterface *mi,
bool visual_selector_enabled,
mi, SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
act->setData( "_static_" );
}
- addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", ":/settings",
- SLOT( extendedDialog() ), "Ctrl+E" );
+ menu->addMenu( SDMenu( p_intf ) );
+ menu->addSeparator();
+
+ addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ),
+ "Ctrl+X" );
+ addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ),
+ "Ctrl+Y" );
+ /*menu->addSeparator();
+ menu->addAction( qtr( "Undock from Interface" ), mi,
+ SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/
+
menu->addSeparator();
menu->addSeparator();
- addDPStaticEntry( menu, qtr( I_MENU_MSG ), "",
- ":/messages", SLOT( messagesDialog() ),
- "Ctrl+M" );
- addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", ":/info",
- SLOT( mediaInfoDialog() ), "Ctrl+I" );
- addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) , "",
- ":/info", SLOT( mediaCodecDialog() ), "Ctrl+J" );
- addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","",
- SLOT( bookmarksDialog() ), "Ctrl+B" );
-#ifdef ENABLE_VLM
- addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", "", SLOT( vlmDialog() ),
- "Ctrl+W" );
-#endif
-
- menu->addSeparator();
- addDPStaticEntry( menu, qtr( "&Preferences..." ), "",
- ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
return menu;
}
p_input = THEMIM->getInput();
if( p_input )
- vlc_object_yield( p_input );
+ vlc_object_hold( p_input );
p_aout = ( vlc_object_t * ) vlc_object_find( p_intf,
VLC_OBJECT_AOUT,
FIND_ANYWHERE );
p_input = THEMIM->getInput();
if( p_input )
- vlc_object_yield( p_input );
+ vlc_object_hold( p_input );
p_vout = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
POPUP_BOILERPLATE;
if( p_input )
{
- vlc_object_yield( p_input );
+ vlc_object_hold( p_input );
vlc_object_t *p_vout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
POPUP_BOILERPLATE;
if( p_input )
{
- vlc_object_yield( p_input );
+ vlc_object_hold( p_input );
vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input,
VLC_OBJECT_AOUT, FIND_ANYWHERE );
AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
if( p_input )
{
- vlc_object_yield( p_input );
+ vlc_object_hold( p_input );
varnames.push_back( "audio-es" );
InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
PUSH_SEPARATOR;
menu->addSeparator();
- vlc_object_yield( p_input );
+ vlc_object_hold( p_input );
InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
vlc_object_release( p_input );
}
addDPStaticEntry( submenu, qtr( I_MENU_EXT ), "",
":/settings", SLOT( extendedDialog() ) );
+ addDPStaticEntry( submenu, qtr( I_MENU_INFO ) , "", ":/info",
+ SLOT( mediaInfoDialog() ), "Ctrl+I" );
if( mi )
{
action = submenu->addAction( QIcon( "" ),
else /* We are using the skins interface.
If not, this entry will not show. */
{
+ addDPStaticEntry( submenu, qtr( "&Preferences..." ), "",
+ ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
+ submenu->addSeparator();
objects.clear();
varnames.clear();
vlc_object_t *p_object = ( vlc_object_t* )
var_Set( p_object, itemData->psz_var, itemData->val );
}
+void QVLCMenu::updateRecents( intf_thread_t *p_intf )
+{
+ if (recentsMenu)
+ {
+ QAction* action;
+ RecentsMRL* rmrl = RecentsMRL::getInstance( p_intf );
+ QList<QString> l = rmrl->recents();
+
+ recentsMenu->clear();
+ if( !l.size() )
+ {
+ action = recentsMenu->addAction( " - Empty - " );
+ action->setEnabled( false );
+ }
+ else
+ {
+ for( int i = 0; i < l.size(); ++i )
+ {
+ action = recentsMenu->addAction( l.at( i ),
+ rmrl->signalMapper,
+ SLOT( map() ) );
+ rmrl->signalMapper->setMapping( action, l.at( i ) );
+ }
+
+ recentsMenu->addSeparator();
+ recentsMenu->addAction( "Clear", rmrl, SLOT( clear() ) );
+ }
+ }
+}