Commit 9e98e6b5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

[Qt] small menus changes...

parent 90b84868
...@@ -61,8 +61,6 @@ ...@@ -61,8 +61,6 @@
A QSignalMapper decides when to rebuild those menus cf MenuFunc in the .hpp A QSignalMapper decides when to rebuild those menus cf MenuFunc in the .hpp
Just before one of those menus are aboutToShow(), they are rebuild. Just before one of those menus are aboutToShow(), they are rebuild.
*/ */
enum enum
...@@ -80,7 +78,11 @@ QAction *QVLCMenu::minimalViewAction = NULL; ...@@ -80,7 +78,11 @@ QAction *QVLCMenu::minimalViewAction = NULL;
QMenu *QVLCMenu::recentsMenu = NULL; QMenu *QVLCMenu::recentsMenu = NULL;
// Add static entries to menus /****************************************************************************
* Menu code helpers:
****************************************************************************
* Add static entries to DP in menus
***************************************************************************/
void addDPStaticEntry( QMenu *menu, void addDPStaticEntry( QMenu *menu,
const QString text, const QString text,
const char *help, const char *help,
...@@ -107,28 +109,9 @@ void addDPStaticEntry( QMenu *menu, ...@@ -107,28 +109,9 @@ void addDPStaticEntry( QMenu *menu,
action->setData( "_static_" ); 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 ) void EnableDPStaticEntries( QMenu *menu, bool enable = true )
{ {
if( !menu ) if( !menu ) return;
return;
QAction *action; QAction *action;
foreach( action, menu->actions() ) foreach( action, menu->actions() )
...@@ -156,6 +139,27 @@ int DeleteNonStaticEntries( QMenu *menu ) ...@@ -156,6 +139,27 @@ int DeleteNonStaticEntries( QMenu *menu )
} }
} }
/***
* 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 );
}
}
/***************************************************************************** /*****************************************************************************
* Definitions of variables for the dynamic menus * Definitions of variables for the dynamic menus
*****************************************************************************/ *****************************************************************************/
...@@ -200,6 +204,7 @@ static int VideoAutoMenuBuilder( vlc_object_t *p_object, ...@@ -200,6 +204,7 @@ static int VideoAutoMenuBuilder( vlc_object_t *p_object,
#endif #endif
PUSH_VAR( "video-snapshot" ); PUSH_VAR( "video-snapshot" );
/* Special case for postproc */
if( p_object ) if( p_object )
{ {
/* p_object is the vout, so the decoder is our parent and the /* p_object is the vout, so the decoder is our parent and the
...@@ -283,9 +288,9 @@ void QVLCMenu::createMenuBar( MainInterface *mi, ...@@ -283,9 +288,9 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 2 ); BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 2 );
BAR_DADD( NavigMenu( p_intf, NULL ), qtr( "P&layback" ), 3 ); BAR_DADD( NavigMenu( p_intf, NULL ), qtr( "P&layback" ), 3 );
BAR_ADD( PlaylistMenu( p_intf, mi ), qtr( "&Playlist" ) ); BAR_ADD( ToolsMenu( p_intf ), qtr( "&Tools" ) );
BAR_ADD( ToolsMenu( p_intf, NULL, mi, visual_selector_enabled, true ), BAR_ADD( ViewMenu( p_intf, NULL, mi, visual_selector_enabled, true ),
qtr( "&Tools" ) ); qtr( "V&iew" ) );
BAR_ADD( HelpMenu( NULL ), qtr( "&Help" ) ); BAR_ADD( HelpMenu( NULL ), qtr( "&Help" ) );
} }
...@@ -317,15 +322,16 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf ) ...@@ -317,15 +322,16 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf )
addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "", addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "",
":/capture-card", SLOT( openCaptureDialog() ), ":/capture-card", SLOT( openCaptureDialog() ),
"Ctrl+C" ); "Ctrl+C" );
recentsMenu = new QMenu( qtr( "Recently played" ), menu ); recentsMenu = new QMenu( qtr( "Recently played" ), menu );
updateRecents( p_intf ); updateRecents( p_intf );
menu->addMenu( recentsMenu ); menu->addMenu( recentsMenu );
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "", addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
SLOT( openThenTranscodingDialogs() ), "Ctrl+R" ); SLOT( openAndTranscodingDialogs() ), "Ctrl+R" );
addDPStaticEntry( menu, qtr( "&Streaming..." ), "", addDPStaticEntry( menu, qtr( "&Streaming..." ), "",
":/stream", SLOT( openThenStreamingDialogs() ), ":/stream", SLOT( openAndStreamingDialogs() ),
"Ctrl+S" ); "Ctrl+S" );
menu->addSeparator(); menu->addSeparator();
...@@ -335,21 +341,30 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf ) ...@@ -335,21 +341,30 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf )
} }
/* Playlist/MediaLibrary Control */ /* 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(); QMenu *menu = new QMenu();
menu->addMenu( SDMenu( p_intf ) );
menu->addAction( QIcon( ":/playlist_menu" ), addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", ":/settings",
qtr( "Show P&laylist" ), mi, SLOT( togglePlaylist() ) ); SLOT( extendedDialog() ), "Ctrl+E" );
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(); menu->addSeparator();
addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ), addDPStaticEntry( menu, qtr( "&Preferences..." ), "",
"Ctrl+X" ); ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ),
"Ctrl+Y" );
/*menu->addSeparator();
menu->addAction( qtr( "Undock from Interface" ), mi,
SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/
return menu; return menu;
} }
...@@ -359,7 +374,7 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi ) ...@@ -359,7 +374,7 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi )
* longer. * longer.
* This menu can be an interface menu but also a right click menu. * 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, QMenu *current,
MainInterface *mi, MainInterface *mi,
bool visual_selector_enabled, bool visual_selector_enabled,
...@@ -373,8 +388,17 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, ...@@ -373,8 +388,17 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
mi, SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) ); mi, SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
act->setData( "_static_" ); act->setData( "_static_" );
} }
addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", ":/settings", menu->addMenu( SDMenu( p_intf ) );
SLOT( extendedDialog() ), "Ctrl+E" ); 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();
...@@ -420,23 +444,6 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, ...@@ -420,23 +444,6 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
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; return menu;
} }
......
...@@ -78,8 +78,8 @@ public: ...@@ -78,8 +78,8 @@ public:
/* Menus */ /* Menus */
static QMenu *FileMenu( intf_thread_t * ); static QMenu *FileMenu( intf_thread_t * );
static QMenu *SDMenu( intf_thread_t * ); static QMenu *SDMenu( intf_thread_t * );
static QMenu *PlaylistMenu( intf_thread_t *, MainInterface * ); static QMenu *ToolsMenu( intf_thread_t * );
static QMenu *ToolsMenu( intf_thread_t *, QMenu *, MainInterface *, static QMenu *ViewMenu( intf_thread_t *, QMenu *, MainInterface *,
bool, bool with = true ); bool, bool with = true );
static QMenu *NavigMenu( intf_thread_t *, QMenu * ); static QMenu *NavigMenu( intf_thread_t *, QMenu * );
static QMenu *VideoMenu( intf_thread_t *, QMenu * ); static QMenu *VideoMenu( intf_thread_t *, QMenu * );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment