#include "extensions_manager.hpp" /* Extensions menu */
#include "util/qmenuview.hpp" /* Simple Playlist menu */
#include "components/playlist/playlist_model.hpp" /* PLModel getter */
+#include "components/playlist/standardpanel.hpp" /* PLView getter */
#include <QMenu>
#include <QMenuBar>
#include <QAction>
#include <QActionGroup>
#include <QSignalMapper>
-#include <QSystemTrayIcon>
#include <QStatusBar>
-#include <QFontMetrics>
/*
This file defines the main menus and the pop-up menu (right-click menu)
const char *icon,
const char *member,
const char *shortcut = NULL,
- QAction::MenuRole = QAction::NoRole
+ QAction::MenuRole role = QAction::NoRole
)
{
QAction *action = NULL;
else
action = menu->addAction( text, THEDP, member );
}
+#ifdef __APPLE__
+ action->setMenuRole( role );
+#else
+ Q_UNUSED( role );
+#endif
action->setData( VLCMenuBar::ACTION_STATIC );
return action;
}
QVector<const char *> &varnames )
{
PUSH_INPUTVAR( "audio-es" );
- PUSH_VAR( "audio-channels" );
- PUSH_VAR( "audio-device" );
+ PUSH_VAR( "stereo-mode" );
+ PUSH_VAR( "device" );
PUSH_VAR( "visual" );
return VLC_SUCCESS;
}
}
addDPStaticEntry( menu, qtr( "&Quit" ) ,
- ":/menu/quit", SLOT( quit() ), "Ctrl+Q" );
+ ":/menu/exit", SLOT( quit() ), "Ctrl+Q" );
return menu;
}
#ifdef ENABLE_VLM
addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", SLOT( vlmDialog() ),
- "Ctrl+W" );
+ "Ctrl+Shift+W" );
#endif
addDPStaticEntry( menu, qtr( "Program Guide" ), "", SLOT( epgDialog() ),
qtr( "Play&list" ), mi,
SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
+ if( mi->getPlaylistView() )
+ menu->addMenu( StandardPLPanel::viewSelectionMenu( mi->getPlaylistView() ) );
menu->addSeparator();
/* Minimal View */
action = menu->addAction( qtr( "Mi&nimal Interface" ) );
action->setShortcut( qtr( "Ctrl+H" ) );
action->setCheckable( true );
- action->setChecked( (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) );
+ action->setChecked( (mi->getControlsVisibilityStatus()
+ & MainInterface::CONTROLS_HIDDEN ) );
CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) );
CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) );
action = menu->addAction( qtr( "&Advanced Controls" ), mi,
SLOT( toggleAdvancedButtons() ) );
action->setCheckable( true );
- if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
+ if( mi->getControlsVisibilityStatus() & MainInterface::CONTROLS_ADVANCED )
action->setChecked( true );
/* Docked Playlist */
if( current->isEmpty() )
{
addActionWithSubmenu( current, "audio-es", qtr( "Audio &Track" ) );
- addActionWithSubmenu( current, "audio-channels", qtr( "Audio &Channels" ) );
- addActionWithSubmenu( current, "audio-device", qtr( "Audio &Device" ) );
+ addActionWithSubmenu( current, "stereo-mode", qtr( "&Stereo Mode" ) );
+ addActionWithSubmenu( current, "device", qtr( "Audio &Device" ) );
current->addSeparator();
addActionWithSubmenu( current, "visual", qtr( "&Visualizations" ) );
QMenu *VLCMenuBar::SubtitleMenu( QMenu *current )
{
QAction *action;
- QMenu *submenu = new QMenu( qtr( "&Subtitles Track" ), current );
+ QMenu *submenu = new QMenu( qtr( "&Subtitle Track" ), current );
action = current->addMenu( submenu );
action->setData( "spu-es" );
addDPStaticEntry( submenu, qtr( "Open File..." ), "",
QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu, bool b_keep )
{
-
/* */
input_thread_t *p_object;
QVector<vlc_object_t *> objects;
PUSH_VAR( "prev-chapter" );
PUSH_VAR( "next-chapter" );
+ /* */
+ EnableStaticEntries( menu, (p_object != NULL ) );
+ Populate( p_intf, menu, varnames, objects );
+
/* Remove playback actions to recreate them */
if( !b_keep )
{
QList< QAction* > actions = menu->actions();
- if( actions.count() > 4 )
- for( int i = actions.count() - 1 ; i >= actions.count() - 1 - 4 ; --i )
+ for( int i = 0; i < actions.count(); i++ )
+ if( actions[i]->data().toInt() & ACTION_DELETE_ON_REBUILD )
delete actions[i];
}
- PopupPlayEntries( menu, p_intf, p_object );
- PopupMenuPlaylistControlEntries( menu, p_intf );
+ PopupMenuPlaylistEntries( menu, p_intf, p_object );
- /* */
- EnableStaticEntries( menu, (p_object != NULL ) );
- return Populate( p_intf, menu, varnames, objects );
+ return menu;
}
/**
Populate( p_intf, menu, varnames, objects ); \
menu->popup( QCursor::pos() ); \
-void VLCMenuBar::PopupPlayEntries( QMenu *menu,
+void VLCMenuBar::PopupMenuPlaylistEntries( QMenu *menu,
intf_thread_t *p_intf,
input_thread_t *p_input )
{
}
else
{
- addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
- ":/menu/pause", SLOT( togglePlayPause() ) );
+ action = addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
+ ":/menu/pause", SLOT( togglePlayPause() ) );
}
+ action->setData( ACTION_DELETE_ON_REBUILD );
+
+ /* Stop */
+ action = addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ),
+ ":/menu/stop", SLOT( stop() ), true );
+ if( !p_input )
+ action->setEnabled( false );
+ action->setData( ACTION_DELETE_ON_REBUILD );
+
+ /* Next / Previous */
+ bool bPlaylistEmpty = THEMIM->hasEmptyPlaylist();
+ action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
+ ":/menu/previous", SLOT( prev() ), true );
+ action->setEnabled( !bPlaylistEmpty );
+ action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
+ CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
+
+ action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
+ ":/menu/next", SLOT( next() ), true );
+ action->setEnabled( !bPlaylistEmpty );
+ action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
+ CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
+
+ menu->addSeparator();
}
void VLCMenuBar::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
action->setIcon( QIcon( ":/toolbar/skip_back") );
#endif
action->setData( ACTION_STATIC );
- addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"",
- SLOT( gotoTimeDialog() ), "Ctrl+T" );
- menu->addSeparator();
-}
-
-void VLCMenuBar::PopupMenuPlaylistControlEntries( QMenu *menu,
- intf_thread_t *p_intf )
-{
- bool bEnable = THEMIM->getInput() != NULL;
- bool bPlaylistEmpty = THEMIM->hasEmptyPlaylist();
- QAction *action = addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ),
- ":/menu/stop", SLOT( stop() ), true );
- /* Disable Stop in the right-click popup menu */
- if( !bEnable )
- action->setEnabled( false );
-
- /* Next / Previous */
- action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
- ":/menu/previous", SLOT( prev() ), true );
- action->setEnabled( !bPlaylistEmpty );
- action->setData( ACTION_NO_CLEANUP );
- CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
- action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
- ":/menu/next", SLOT( next() ), true );
- action->setEnabled( !bPlaylistEmpty );
- action->setData( ACTION_NO_CLEANUP );
- CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
+ action = menu->addAction( qtr( I_MENU_GOTOTIME ), THEDP, SLOT( gotoTimeDialog() ), qtr( "Ctrl+T" ) );
+ action->setData( ACTION_ALWAYS_ENABLED );
menu->addSeparator();
}
menu->addMenu( helpmenu );
#endif
- addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/quit",
+ addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/exit",
SLOT( quit() ), "Ctrl+Q", QAction::QuitRole );
}
{
POPUP_BOILERPLATE
+ menu = new QMenu();
if( p_input )
{
varnames.append( "audio-es" );
menu->addSeparator();
}
- menu = new QMenu();
Populate( p_intf, menu, varnames, objects );
menu->addSeparator();
- PopupPlayEntries( menu, p_intf, p_input );
- PopupMenuPlaylistControlEntries( menu, p_intf);
+ PopupMenuPlaylistEntries( menu, p_intf, p_input );
menu->addSeparator();
PopupMenuControlEntries( menu, p_intf );
bool b_isFullscreen = false;
MainInterface *mi = p_intf->p_sys->p_mi;
- PopupPlayEntries( menu, p_intf, p_input );
- PopupMenuPlaylistControlEntries( menu, p_intf );
+ PopupMenuPlaylistEntries( menu, p_intf, p_input );
menu->addSeparator();
if( p_input )
sysMenu->addSeparator();
#endif
- PopupPlayEntries( sysMenu, p_intf, p_input );
- PopupMenuPlaylistControlEntries( sysMenu, p_intf);
+ PopupMenuPlaylistEntries( sysMenu, p_intf, p_input );
PopupMenuControlEntries( sysMenu, p_intf, false );
VolumeEntries( p_intf, sysMenu );
addDPStaticEntry( sysMenu, qtr( "&Open Media" ),
":/type/file-wide", SLOT( openFileDialog() ) );
addDPStaticEntry( sysMenu, qtr( "&Quit" ) ,
- ":/menu/quit", SLOT( quit() ) );
+ ":/menu/exit", SLOT( quit() ) );
/* Set the menu */
mi->getSysTray()->setContextMenu( sysMenu );
MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
vlc_object_t *p_object = itemData->p_obj;
if( p_object == NULL ) return;
+ const char *var = itemData->psz_var;
+ vlc_value_t val = itemData->val;
/* Preserve settings across vouts via the playlist object: */
- if( !strcmp( itemData->psz_var, "fullscreen" )
- || !strcmp( itemData->psz_var, "video-on-top" ) )
- var_Set( pl_Get( p_object ), itemData->psz_var, itemData->val );
+ if( !strcmp( var, "fullscreen" )
+ || !strcmp( var, "video-on-top" ) )
+ var_Set( pl_Get( p_object ), var, val );
- var_Set( p_object, itemData->psz_var, itemData->val );
+ if ((var_Type( p_object, var) & VLC_VAR_CLASS) == VLC_VAR_VOID)
+ var_TriggerCallback( p_object, var );
+ else
+ var_Set( p_object, var, val );
}
void VLCMenuBar::updateRecents( intf_thread_t *p_intf )