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

Qt, menus: various changes, speedups and addition to approach mac menus.

parent 8d5ee287
...@@ -121,9 +121,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -121,9 +121,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize(); mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize();
mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize(); mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize();
/* Visualisation, not really used yet */
visualSelectorEnabled = settings->value( "visual-selector", false).toBool();
/* Do we want anoying popups or not */ /* Do we want anoying popups or not */
notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" ); notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" );
...@@ -141,7 +138,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -141,7 +138,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/************ /************
* Menu Bar * * Menu Bar *
************/ ************/
QVLCMenu::createMenuBar( this, p_intf, visualSelectorEnabled ); QVLCMenu::createMenuBar( this, p_intf );
#if 0 #if 0
/* Create a Dock to get the playlist */ /* Create a Dock to get the playlist */
......
...@@ -141,7 +141,9 @@ void EnableStaticEntries( QMenu *menu, bool enable = true ) ...@@ -141,7 +141,9 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
QList< QAction* > actions = menu->actions(); QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.size(); ++i ) for( int i = 0; i < actions.size(); ++i )
{ {
actions[i]->setEnabled( enable && actions[i]->data().toBool() ); actions[i]->setEnabled( enable &&
/* Be careful here, because data("string").toBool is true */
(actions[i]->data().toString() == "true" ) );
} }
} }
...@@ -150,9 +152,10 @@ void EnableStaticEntries( QMenu *menu, bool enable = true ) ...@@ -150,9 +152,10 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
*/ */
int DeleteNonStaticEntries( QMenu *menu ) int DeleteNonStaticEntries( QMenu *menu )
{ {
if( !menu ) return VLC_EGENERIC;
int i_ret = 0; int i_ret = 0;
if( !menu )
return VLC_EGENERIC;
QList< QAction* > actions = menu->actions(); QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.size(); ++i ) for( int i = 0; i < actions.size(); ++i )
{ {
...@@ -200,7 +203,6 @@ static int InputAutoMenuBuilder( input_thread_t *p_object, ...@@ -200,7 +203,6 @@ static int InputAutoMenuBuilder( input_thread_t *p_object,
PUSH_VAR( "chapter" ); PUSH_VAR( "chapter" );
PUSH_VAR( "navigation" ); PUSH_VAR( "navigation" );
PUSH_VAR( "program" ); PUSH_VAR( "program" );
PUSH_VAR( "dvd_menus" );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -269,9 +271,7 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object, ...@@ -269,9 +271,7 @@ static int AudioAutoMenuBuilder( aout_instance_t *p_object,
* Main Menu Bar Creation * Main Menu Bar Creation
**/ **/
void QVLCMenu::createMenuBar( MainInterface *mi, void QVLCMenu::createMenuBar( MainInterface *mi,
intf_thread_t *p_intf, intf_thread_t *p_intf )
bool visual_selector_enabled )
/* FIXME remove this visual dependency */
{ {
/* QMainWindows->menuBar() /* QMainWindows->menuBar()
gives the QProcess::destroyed timeout issue on Cleanlooks style with gives the QProcess::destroyed timeout issue on Cleanlooks style with
...@@ -286,8 +286,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi, ...@@ -286,8 +286,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi,
BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 ); BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 );
BAR_ADD( ToolsMenu( bar ), qtr( "&Tools" ) ); BAR_ADD( ToolsMenu( bar ), qtr( "&Tools" ) );
BAR_ADD( ViewMenu( p_intf, NULL, mi, visual_selector_enabled, true ), BAR_ADD( ViewMenu( p_intf, mi ), qtr( "V&iew" ) );
qtr( "V&iew" ) );
BAR_ADD( HelpMenu( bar ), qtr( "&Help" ) ); BAR_ADD( HelpMenu( bar ), qtr( "&Help" ) );
} }
#undef BAR_ADD #undef BAR_ADD
...@@ -386,29 +385,21 @@ QMenu *QVLCMenu::ToolsMenu( QWidget *parent ) ...@@ -386,29 +385,21 @@ QMenu *QVLCMenu::ToolsMenu( QWidget *parent )
* Interface Modification * Interface Modification
**/ **/
QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
QMenu *current,
MainInterface *mi, MainInterface *mi,
bool visual_selector_enabled,
bool with_intf ) bool with_intf )
{ {
QMenu *menu; assert( mi );
if( current )
menu = new QMenu( current ); QMenu *menu = new QMenu( qtr( "V&iew" ), mi );
else
menu = new QMenu( mi ); QAction *act = menu->addAction( QIcon( ":/playlist_menu" ),
QAction *act; qtr( "Play&list" ), mi,
if( mi ) SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
{
act = menu->addAction( QIcon( ":/playlist_menu" ),
qtr( "Play&list" ), mi,
SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
act->setData( true );
}
/*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" ) );*/
menu->addSeparator(); menu->addSeparator();
if( with_intf ) if( with_intf )
...@@ -419,38 +410,35 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, ...@@ -419,38 +410,35 @@ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf,
THEDP->menusUpdateMapper->setMapping( intfmenu, f ); THEDP->menusUpdateMapper->setMapping( intfmenu, f );
menu->addSeparator(); menu->addSeparator();
} }
if( mi )
{
/* Minimal View */
QAction *action = menu->addAction( qtr( "Mi&nimal View" ), mi,
SLOT( toggleMinimalView() ), qtr( "Ctrl+H" ) );
action->setCheckable( true );
action->setData( true );
if( mi->getControlsVisibilityStatus() & CONTROLS_VISIBLE )
action->setChecked( true );
minimalViewAction = action; /* HACK for minimalView */
/* FullScreen View */
action = menu->addAction( qtr( "&Fullscreen Interface" ), mi,
SLOT( toggleFullScreen() ), QString( "F11" ) );
fullscreenViewAction = action;
action->setCheckable( true );
action->setData( true );
/* Advanced Controls */ /* Minimal View */
action = menu->addAction( qtr( "&Advanced Controls" ), mi, QAction *action = menu->addAction( qtr( "Mi&nimal View" ), mi,
SLOT( toggleAdvanced() ) ); SLOT( toggleMinimalView() ), qtr( "Ctrl+H" ) );
action->setCheckable( true ); action->setCheckable( true );
action->setData( true );
if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED ) if( mi->getControlsVisibilityStatus() & CONTROLS_VISIBLE )
action->setChecked( true ); action->setChecked( true );
minimalViewAction = action; /* HACK for minimalView */
/* FullScreen View */
action = menu->addAction( qtr( "&Fullscreen Interface" ), mi,
SLOT( toggleFullScreen() ), QString( "F11" ) );
fullscreenViewAction = action;
action->setCheckable( true );
/* Advanced Controls */
action = menu->addAction( qtr( "&Advanced Controls" ), mi,
SLOT( toggleAdvanced() ) );
action->setCheckable( true );
if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
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 );
if( visual_selector_enabled ) adv->setChecked( true ); if( visual_selector_enabled ) adv->setChecked( true );
#endif #endif
}
menu->addSeparator(); menu->addSeparator();
addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ), addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ),
...@@ -594,46 +582,49 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QWidget *parent ) ...@@ -594,46 +582,49 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QWidget *parent )
**/ **/
QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu ) QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
{ {
if( menu->isEmpty() ) QAction *action;
{
QAction *action;
QMenu *submenu = new QMenu( qtr( "&Bookmarks" ), menu );
addDPStaticEntry( submenu, qtr( "Manage &bookmarks" ), "",
SLOT( bookmarksDialog() ) );
submenu->addSeparator();
action = menu->addMenu( submenu );
action->setData( "bookmark" );
ACT_ADDMENU( menu, "title", qtr( "T&itle" ) );
ACT_ADDMENU( menu, "chapter", qtr( "&Chapter" ) );
ACT_ADDMENU( menu, "navigation", qtr( "&Navigation" ) );
ACT_ADDMENU( menu, "program", qtr( "&Program" ) );
menu->addSeparator(); QMenu *submenu = new QMenu( qtr( "&Bookmarks" ), menu );
addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"", addDPStaticEntry( submenu, qtr( "Manage &bookmarks" ), "",
SLOT( gotoTimeDialog() ), "Ctrl+T" ); SLOT( bookmarksDialog() ) );
submenu->addSeparator();
action = menu->addMenu( submenu );
action->setData( "bookmark" );
} ACT_ADDMENU( menu, "title", qtr( "T&itle" ) );
ACT_ADDMENU( menu, "chapter", qtr( "&Chapter" ) );
ACT_ADDMENU( menu, "navigation", qtr( "&Navigation" ) );
ACT_ADDMENU( menu, "program", qtr( "&Program" ) );
menu->addSeparator();
PopupMenuControlEntries( menu, p_intf );//, THEMIM->getInput() );
PopupMenuPlaylistControlEntries( menu, p_intf );
return menu;
}
QMenu *QVLCMenu::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu )
{
/* */ /* */
input_thread_t *p_object; input_thread_t *p_object;
vector<vlc_object_t *> objects; vector<vlc_object_t *> objects;
vector<const char *> varnames; vector<const char *> varnames;
/* Get the input and hold it */
p_object = THEMIM->getInput(); p_object = THEMIM->getInput();
if( p_object ) if( p_object )
vlc_object_hold( p_object ); vlc_object_hold( p_object );
InputAutoMenuBuilder( p_object, objects, varnames ); InputAutoMenuBuilder( p_object, objects, varnames );
menu->addSeparator();
/* Title and so on */ /* Title and so on */
PUSH_VAR( "prev-title" ); PUSH_VAR( "prev-title" );
PUSH_VAR( "next-title" ); PUSH_VAR( "next-title" );
PUSH_VAR( "prev-chapter" ); PUSH_VAR( "prev-chapter" );
PUSH_VAR( "next-chapter" ); PUSH_VAR( "next-chapter" );
menu->addSeparator();
EnableStaticEntries( menu, ( p_object != NULL ) );
if( p_object ) if( p_object )
vlc_object_release( p_object ); vlc_object_release( p_object );
...@@ -717,7 +708,7 @@ QMenu *QVLCMenu::HelpMenu( QWidget *parent ) ...@@ -717,7 +708,7 @@ QMenu *QVLCMenu::HelpMenu( QWidget *parent )
p_intf->p_sys->p_popup_menu = NULL; \ p_intf->p_sys->p_popup_menu = NULL; \
i_last_separator = 0; i_last_separator = 0;
void QVLCMenu::PopupMenuControlEntries( QMenu *menu, void QVLCMenu::PopupPlayEntries( QMenu *menu,
intf_thread_t *p_intf, intf_thread_t *p_intf,
input_thread_t *p_input ) input_thread_t *p_input )
{ {
...@@ -736,9 +727,13 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, ...@@ -736,9 +727,13 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
":/pause", SLOT( togglePlayPause() ) ); ":/pause", SLOT( togglePlayPause() ) );
} }
}
void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf )
{
QAction *action;
/* Stop */ /* Stop */
addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), ":/stop", SLOT( stop() ) );
":/stop", SLOT( stop() ) );
/* Faster/Slower */ /* Faster/Slower */
action = menu->addAction( qtr( "Faster" ), THEMIM->getIM(), SLOT( faster() ) ); action = menu->addAction( qtr( "Faster" ), THEMIM->getIM(), SLOT( faster() ) );
...@@ -746,13 +741,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu, ...@@ -746,13 +741,24 @@ void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
menu->addAction( qtr( "Normal Speed" ), THEMIM->getIM(), SLOT( normalRate() ) ); menu->addAction( qtr( "Normal Speed" ), THEMIM->getIM(), SLOT( normalRate() ) );
action = menu->addAction( qtr( "Slower" ), THEMIM->getIM(), SLOT( slower() ) ); action = menu->addAction( qtr( "Slower" ), THEMIM->getIM(), SLOT( slower() ) );
action->setIcon( QIcon( ":/slower") ); action->setIcon( QIcon( ":/slower") );
menu->addSeparator();
action = menu->addAction( qtr( "Jump Forward" ), THEMIM->getIM(),
SLOT( jumpFwd() ) );
action->setIcon( QIcon( ":/skip_fw") );
action = menu->addAction( qtr( "Jump Backward" ), THEMIM->getIM(),
SLOT( jumpBwd() ) );
action->setIcon( QIcon( ":/skip_back") );
} }
void QVLCMenu::PopupMenuPlaylistControlEntries( QMenu *menu, void QVLCMenu::PopupMenuPlaylistControlEntries( QMenu *menu,
intf_thread_t *p_intf, intf_thread_t *p_intf )
input_thread_t *p_input )
{ {
addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"",
SLOT( gotoTimeDialog() ), "Ctrl+T" );
menu->addSeparator();
/* Next / Previous */ /* Next / Previous */
addMIMStaticEntry( p_intf, menu, qtr( "Previous" ), addMIMStaticEntry( p_intf, menu, qtr( "Previous" ),
":/previous", SLOT( prev() ) ); ":/previous", SLOT( prev() ) );
...@@ -822,7 +828,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf ) ...@@ -822,7 +828,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
CREATE_POPUP; CREATE_POPUP;
} }
/* Navigation stuff, and general menus ( open ) */ /* Navigation stuff, and general menus ( open ), used only for skins */
void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf ) void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
{ {
POPUP_BOILERPLATE; POPUP_BOILERPLATE;
...@@ -839,10 +845,10 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf ) ...@@ -839,10 +845,10 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
Populate( p_intf, menu, varnames, objects ); Populate( p_intf, menu, varnames, objects );
menu->addSeparator(); menu->addSeparator();
PopupMenuControlEntries( menu, p_intf, p_input ); PopupMenuControlEntries( menu, p_intf ); //, p_input );
menu->addSeparator(); menu->addSeparator();
PopupMenuPlaylistControlEntries( menu, p_intf, p_input ); PopupMenuPlaylistControlEntries( menu, p_intf); //, p_input );
menu->addSeparator(); menu->addSeparator();
PopupMenuStaticEntries( menu ); PopupMenuStaticEntries( menu );
...@@ -855,129 +861,113 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf ) ...@@ -855,129 +861,113 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
/* Main Menu that sticks everything together */ /* Main Menu that sticks everything together */
void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show ) void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
{ {
MainInterface *mi = p_intf->p_sys->p_mi; /* Destroy popup menu if there is one */
if( show ) if( !show )
{ {
/* Delete and recreate a popup if there is one */ delete p_intf->p_sys->p_popup_menu;
if( p_intf->p_sys->p_popup_menu ) p_intf->p_sys->p_popup_menu = NULL;
delete p_intf->p_sys->p_popup_menu; return;
}
QMenu *menu = new QMenu(); /* Delete and recreate a popup if there is one */
QMenu *submenu; if( p_intf->p_sys->p_popup_menu )
QAction *action; delete p_intf->p_sys->p_popup_menu;
bool b_isFullscreen = false;
POPUP_BOILERPLATE; /* */
QMenu *menu = new QMenu();
QMenu *submenu;
QAction *action;
bool b_isFullscreen = false;
MainInterface *mi = p_intf->p_sys->p_mi;
PopupMenuControlEntries( menu, p_intf, p_input ); POPUP_BOILERPLATE;
menu->addSeparator();
PopupMenuPlaylistControlEntries( menu, p_intf, p_input ); PopupMenuControlEntries( menu, p_intf ); //, p_input );
menu->addSeparator(); menu->addSeparator();
if( p_input ) if( p_input )
{
vout_thread_t *p_vout = THEMIM->getVout();
/* Add a fullscreen switch button, since it is the most used function */
if( p_vout )
{ {
vout_thread_t *p_vout = THEMIM->getVout(); vlc_value_t val; var_Get( p_vout, "fullscreen", &val );
/* Add a fullscreen switch button */ b_isFullscreen = !( !val.b_bool );
if( p_vout ) if( b_isFullscreen )
{ CreateAndConnect( menu, "fullscreen",
vlc_value_t val; qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL,
var_Get( p_vout, "fullscreen", &val ); VLC_OBJECT(p_vout), val, VLC_VAR_BOOL, b_isFullscreen );
b_isFullscreen = !( !val.b_bool ); vlc_object_release( p_vout );
if( b_isFullscreen )
CreateAndConnect( menu, "fullscreen",
qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL,
VLC_OBJECT(p_vout), val, VLC_VAR_BOOL,
b_isFullscreen );
vlc_object_release( p_vout );
}
menu->addSeparator(); menu->addSeparator();
}
/* Input menu */ /* Input menu */
vlc_object_hold( p_input ); vlc_object_hold( p_input );
InputAutoMenuBuilder( p_input, objects, varnames ); InputAutoMenuBuilder( p_input, objects, varnames );
vlc_object_release( p_input ); vlc_object_release( p_input );
/* Audio menu */ /* Audio menu */
submenu = new QMenu( menu ); submenu = new QMenu( menu );
action = menu->addMenu( AudioMenu( p_intf, submenu ) ); action = menu->addMenu( AudioMenu( p_intf, submenu ) );
action->setText( qtr( "&Audio" ) ); action->setText( qtr( "&Audio" ) );
if( action->menu()->isEmpty() ) if( action->menu()->isEmpty() )
action->setEnabled( false ); action->setEnabled( false );
/* Video menu */ /* Video menu */
submenu = new QMenu( menu ); submenu = new QMenu( menu );
action = menu->addMenu( VideoMenu( p_intf, submenu ) ); action = menu->addMenu( VideoMenu( p_intf, submenu ) );
action->setText( qtr( "&Video" ) ); action->setText( qtr( "&Video" ) );
if( action->menu()->isEmpty() ) if( action->menu()->isEmpty() )
action->setEnabled( false ); action->setEnabled( false );
/* Playback menu for chapters */ /* Playback menu for chapters */
submenu = new QMenu( menu ); submenu = new QMenu( menu );
action = menu->addMenu( NavigMenu( p_intf, submenu ) ); action = menu->addMenu( NavigMenu( p_intf, submenu ) );
action->setText( qtr( "&Playback" ) ); action->setText( qtr( "&Playback" ) );
if( action->menu()->isEmpty() ) if( action->menu()->isEmpty() )
action->setEnabled( false ); action->setEnabled( false );
} }
menu->addSeparator(); menu->addSeparator();
/* Add some special entries for windowed mode: Interface Menu */ /* Add some special entries for windowed mode: Interface Menu */
if( !b_isFullscreen ) if( !b_isFullscreen )
{
submenu = new QMenu( qtr( "Interface" ), menu );
QMenu *tools = ToolsMenu( submenu );
submenu->addSeparator();
/* In skins interface, append some items */
if( !mi )
{ {
submenu = new QMenu( qtr( "Interface" ), menu ); objects.clear(); varnames.clear();
if( mi )
{
submenu->addAction( QIcon( ":/playlist" ),
qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) );
action = submenu->addAction( QIcon( "" ),
qtr( "Minimal View" ), mi, SLOT( toggleMinimalView() ) );
action->setCheckable( true );
action->setChecked( !( mi->getControlsVisibilityStatus() &
CONTROLS_VISIBLE ) );
action = submenu->addAction( QIcon( "" ),
qtr( "Fullscreen Interface" ),
mi, SLOT( toggleFullScreen() ) );
action->setCheckable( true );
action->setChecked( mi->isFullScreen() );
}
else /* We are using the skins interface.
If not, this entry will not show. */
{
QMenu *tools = ToolsMenu( submenu ); vlc_object_t *p_object = ( vlc_object_t* )
submenu->addSeparator(); vlc_object_find_name( p_intf, "skins2", FIND_PARENT );
objects.clear(); if( p_object )
varnames.clear(); {
vlc_object_t *p_object = ( vlc_object_t* ) objects.push_back( p_object );
vlc_object_find_name( p_intf, "skins2", FIND_PARENT ); varnames.push_back( "intf-skins" );
if( p_object ) Populate( p_intf, submenu, varnames, objects );
{ vlc_object_release( p_object );
objects.push_back( p_object );
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 ); else
msg_Warn( p_intf, "could not find parent interface" );
} }
else
menu->addMenu( ViewMenu( p_intf, mi, false ));
/* Static entries for ending, like open */ menu->addMenu( submenu );
PopupMenuStaticEntries( menu );
p_intf->p_sys->p_popup_menu = menu;
p_intf->p_sys->p_popup_menu->popup( QCursor::pos() );
}
else
{
// destroy popup if there is one
delete p_intf->p_sys->p_popup_menu;
p_intf->p_sys->p_popup_menu = NULL;
} }
/* Static entries for ending, like open */
PopupMenuStaticEntries( menu );
p_intf->p_sys->p_popup_menu = menu;
p_intf->p_sys->p_popup_menu->popup( QCursor::pos() );
} }
#undef ACT_ADD #undef ACT_ADD
...@@ -1013,8 +1003,8 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, ...@@ -1013,8 +1003,8 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi,
} }
sysMenu->addSeparator(); sysMenu->addSeparator();
PopupMenuControlEntries( sysMenu, p_intf, p_input ); PopupMenuControlEntries( sysMenu, p_intf);//, p_input );
PopupMenuPlaylistControlEntries( sysMenu, p_intf, p_input ); PopupMenuPlaylistControlEntries( sysMenu, p_intf);//, p_input );
sysMenu->addSeparator(); sysMenu->addSeparator();
addDPStaticEntry( sysMenu, qtr( "&Open Media" ), addDPStaticEntry( sysMenu, qtr( "&Open Media" ),
...@@ -1038,11 +1028,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, ...@@ -1038,11 +1028,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
vector<vlc_object_t *> & objects ) vector<vlc_object_t *> & objects )
{ {
QMenu *menu = current; QMenu *menu = current;
if( !menu ) assert( menu );
{
msg_Warn( p_intf, "%s leaking a menu", __func__ );
menu = new QMenu();
}
currentGroup = NULL; currentGroup = NULL;
......
...@@ -79,7 +79,7 @@ class QVLCMenu : public QObject ...@@ -79,7 +79,7 @@ class QVLCMenu : public QObject
public: public:
/* Main bar creation */ /* Main bar creation */
static void createMenuBar( MainInterface *mi, intf_thread_t *, bool ); static void createMenuBar( MainInterface *mi, intf_thread_t * );
/* Popups Menus */ /* Popups Menus */
static void PopupMenu( intf_thread_t *, bool ); static void PopupMenu( intf_thread_t *, bool );
...@@ -102,31 +102,40 @@ private: ...@@ -102,31 +102,40 @@ private:
/* All main Menus */ /* All main Menus */
static QMenu *FileMenu( intf_thread_t *, QWidget * ); static QMenu *FileMenu( intf_thread_t *, QWidget * );
static QMenu *SDMenu( intf_thread_t *, QWidget * ); static QMenu *SDMenu( intf_thread_t *, QWidget * );
static QMenu *ToolsMenu( QMenu * ); static QMenu *ToolsMenu( QMenu * );
static QMenu *ToolsMenu( QWidget * ); static QMenu *ToolsMenu( QWidget * );
static QMenu *ViewMenu( intf_thread_t *, QMenu *, MainInterface *,
bool, bool with = true ); static QMenu *ViewMenu( intf_thread_t *, MainInterface *,
bool with = true );
static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * );
static QMenu *NavigMenu( intf_thread_t *, QMenu * ); static QMenu *NavigMenu( intf_thread_t *, QMenu * );
static QMenu *NavigMenu( intf_thread_t *, QWidget * ); static QMenu *NavigMenu( intf_thread_t *, QWidget * );
static QMenu *RebuildNavigMenu( intf_thread_t *, QMenu *);
static QMenu *VideoMenu( intf_thread_t *, QMenu * ); static QMenu *VideoMenu( intf_thread_t *, QMenu * );
static QMenu *VideoMenu( intf_thread_t *, QWidget * ); static QMenu *VideoMenu( intf_thread_t *, QWidget * );
static QMenu *AudioMenu( intf_thread_t *, QMenu * ); static QMenu *AudioMenu( intf_thread_t *, QMenu * );
static QMenu *AudioMenu( intf_thread_t *, QWidget * ); static QMenu *AudioMenu( intf_thread_t *, QWidget * );
static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * );
static QMenu *HelpMenu( QWidget * ); static QMenu *HelpMenu( QWidget * );
/* Popups Menus */ /* Popups Menus */
static void PopupMenuStaticEntries( QMenu *menu ); static void PopupMenuStaticEntries( QMenu *menu );
static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf, static void PopupPlayEntries( QMenu *menu, intf_thread_t *p_intf,
input_thread_t *p_input );
static void PopupMenuPlaylistControlEntries( QMenu *menu, intf_thread_t *p_intf,
input_thread_t *p_input ); input_thread_t *p_input );
static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf );
static void PopupMenuPlaylistControlEntries( QMenu *menu, intf_thread_t *p_intf );
/* Generic automenu methods */ /* Generic automenu methods */
static QMenu * Populate( intf_thread_t *, QMenu *current, static QMenu * Populate( intf_thread_t *, QMenu *current,
vector<const char*>&, vector<vlc_object_t *>& ); vector<const char*>&, vector<vlc_object_t *>& );
static void CreateAndConnect( QMenu *, const char *, QString, QString, static void CreateAndConnect( QMenu *, const char *, QString, QString,
int, vlc_object_t *, vlc_value_t, int, bool c = false ); int, vlc_object_t *, vlc_value_t, int,
bool c = false );
static void UpdateItem( intf_thread_t *, QMenu *, const char *, static void UpdateItem( intf_thread_t *, QMenu *, const char *,
vlc_object_t *, bool ); vlc_object_t *, bool );
static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool ); static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool );
...@@ -152,7 +161,7 @@ public: ...@@ -152,7 +161,7 @@ public:
{ {
case 1: QVLCMenu::AudioMenu( p_intf, menu ); break; case 1: QVLCMenu::AudioMenu( p_intf, menu ); break;
case 2: QVLCMenu::VideoMenu( p_intf, menu ); break; case 2: QVLCMenu::VideoMenu( p_intf, menu ); break;
case 3: QVLCMenu::NavigMenu( p_intf, menu ); break; case 3: QVLCMenu::RebuildNavigMenu( p_intf, menu ); break;
case 4: QVLCMenu::InterfacesMenu( p_intf, menu ); break; case 4: QVLCMenu::InterfacesMenu( p_intf, menu ); break;
} }
} }
......
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