Commit aaf99d56 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Macros removal from menus.hpp... Still some to do. But the biggest are...

Qt4 - Macros removal from menus.hpp... Still some to do. But the biggest are done. Should reduce code size.
Commit from Boston
parent c7178a18
...@@ -46,46 +46,46 @@ enum ...@@ -46,46 +46,46 @@ enum
static QActionGroup *currentGroup; static QActionGroup *currentGroup;
// Add static entries to menus // Add static entries to menus
#define DP_SADD( menu, text, help, icon, slot, shortcut ) \ void addDPStaticEntry( QMenu *menu,
{ \ const QString text,
if( strlen( icon ) > 0 ) \ char *help,
{ \ char *icon,
if( strlen( shortcut ) > 0 ) \ const char *member,
{ \ char *shortcut )
menu->addAction( QIcon( icon ), text, THEDP, SLOT( slot ), \ {
qtr( shortcut ) );\ if( !EMPTY_STR( icon ) > 0 )
} \ {
else \ if( !EMPTY_STR( shortcut ) > 0 )
{ \ menu->addAction( QIcon( icon ), text, THEDP, member, qtr( shortcut ) );
menu->addAction( QIcon( icon ), text, THEDP, SLOT( slot ) );\ else
} \ menu->addAction( QIcon( icon ), text, THEDP, member );
} \ }
else \ else
{ \ {
if( strlen( shortcut ) > 0 ) \ if( !EMPTY_STR( shortcut ) > 0 )
{ \ menu->addAction( text, THEDP, member, qtr( shortcut ) );
menu->addAction( text, THEDP, SLOT( slot ), \ else
qtr( shortcut ) ); \ menu->addAction( text, THEDP, member );
} \ }
else \
{ \
menu->addAction( text, THEDP, SLOT( slot ) ); \
} \
} \
} }
#define MIM_SADD( menu, text, help, icon, slot ) \
{ \ void addMIMStaticEntry( intf_thread_t *p_intf,
if( strlen( icon ) > 0 ) \ QMenu *menu,
{ \ const QString text,
QAction *action = menu->addAction( text, THEMIM, SLOT( slot ) ); \ char *help,
action->setIcon( QIcon( icon ) ); \ char *icon,
} \ const char *member )
else \ {
{ \ if( strlen( icon ) > 0 )
menu->addAction( text, THEMIM, SLOT( slot ) ); \ {
} \ QAction *action = menu->addAction( text, THEMIM, SLOT( slot ) );
action->setIcon( QIcon( icon ) );
}
else
{
menu->addAction( text, THEMIM, SLOT( slot ) );
}
} }
#define PL_SADD
/***************************************************************************** /*****************************************************************************
* Definitions of variables for the dynamic menus * Definitions of variables for the dynamic menus
...@@ -103,7 +103,7 @@ static int InputAutoMenuBuilder( vlc_object_t *p_object, ...@@ -103,7 +103,7 @@ static int InputAutoMenuBuilder( vlc_object_t *p_object,
{ {
PUSH_VAR( "bookmark" ); PUSH_VAR( "bookmark" );
PUSH_VAR( "title" ); PUSH_VAR( "title" );
PUSH_VAR ( "chapter" ); PUSH_VAR( "chapter" );
PUSH_VAR( "program" ); PUSH_VAR( "program" );
PUSH_VAR( "navigation" ); PUSH_VAR( "navigation" );
PUSH_VAR( "dvd_menus" ); PUSH_VAR( "dvd_menus" );
...@@ -163,8 +163,9 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object, ...@@ -163,8 +163,9 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
/** /**
* Main Menu Bar Creation * Main Menu Bar Creation
**/ **/
void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf, void QVLCMenu::createMenuBar( MainInterface *mi,
bool visual_selector_enabled ) intf_thread_t *p_intf,
bool visual_selector_enabled )
{ {
QMenuBar *bar = mi->menuBar(); QMenuBar *bar = mi->menuBar();
BAR_ADD( FileMenu(), qtr( "&Media" ) ); BAR_ADD( FileMenu(), qtr( "&Media" ) );
...@@ -176,6 +177,8 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf, ...@@ -176,6 +177,8 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
BAR_ADD( HelpMenu(), qtr( "&Help" ) ); BAR_ADD( HelpMenu(), qtr( "&Help" ) );
} }
#undef BAR_ADD
#undef BAR_DADD
/** /**
* Media ( File ) Menu * Media ( File ) Menu
...@@ -185,27 +188,28 @@ QMenu *QVLCMenu::FileMenu() ...@@ -185,27 +188,28 @@ QMenu *QVLCMenu::FileMenu()
{ {
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
DP_SADD( menu, qtr( "&Open File..." ), "", addDPStaticEntry( menu, qtr( "&Open File..." ), "",
":/pixmaps/file-asym_16px.png", openFileDialog(), "Ctrl+O" ); ":/pixmaps/file-asym_16px.png", SLOT( openFileDialog() ), "Ctrl+O" );
DP_SADD( menu, qtr( I_OPEN_FOLDER ), "", addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "",
":/pixmaps/folder-grey_16px.png", PLAppendDir(), "Ctrl+F" ); ":/pixmaps/folder-grey_16px.png", SLOT( PLAppendDir() ), "Ctrl+F" );
DP_SADD( menu, qtr( "Open &Disc..." ), "", ":/pixmaps/disc_16px.png", addDPStaticEntry( menu, qtr( "Open &Disc..." ), "",
openDiscDialog(), "Ctrl+D" ); ":/pixmaps/disc_16px.png", SLOT( openDiscDialog() ), "Ctrl+D" );
DP_SADD( menu, qtr( "Open &Network..." ), "", addDPStaticEntry( menu, qtr( "Open &Network..." ), "",
":/pixmaps/network_16px.png", openNetDialog(), "Ctrl+N" ); ":/pixmaps/network_16px.png", SLOT( openNetDialog() ), "Ctrl+N" );
DP_SADD( menu, qtr( "Open &Capture Device..." ), "", addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "",
":/pixmaps/capture-card_16px.png", openCaptureDialog(), ":/pixmaps/capture-card_16px.png", SLOT( openCaptureDialog() ),
"Ctrl+C" ); "Ctrl+C" );
menu->addSeparator(); menu->addSeparator();
DP_SADD( menu, qtr( "&Streaming..." ), "", ":/pixmaps/menus_stream_16px.png", addDPStaticEntry( menu, qtr( "&Streaming..." ), "",
openThenStreamingDialogs(), "Ctrl+S" ); ":/pixmaps/menus_stream_16px.png", SLOT( openThenStreamingDialogs() ),
DP_SADD( menu, qtr( "Conve&rt / Save..." ), "", "", "Ctrl+S" );
openThenTranscodingDialogs(), "Ctrl+R" ); addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
SLOT( openThenTranscodingDialogs() ), "Ctrl+R" );
menu->addSeparator(); menu->addSeparator();
DP_SADD( menu, qtr( "&Quit" ) , "", ":/pixmaps/menus_quit_16px.png", quit(),
"Ctrl+Q" ); addDPStaticEntry( menu, qtr( "&Quit" ) , "",
":/pixmaps/menus_quit_16px.png", SLOT( quit() ), "Ctrl+Q" );
return menu; return menu;
} }
...@@ -217,8 +221,10 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi ) ...@@ -217,8 +221,10 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi )
qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) ); qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) );
menu->addSeparator(); menu->addSeparator();
DP_SADD( menu, qtr( I_PL_LOAD ), "", "", openAPlaylist(), "Ctrl+X" ); addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ),
DP_SADD( menu, qtr( I_PL_SAVE ), "", "", saveAPlaylist(), "Ctrl+Y" ); "Ctrl+X" );
addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ),
"Ctrl+Y" );
menu->addSeparator(); menu->addSeparator();
menu->addAction( qtr( "Undock from interface" ), mi, menu->addAction( qtr( "Undock from interface" ), mi,
SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) ); SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );
...@@ -230,9 +236,10 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi ) ...@@ -230,9 +236,10 @@ QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi )
* 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. * longer.
**/ **/
QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi, QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
bool visual_selector_enabled, MainInterface *mi,
bool with_intf ) bool visual_selector_enabled,
bool with_intf )
{ {
QMenu *menu = new QMenu; QMenu *menu = new QMenu;
if( mi ) if( mi )
...@@ -241,8 +248,9 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi, ...@@ -241,8 +248,9 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
qtr( "Playlist..." ), mi, SLOT( togglePlaylist() ), qtr( "Playlist..." ), mi, SLOT( togglePlaylist() ),
qtr( "Ctrl+L" ) ); qtr( "Ctrl+L" ) );
} }
DP_SADD( menu, qtr( I_MENU_EXT ), "", ":/pixmaps/menus_settings_16px.png", addDPStaticEntry( menu, qtr( I_MENU_EXT ), "",
extendedDialog() , "Ctrl+E" ); ":/pixmaps/menus_settings_16px.png", SLOT( extendedDialog() ),
"Ctrl+E" );
menu->addSeparator(); menu->addSeparator();
...@@ -269,7 +277,7 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi, ...@@ -269,7 +277,7 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
action->setCheckable( true ); action->setCheckable( true );
if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED ) if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
action->setChecked( true ); action->setChecked( true );
#if 0 /* For Visualisations. Not yet working */ #if 0 /* For Visualisations. Not yet working */
adv = menu->addAction( qtr( "Visualizations selector" ), adv = menu->addAction( qtr( "Visualizations selector" ),
mi, SLOT( visual() ) ); mi, SLOT( visual() ) );
adv->setCheckable( true ); adv->setCheckable( true );
...@@ -279,22 +287,23 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi, ...@@ -279,22 +287,23 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( I_MENU_MSG ), "",
DP_SADD( menu, qtr( I_MENU_MSG ), "", ":/pixmaps/menus_messages_16px.png", ":/pixmaps/menus_messages_16px.png", SLOT( messagesDialog() ),
messagesDialog(), "Ctrl+M" ); "Ctrl+M" );
DP_SADD( menu, qtr( I_MENU_INFO ) , "", "", mediaInfoDialog(), "Ctrl+I" ); addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", "",
DP_SADD( menu, qtr( I_MENU_CODECINFO ) , "", ":/pixmaps/menus_info_16px.png", SLOT( mediaInfoDialog() ), "Ctrl+I" );
mediaCodecDialog(), "Ctrl+J" ); addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) , "",
":/pixmaps/menus_info_16px.png", SLOT( mediaCodecDialog() ), "Ctrl+J" );
#if 0 /* Not Implemented yet */ #if 0 /* Not Implemented yet */
DP_SADD( menu, qtr( I_MENU_BOOKMARK ), "","", bookmarksDialog(), "Ctrl+B" ); addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","", "bookmarksDialog()", "Ctrl+B" );
#endif #endif
DP_SADD( menu, qtr( I_MENU_VLM ), "","", vlmDialog(), "Ctrl+V" ); addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", "", SLOT( vlmDialog() ),
"Ctrl+V" );
menu->addSeparator(); menu->addSeparator();
DP_SADD( menu, qtr( "Preferences..." ), "", ":/pixmaps/menus_preferences_16px.png", addDPStaticEntry( menu, qtr( "Preferences..." ), "",
prefsDialog(), "Ctrl+P" ); ":/pixmaps/menus_preferences_16px.png", SLOT( prefsDialog() ), "Ctrl+P" );
return menu; return menu;
} }
...@@ -399,8 +408,8 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *navMenu ) ...@@ -399,8 +408,8 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *navMenu )
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
navMenu = new QMenu(); navMenu = new QMenu();
DP_SADD( navMenu, qtr( I_MENU_GOTOTIME ), "","", gotoTimeDialog(), addDPStaticEntry( navMenu, qtr( I_MENU_GOTOTIME ), "","",
"Ctrl+T" ); SLOT( gotoTimeDialog() ), "Ctrl+T" );
navMenu->addSeparator(); navMenu->addSeparator();
return Populate( p_intf, navMenu, varnames, objects, true ); return Populate( p_intf, navMenu, varnames, objects, true );
} }
...@@ -446,11 +455,12 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf ) ...@@ -446,11 +455,12 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
QMenu *QVLCMenu::HelpMenu() QMenu *QVLCMenu::HelpMenu()
{ {
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
DP_SADD( menu, qtr( "Help..." ) , "", ":/pixmaps/menus_help_16px.png", addDPStaticEntry( menu, qtr( "Help..." ) , "",
helpDialog(), "F1" ); ":/pixmaps/menus_help_16px.png", SLOT( helpDialog() ), "F1" );
DP_SADD( menu, qtr( "Update" ) , "", "", updateDialog(), ""); addDPStaticEntry( menu, qtr( "Update" ) , "", "", SLOT( updateDialog() ), "");
menu->addSeparator(); menu->addSeparator();
DP_SADD( menu, qtr( I_MENU_ABOUT ), "", "", aboutDialog(), "Ctrl+F1" ); addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), "", "", SLOT( aboutDialog() ),
"Ctrl+F1" );
return menu; return menu;
} }
...@@ -477,40 +487,47 @@ QMenu *QVLCMenu::HelpMenu() ...@@ -477,40 +487,47 @@ QMenu *QVLCMenu::HelpMenu()
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 ) \
MIM_SADD( menu, qtr( "Pause" ), "", ":/pixmaps/pause_16px.png", \ addMIMStaticEntry( p_intf, menu, qtr( "Pause" ), "", \
togglePlayPause() ) \ ":/pixmaps/pause_16px.png", SLOT( togglePlayPause() ) ); \
else \ else \
MIM_SADD( menu, qtr( "Play" ), "", ":/pixmaps/play_16px.png", \ addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "", \
togglePlayPause() ) \ ":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) ); \
} \ } \
else if( THEPL->items.i_size && THEPL->i_enabled ) \ else if( THEPL->items.i_size && THEPL->i_enabled ) \
MIM_SADD( menu, qtr( "Play" ), "", ":/pixmaps/play_16px.png", \ addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "", \
togglePlayPause() ); \ ":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) ); \
\
MIM_SADD( menu, qtr( "Stop" ), "", ":/pixmaps/stop_16px.png", stop() ); \
MIM_SADD( menu, qtr( "Previous" ), "", ":/pixmaps/previous_16px.png", \
prev() ); \
MIM_SADD( menu, qtr( "Next" ), "", ":/pixmaps/next_16px.png", next() );
#define POPUP_STATIC_ENTRIES( menu ) \
QMenu *toolsmenu = ToolsMenu( p_intf, NULL, false, true ); \
toolsmenu->setTitle( qtr( "Tools" ) ); \
menu->addMenu( toolsmenu ); \
\ \
QMenu *openmenu = new QMenu( qtr( "Open" ) ); \ addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), "", \
openmenu->addAction( qtr( "Open &File..." ), THEDP, SLOT( openFileDialog() ) ); \ ":/pixmaps/stop_16px.png", SLOT( stop() ) ); \
openmenu->addAction( qtr( "Open &Disc..." ), THEDP, SLOT( openDiscDialog() ) ); \ addMIMStaticEntry( p_intf, menu, qtr( "Previous" ), "", \
openmenu->addAction( qtr( "Open &Network..." ), THEDP, SLOT( openNetDialog() ) ); \ ":/pixmaps/previous_16px.png", SLOT( prev() ) ); \
openmenu->addAction( qtr( "Open &Capture Device..." ), THEDP, \ addMIMStaticEntry( p_intf, menu, qtr( "Next" ), "", \
SLOT( openCaptureDialog() ) ); \ ":/pixmaps/next_16px.png", SLOT( next() ) );
menu->addMenu( openmenu ); \
\ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu )
menu->addSeparator(); \ {
QMenu *helpmenu = HelpMenu(); \ QMenu *toolsmenu = ToolsMenu( p_intf, NULL, false, true );
helpmenu->setTitle( qtr( "Help" ) ); \ toolsmenu->setTitle( qtr( "Tools" ) );
menu->addMenu( helpmenu ); \ menu->addMenu( toolsmenu );
\
DP_SADD( menu, qtr( "Quit" ), "", "", quit() , "Ctrl+Q" ); QMenu *openmenu = new QMenu( qtr( "Open" ) );
openmenu->addAction( qtr( "Open &File..." ), THEDP,
SLOT( openFileDialog() ) );
openmenu->addAction( qtr( "Open &Disc..." ), THEDP,
SLOT( openDiscDialog() ) );
openmenu->addAction( qtr( "Open &Network..." ), THEDP,
SLOT( openNetDialog() ) );
openmenu->addAction( qtr( "Open &Capture Device..." ), THEDP,
SLOT( openCaptureDialog() ) );
menu->addMenu( openmenu );
menu->addSeparator();
QMenu *helpmenu = HelpMenu();
helpmenu->setTitle( qtr( "Help" ) );
menu->addMenu( helpmenu );
addDPStaticEntry( menu, qtr( "Quit" ), "", "", SLOT( quit() ) , "Ctrl+Q" );
}
/* Video Tracks and Subtitles tracks */ /* Video Tracks and Subtitles tracks */
void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf ) void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
...@@ -579,7 +596,7 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf ) ...@@ -579,7 +596,7 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
POPUP_PLAY_ENTRIES( menu ); POPUP_PLAY_ENTRIES( menu );
menu->addSeparator(); menu->addSeparator();
POPUP_STATIC_ENTRIES( menu ); PopupMenuStaticEntries( p_intf, menu );
p_intf->p_sys->p_popup_menu = menu; p_intf->p_sys->p_popup_menu = menu;
menu->popup( QCursor::pos() ); menu->popup( QCursor::pos() );
...@@ -601,11 +618,11 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -601,11 +618,11 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames ); InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
/* Audio menu */ /* Audio menu */
PUSH_SEPARATOR PUSH_SEPARATOR;
varnames.push_back( "audio-es" ); varnames.push_back( "audio-es" );
objects.push_back( p_input->i_object_id ); objects.push_back( p_input->i_object_id );
vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input, vlc_object_t *p_aout = ( vlc_object_t * )
VLC_OBJECT_AOUT, FIND_ANYWHERE ); vlc_object_find( p_input, VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( p_aout ) if( p_aout )
{ {
AudioAutoMenuBuilder( p_aout, objects, varnames ); AudioAutoMenuBuilder( p_aout, objects, varnames );
...@@ -618,8 +635,8 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -618,8 +635,8 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
objects.push_back( p_input->i_object_id ); objects.push_back( p_input->i_object_id );
varnames.push_back( "spu-es" ); varnames.push_back( "spu-es" );
objects.push_back( p_input->i_object_id ); objects.push_back( p_input->i_object_id );
vlc_object_t *p_vout = ( vlc_object_t * )vlc_object_find( p_input, vlc_object_t *p_vout = ( vlc_object_t * )
VLC_OBJECT_VOUT, FIND_CHILD ); vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout ) if( p_vout )
{ {
VideoAutoMenuBuilder( p_vout, objects, varnames ); VideoAutoMenuBuilder( p_vout, objects, varnames );
...@@ -632,7 +649,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) ...@@ -632,7 +649,7 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
menu->addSeparator(); menu->addSeparator();
POPUP_PLAY_ENTRIES( menu ); POPUP_PLAY_ENTRIES( menu );
menu->addSeparator(); menu->addSeparator();
POPUP_STATIC_ENTRIES( menu ); PopupMenuStaticEntries( p_intf, menu );
p_intf->p_sys->p_popup_menu = menu; p_intf->p_sys->p_popup_menu = menu;
} }
...@@ -678,10 +695,10 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, ...@@ -678,10 +695,10 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
POPUP_PLAY_ENTRIES( sysMenu ); POPUP_PLAY_ENTRIES( sysMenu );
sysMenu->addSeparator(); sysMenu->addSeparator();
DP_SADD( sysMenu, qtr( "&Open Media" ), "", addDPStaticEntry( sysMenu, qtr( "&Open Media" ), "",
":/pixmaps/file-wide_16px.png", openFileDialog(), "" ); ":/pixmaps/file-wide_16px.png", SLOT( openFileDialog() ), "" );
DP_SADD( sysMenu, qtr( "&Quit" ) , "", ":/pixmaps/menus_quit_16px.png", addDPStaticEntry( sysMenu, qtr( "&Quit" ) , "",
quit(), "" ); ":/pixmaps/menus_quit_16px.png", SLOT( quit() ), "" );
/* Set the menu */ /* Set the menu */
mi->getSysTray()->setContextMenu( sysMenu ); mi->getSysTray()->setContextMenu( sysMenu );
...@@ -694,9 +711,11 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, ...@@ -694,9 +711,11 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
/************************************************************************* /*************************************************************************
* Builders for automenus * Builders for automenus
*************************************************************************/ *************************************************************************/
QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current, QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
vector< const char *> & varnames, QMenu *current,
vector<int> & objects, bool append ) vector< const char *> & varnames,
vector<int> & objects,
bool append )
{ {
QMenu *menu = current; QMenu *menu = current;
if( !menu ) if( !menu )
...@@ -732,8 +751,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current, ...@@ -732,8 +751,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current,
continue; continue;
} }
p_object = ( vlc_object_t * )vlc_object_get( p_intf, p_object = ( vlc_object_t * )vlc_object_get( p_intf, objects[i] );
objects[i] );
if( p_object == NULL ) continue; if( p_object == NULL ) continue;
b_section_empty = VLC_FALSE; b_section_empty = VLC_FALSE;
...@@ -751,13 +769,15 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current, ...@@ -751,13 +769,15 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current,
return menu; return menu;
} }
#undef APPEND_EMPTY
/***************************************************************************** /*****************************************************************************
* Private methods. * Private methods.
*****************************************************************************/ *****************************************************************************/
static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object, static bool IsMenuEmpty( const char *psz_var,
bool b_root = TRUE ) vlc_object_t *p_object,
bool b_root = true )
{ {
vlc_value_t val, val_list; vlc_value_t val, val_list;
int i_type, i_result, i; int i_type, i_result, i;
...@@ -766,31 +786,31 @@ static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object, ...@@ -766,31 +786,31 @@ static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object,
i_type = var_Type( p_object, psz_var ); i_type = var_Type( p_object, psz_var );
/* Check if we want to display the variable */ /* Check if we want to display the variable */
if( !( i_type & VLC_VAR_HASCHOICE ) ) return FALSE; if( !( i_type & VLC_VAR_HASCHOICE ) ) return false;
var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL ); var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 ) return TRUE; if( val.i_int == 0 ) return true;
if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE ) if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE )
{ {
/* Very evil hack ! intf-switch can have only one value */ /* Very evil hack ! intf-switch can have only one value */
if( !strcmp( psz_var, "intf-switch" ) ) return FALSE; if( !strcmp( psz_var, "intf-switch" ) ) return false;
if( val.i_int == 1 && b_root ) return TRUE; if( val.i_int == 1 && b_root ) return true;
else return FALSE; else return false;
} }
/* Check children variables in case of VLC_VAR_VARIABLE */ /* Check children variables in case of VLC_VAR_VARIABLE */
if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 ) if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
{ {
return TRUE; return true;
} }
for( i = 0, i_result = TRUE; i < val_list.p_list->i_count; i++ ) for( i = 0, i_result = true; i < val_list.p_list->i_count; i++ )
{ {
if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string, if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
p_object, FALSE ) ) p_object, false ) )
{ {
i_result = FALSE; i_result = false;
break; break;
} }
} }
...@@ -899,6 +919,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var, ...@@ -899,6 +919,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
#define NORMAL_OR_RADIO i_type & VLC_VAR_ISCOMMAND ? ITEM_NORMAL: ITEM_RADIO #define NORMAL_OR_RADIO i_type & VLC_VAR_ISCOMMAND ? ITEM_NORMAL: ITEM_RADIO
#define NOTCOMMAND !( i_type & VLC_VAR_ISCOMMAND ) #define NOTCOMMAND !( i_type & VLC_VAR_ISCOMMAND )
#define CURVAL val_list.p_list->p_values[i] #define CURVAL val_list.p_list->p_values[i]
......
...@@ -72,8 +72,7 @@ class QVLCMenu : public QObject ...@@ -72,8 +72,7 @@ class QVLCMenu : public QObject
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static void createMenuBar( MainInterface *mi, intf_thread_t *, static void createMenuBar( MainInterface *mi, intf_thread_t *, bool );
bool );
/* Menus */ /* Menus */
static QMenu *FileMenu(); static QMenu *FileMenu();
...@@ -91,6 +90,7 @@ public: ...@@ -91,6 +90,7 @@ public:
static void VideoPopupMenu( intf_thread_t * ); static void VideoPopupMenu( intf_thread_t * );
static void MiscPopupMenu( intf_thread_t * ); static void MiscPopupMenu( intf_thread_t * );
static void PopupMenu( intf_thread_t *, bool ); static void PopupMenu( intf_thread_t *, bool );
static void PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu );
/* Systray */ /* Systray */
static void updateSystrayMenu( MainInterface *,intf_thread_t *, static void updateSystrayMenu( MainInterface *,intf_thread_t *,
......
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