Commit 972835b3 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: menus, simplification and accelerator addition.

parent 5d16db8d
...@@ -85,7 +85,6 @@ QMenu *QVLCMenu::recentsMenu = NULL; ...@@ -85,7 +85,6 @@ QMenu *QVLCMenu::recentsMenu = NULL;
***************************************************************************/ ***************************************************************************/
void addDPStaticEntry( QMenu *menu, void addDPStaticEntry( QMenu *menu,
const QString text, const QString text,
const char *help,
const char *icon, const char *icon,
const char *member, const char *member,
const char *shortcut = NULL ) const char *shortcut = NULL )
...@@ -146,7 +145,6 @@ int DeleteNonStaticEntries( QMenu *menu ) ...@@ -146,7 +145,6 @@ int DeleteNonStaticEntries( QMenu *menu )
void addMIMStaticEntry( intf_thread_t *p_intf, void addMIMStaticEntry( intf_thread_t *p_intf,
QMenu *menu, QMenu *menu,
const QString text, const QString text,
const char *help,
const char *icon, const char *icon,
const char *member ) const char *member )
{ {
...@@ -306,21 +304,21 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf ) ...@@ -306,21 +304,21 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf )
{ {
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
addDPStaticEntry( menu, qtr( "&Open File..." ), "", addDPStaticEntry( menu, qtr( "&Open File..." ),
#ifdef WIN32 #ifdef WIN32
":/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" ); ":/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" );
addDPStaticEntry( menu, qtr( "Advanced Open File..." ), "", addDPStaticEntry( menu, qtr( "Advanced Open File..." ),
":/file-asym", SLOT( openFileDialog() ), "" ); ":/file-asym", SLOT( openFileDialog() ) );
#else #else
":/file-asym", SLOT( openFileDialog() ), "Ctrl+0" ); ":/file-asym", SLOT( openFileDialog() ), "Ctrl+O" );
#endif #endif
addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "", addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ),
":/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" ); ":/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" );
addDPStaticEntry( menu, qtr( "Open &Disc..." ), "", addDPStaticEntry( menu, qtr( "Open &Disc..." ),
":/disc", SLOT( openDiscDialog() ), "Ctrl+D" ); ":/disc", SLOT( openDiscDialog() ), "Ctrl+D" );
addDPStaticEntry( menu, qtr( "Open &Network..." ), "", addDPStaticEntry( menu, qtr( "Open &Network..." ),
":/network", SLOT( openNetDialog() ), "Ctrl+N" ); ":/network", SLOT( openNetDialog() ), "Ctrl+N" );
addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "", addDPStaticEntry( menu, qtr( "Open &Capture Device..." ),
":/capture-card", SLOT( openCaptureDialog() ), ":/capture-card", SLOT( openCaptureDialog() ),
"Ctrl+C" ); "Ctrl+C" );
...@@ -331,14 +329,14 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf ) ...@@ -331,14 +329,14 @@ QMenu *QVLCMenu::FileMenu( intf_thread_t *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( openAndTranscodingDialogs() ), "Ctrl+R" ); SLOT( openAndTranscodingDialogs() ), "Ctrl+R" );
addDPStaticEntry( menu, qtr( "&Streaming..." ), "", addDPStaticEntry( menu, qtr( "&Streaming..." ),
":/stream", SLOT( openAndStreamingDialogs() ), ":/stream", SLOT( openAndStreamingDialogs() ),
"Ctrl+S" ); "Ctrl+S" );
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( "&Quit" ) , "", addDPStaticEntry( menu, qtr( "&Quit" ) ,
":/quit", SLOT( quit() ), "Ctrl+Q" ); ":/quit", SLOT( quit() ), "Ctrl+Q" );
return menu; return menu;
} }
...@@ -348,29 +346,28 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf ) ...@@ -348,29 +346,28 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf )
{ {
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
addDPStaticEntry( menu, qtr( I_MENU_EXT ), "", ":/settings", addDPStaticEntry( menu, qtr( I_MENU_EXT ), ":/settings",
SLOT( extendedDialog() ), "Ctrl+E" ); SLOT( extendedDialog() ), "Ctrl+E" );
addDPStaticEntry( menu, qtr( I_MENU_MSG ), "", addDPStaticEntry( menu, qtr( I_MENU_MSG ),
":/messages", SLOT( messagesDialog() ), ":/messages", SLOT( messagesDialog() ),
"Ctrl+M" ); "Ctrl+M" );
addDPStaticEntry( menu, qtr( "Plugins and extensions" ), "", addDPStaticEntry( menu, qtr( I_MENU_INFO ) , ":/info",
"", SLOT( pluginDialog() ),
"" );
addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", ":/info",
SLOT( mediaInfoDialog() ), "Ctrl+I" ); SLOT( mediaInfoDialog() ), "Ctrl+I" );
addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) , "", addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) ,
":/info", SLOT( mediaCodecDialog() ), "Ctrl+J" ); ":/info", SLOT( mediaCodecDialog() ), "Ctrl+J" );
addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","", addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ),"",
SLOT( bookmarksDialog() ), "Ctrl+B" ); SLOT( bookmarksDialog() ), "Ctrl+B" );
#ifdef ENABLE_VLM #ifdef ENABLE_VLM
addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", "", SLOT( vlmDialog() ), addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", SLOT( vlmDialog() ),
"Ctrl+W" ); "Ctrl+W" );
#endif #endif
addDPStaticEntry( menu, qtr( "Plu&gins and extensions" ),
"", SLOT( pluginDialog() ) );
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ), "", addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ),
":/preferences", SLOT( toolbarDialog() ), "" ); ":/preferences", SLOT( toolbarDialog() ) );
addDPStaticEntry( menu, qtr( "&Preferences..." ), "", addDPStaticEntry( menu, qtr( "&Preferences..." ),
":/preferences", SLOT( prefsDialog() ), "Ctrl+P" ); ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
return menu; return menu;
...@@ -399,9 +396,9 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, ...@@ -399,9 +396,9 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
menu->addMenu( SDMenu( p_intf ) ); menu->addMenu( SDMenu( p_intf ) );
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ), addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", SLOT( openAPlaylist() ),
"Ctrl+X" ); "Ctrl+X" );
addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ), addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", SLOT( saveAPlaylist() ),
"Ctrl+Y" ); "Ctrl+Y" );
/*menu->addSeparator(); /*menu->addSeparator();
menu->addAction( qtr( "Undock from Interface" ), mi, menu->addAction( qtr( "Undock from Interface" ), mi,
...@@ -528,7 +525,7 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current ) ...@@ -528,7 +525,7 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
QMenu *submenu = new QMenu( qtr( "&Subtitles Track" ), current ); QMenu *submenu = new QMenu( qtr( "&Subtitles Track" ), current );
action = current->addMenu( submenu ); action = current->addMenu( submenu );
action->setData( "spu-es" ); action->setData( "spu-es" );
addDPStaticEntry( submenu, qtr( "Open File..." ), "", "", addDPStaticEntry( submenu, qtr( "Open File..." ), "",
SLOT( loadSubtitlesFile() ) ); SLOT( loadSubtitlesFile() ) );
submenu->addSeparator(); submenu->addSeparator();
...@@ -575,7 +572,7 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) ...@@ -575,7 +572,7 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
if( menu->isEmpty() ) if( menu->isEmpty() )
{ {
addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ), "","", addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"",
SLOT( gotoTimeDialog() ), "Ctrl+T" ); SLOT( gotoTimeDialog() ), "Ctrl+T" );
menu->addSeparator(); menu->addSeparator();
...@@ -644,14 +641,14 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf ) ...@@ -644,14 +641,14 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
QMenu *QVLCMenu::HelpMenu( QMenu *current ) QMenu *QVLCMenu::HelpMenu( QMenu *current )
{ {
QMenu *menu = new QMenu( current ); QMenu *menu = new QMenu( current );
addDPStaticEntry( menu, qtr( "&Help..." ) , "", addDPStaticEntry( menu, qtr( "&Help..." ) ,
":/help", SLOT( helpDialog() ), "F1" ); ":/help", SLOT( helpDialog() ), "F1" );
#ifdef UPDATE_CHECK #ifdef UPDATE_CHECK
addDPStaticEntry( menu, qtr( "Check for &Updates..." ) , "", "", addDPStaticEntry( menu, qtr( "Check for &Updates..." ) , "",
SLOT( updateDialog() ), ""); SLOT( updateDialog() ) );
#endif #endif
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), "", ":/info", addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), ":/info",
SLOT( aboutDialog() ), "Shift+F1" ); SLOT( aboutDialog() ), "Shift+F1" );
return menu; return menu;
} }
...@@ -681,24 +678,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, ...@@ -681,24 +678,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
vlc_value_t val; vlc_value_t val;
var_Get( p_input, "state", &val ); var_Get( p_input, "state", &val );
if( val.i_int == PLAYING_S ) if( val.i_int == PLAYING_S )
addMIMStaticEntry( p_intf, menu, qtr( "Pause" ), "", addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
":/pause", SLOT( togglePlayPause() ) ); ":/pause", SLOT( togglePlayPause() ) );
else else
addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "", addMIMStaticEntry( p_intf, menu, qtr( "Play" ),
":/play", SLOT( togglePlayPause() ) ); ":/play", SLOT( togglePlayPause() ) );
} }
else if( THEPL->items.i_size ) else if( THEPL->items.i_size )
addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "", addMIMStaticEntry( p_intf, menu, qtr( "Play" ),
":/play", SLOT( togglePlayPause() ) ); ":/play", SLOT( togglePlayPause() ) );
else else
addDPStaticEntry( menu, qtr( "Play" ), "", addDPStaticEntry( menu, qtr( "Play" ),
":/play", SLOT( openDialog() ) ); ":/play", SLOT( openDialog() ) );
addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), "", addMIMStaticEntry( p_intf, menu, qtr( "Stop" ),
":/stop", SLOT( stop() ) ); ":/stop", SLOT( stop() ) );
addMIMStaticEntry( p_intf, menu, qtr( "Previous" ), "", addMIMStaticEntry( p_intf, menu, qtr( "Previous" ),
":/previous", SLOT( prev() ) ); ":/previous", SLOT( prev() ) );
addMIMStaticEntry( p_intf, menu, qtr( "Next" ), "", addMIMStaticEntry( p_intf, menu, qtr( "Next" ),
":/next", SLOT( next() ) ); ":/next", SLOT( next() ) );
} }
...@@ -711,15 +708,15 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ) ...@@ -711,15 +708,15 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu )
#endif #endif
QMenu *openmenu = new QMenu( qtr( "Open" ), menu ); QMenu *openmenu = new QMenu( qtr( "Open" ), menu );
addDPStaticEntry( openmenu, qtr( "&Open File..." ), "", addDPStaticEntry( openmenu, qtr( "&Open File..." ),
":/file-asym", SLOT( openFileDialog() ) ); ":/file-asym", SLOT( openFileDialog() ) );
addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ), "", addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ),
":/folder-grey", SLOT( PLOpenDir() ) ); ":/folder-grey", SLOT( PLOpenDir() ) );
addDPStaticEntry( openmenu, qtr( "Open &Disc..." ), "", addDPStaticEntry( openmenu, qtr( "Open &Disc..." ),
":/disc", SLOT( openDiscDialog() ) ); ":/disc", SLOT( openDiscDialog() ) );
addDPStaticEntry( openmenu, qtr( "Open &Network..." ), "", addDPStaticEntry( openmenu, qtr( "Open &Network..." ),
":/network", SLOT( openNetDialog() ) ); ":/network", SLOT( openNetDialog() ) );
addDPStaticEntry( openmenu, qtr( "Open &Capture Device..." ), "", addDPStaticEntry( openmenu, qtr( "Open &Capture Device..." ),
":/capture-card", SLOT( openCaptureDialog() ) ); ":/capture-card", SLOT( openCaptureDialog() ) );
menu->addMenu( openmenu ); menu->addMenu( openmenu );
...@@ -730,7 +727,7 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ) ...@@ -730,7 +727,7 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu )
menu->addMenu( helpmenu ); menu->addMenu( helpmenu );
#endif #endif
addDPStaticEntry( menu, qtr( "Quit" ), "", ":/quit", addDPStaticEntry( menu, qtr( "Quit" ), ":/quit",
SLOT( quit() ), "Ctrl+Q" ); SLOT( quit() ), "Ctrl+Q" );
} }
...@@ -875,9 +872,9 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -875,9 +872,9 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
submenu->addAction( QIcon( ":/playlist" ), submenu->addAction( QIcon( ":/playlist" ),
qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) ); qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) );
} }
addDPStaticEntry( submenu, qtr( I_MENU_EXT ), "", addDPStaticEntry( submenu, qtr( I_MENU_EXT ),
":/settings", SLOT( extendedDialog() ) ); ":/settings", SLOT( extendedDialog() ) );
addDPStaticEntry( submenu, qtr( I_MENU_INFO ) , "", ":/info", addDPStaticEntry( submenu, qtr( I_MENU_INFO ) , ":/info",
SLOT( mediaInfoDialog() ), "Ctrl+I" ); SLOT( mediaInfoDialog() ), "Ctrl+I" );
if( mi ) if( mi )
{ {
...@@ -895,7 +892,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -895,7 +892,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
else /* We are using the skins interface. else /* We are using the skins interface.
If not, this entry will not show. */ If not, this entry will not show. */
{ {
addDPStaticEntry( submenu, qtr( "&Preferences..." ), "", addDPStaticEntry( submenu, qtr( "&Preferences..." ),
":/preferences", SLOT( prefsDialog() ), "Ctrl+P" ); ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
submenu->addSeparator(); submenu->addSeparator();
objects.clear(); objects.clear();
...@@ -964,10 +961,10 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, ...@@ -964,10 +961,10 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
PopupMenuControlEntries( sysMenu, p_intf, p_input ); PopupMenuControlEntries( sysMenu, p_intf, p_input );
sysMenu->addSeparator(); sysMenu->addSeparator();
addDPStaticEntry( sysMenu, qtr( "&Open Media" ), "", addDPStaticEntry( sysMenu, qtr( "&Open Media" ),
":/file-wide", SLOT( openFileDialog() ), "" ); ":/file-wide", SLOT( openFileDialog() ) );
addDPStaticEntry( sysMenu, qtr( "&Quit" ) , "", addDPStaticEntry( sysMenu, qtr( "&Quit" ) ,
":/quit", SLOT( quit() ), "" ); ":/quit", SLOT( quit() ) );
/* Set the menu */ /* Set the menu */
mi->getSysTray()->setContextMenu( sysMenu ); mi->getSysTray()->setContextMenu( sysMenu );
......
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