#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)
Just before one of those menus are aboutToShow(), they are rebuild.
*/
-#define STATIC_ENTRY "__static__"
-#define ENTRY_ALWAYS_ENABLED "__ignore__"
-
enum
{
ITEM_NORMAL, /* not a checkbox, nor a radio */
static QActionGroup *currentGroup;
-QMenu *QVLCMenu::recentsMenu = NULL;
+QMenu *VLCMenuBar::recentsMenu = NULL;
/**
* @brief Add static entries to DP in menus
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 );
}
- action->setData( STATIC_ENTRY );
+#ifdef __APPLE__
+ action->setMenuRole( role );
+#else
+ Q_UNUSED( role );
+#endif
+ action->setData( VLCMenuBar::ACTION_STATIC );
return action;
}
{
action = menu->addAction( text, THEMIM, member );
}
- action->setData( bStatic ? STATIC_ENTRY : ENTRY_ALWAYS_ENABLED );
+ action->setData( VLCMenuBar::ACTION_STATIC |
+ ( bStatic ) ? VLCMenuBar::ACTION_ALWAYS_ENABLED
+ : VLCMenuBar::ACTION_NONE
+ );
return action;
}
* @param menu the menu in which the entries will be disabled
* @param enable if false, disable all entries
**/
-void EnableStaticEntries( QMenu *menu, bool enable = true )
+void VLCMenuBar::EnableStaticEntries( QMenu *menu, bool enable = true )
{
if( !menu ) return;
QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.count(); ++i )
{
- actions[i]->setEnabled( actions[i]->data().toString()
- == ENTRY_ALWAYS_ENABLED ||
- /* Be careful here, because data("string").toBool is true */
- ( enable && (actions[i]->data().toString() == STATIC_ENTRY ) ) );
+ int actionflags = actions[i]->data().toInt();
+ if ( actionflags & ACTION_MANAGED )
+ actions[i]->setEnabled(
+ ( actionflags & ACTION_ALWAYS_ENABLED )
+ ||
+ enable
+ );
}
}
QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.count(); ++i )
{
- if( actions[i]->data().toString() != STATIC_ENTRY )
- delete actions[i];
- else
+ if( actions[i]->data().toInt() & VLCMenuBar::ACTION_NO_CLEANUP )
i_ret++;
+ else
+ delete actions[i];
}
return i_ret;
}
PUSH_VAR( "fullscreen" );
PUSH_VAR( "video-on-top" );
PUSH_VAR( "video-wallpaper" );
-#ifdef WIN32
- PUSH_VAR( "direct3d-desktop" );
-#endif
PUSH_VAR( "video-snapshot" );
PUSH_VAR( "zoom" );
PUSH_VAR( "autoscale" );
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;
}
/**
* Main Menu Bar Creation
**/
-void QVLCMenu::createMenuBar( MainInterface *mi,
+void VLCMenuBar::createMenuBar( MainInterface *mi,
intf_thread_t *p_intf )
{
/* QMainWindows->menuBar()
* Media ( File ) Menu
* Opening, streaming and quit
**/
-QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterface *mi )
+QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterface *mi )
{
QMenu *menu = new QMenu( parent );
QAction *action;
}
addDPStaticEntry( menu, qtr( "&Quit" ) ,
- ":/menu/quit", SLOT( quit() ), "Ctrl+Q" );
+ ":/menu/exit", SLOT( quit() ), "Ctrl+Q" );
return menu;
}
/**
* Tools, like Media Information, Preferences or Messages
**/
-QMenu *QVLCMenu::ToolsMenu( QMenu *menu )
+QMenu *VLCMenuBar::ToolsMenu( QMenu *menu )
{
addDPStaticEntry( menu, qtr( "&Effects and Filters"), ":/menu/settings",
SLOT( extendedDialog() ), "Ctrl+E" );
#ifdef ENABLE_VLM
addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", SLOT( vlmDialog() ),
- "Ctrl+W" );
+ "Ctrl+Shift+W" );
#endif
addDPStaticEntry( menu, qtr( "Program Guide" ), "", SLOT( epgDialog() ),
* Interface modification, load other interfaces, activate Extensions
* \param current, set to NULL for menu creation, else for menu update
**/
-QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface *_mi )
+QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface *_mi )
{
QAction *action;
QMenu *menu;
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 */
/**
* Interface Sub-Menu, to list extras interface and skins
**/
-QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
+QMenu *VLCMenuBar::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
{
QVector<vlc_object_t *> objects;
QVector<const char *> varnames;
/**
* Extensions menu: populate the current menu with extensions
**/
-void QVLCMenu::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu )
+void VLCMenuBar::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu )
{
/* Get ExtensionsManager and load extensions if needed */
ExtensionsManager *extMgr = ExtensionsManager::getInstance( p_intf );
static inline void VolumeEntries( intf_thread_t *p_intf, QMenu *current )
{
- current->addSeparator();
+ current->addSeparator();
- QAction *action = current->addAction( qtr( "Increase Volume" ),
+ QAction *action = current->addAction( qtr( "&Increase Volume" ),
ActionsManager::getInstance( p_intf ), SLOT( AudioUp() ) );
- action->setData( STATIC_ENTRY );
- action = current->addAction( qtr( "Decrease Volume" ),
+ action->setData( VLCMenuBar::ACTION_STATIC );
+ action = current->addAction( qtr( "&Decrease Volume" ),
ActionsManager::getInstance( p_intf ), SLOT( AudioDown() ) );
- action->setData( STATIC_ENTRY );
- action = current->addAction( qtr( "Mute" ),
+ action->setData( VLCMenuBar::ACTION_STATIC );
+ action = current->addAction( qtr( "&Mute" ),
ActionsManager::getInstance( p_intf ), SLOT( toggleMuteAudio() ) );
- action->setData( STATIC_ENTRY );
+ action->setData( VLCMenuBar::ACTION_STATIC );
}
/**
* Main Audio Menu
**/
-QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
+QMenu *VLCMenuBar::AudioMenu( intf_thread_t *p_intf, QMenu * current )
{
QVector<vlc_object_t *> objects;
QVector<const char *> varnames;
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" ) );
}
/* Subtitles */
-QMenu *QVLCMenu::SubtitleMenu( QMenu *current )
+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..." ), "",
* Main Video Menu
* Subtitles are part of Video.
**/
-QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtitle )
+QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtitle )
{
vout_thread_t *p_vout;
input_thread_t *p_input;
addActionWithCheckbox( current, "fullscreen", qtr( "&Fullscreen" ) );
addActionWithCheckbox( current, "autoscale", qtr( "Always Fit &Window" ) );
addActionWithCheckbox( current, "video-on-top", qtr( "Always &on Top" ) );
-#ifdef WIN32
- addActionWithCheckbox( current, "direct3d-desktop", qtr( "Display on &Desktop" ) );
-#endif
-
-#ifdef WIN32
addActionWithCheckbox( current, "video-wallpaper", qtr( "Set as Wall&paper" ) );
-#endif
+
current->addSeparator();
/* Size modifiers */
addActionWithSubmenu( current, "zoom", qtr( "&Zoom" ) );
* Navigation Menu
* For DVD, MP4, MOV and other chapter based format
**/
-QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
+QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
{
QAction *action;
QMenu *submenu;
action->setData( "bookmark" );
menu->addSeparator();
- PopupMenuPlaylistControlEntries( menu, p_intf );
+
PopupMenuControlEntries( menu, p_intf );
EnableStaticEntries( menu, ( THEMIM->getInput() != NULL ) );
- return RebuildNavigMenu( p_intf, menu );
+ return RebuildNavigMenu( p_intf, menu, true );
}
-QMenu *QVLCMenu::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu )
+QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu, bool b_keep )
{
/* */
input_thread_t *p_object;
InputAutoMenuBuilder( p_object, objects, varnames );
- menu->addSeparator();
-
/* Title and so on */
PUSH_VAR( "prev-title" );
PUSH_VAR( "next-title" );
PUSH_VAR( "prev-chapter" );
PUSH_VAR( "next-chapter" );
+ /* */
EnableStaticEntries( menu, (p_object != NULL ) );
- return Populate( p_intf, menu, varnames, objects );
+ Populate( p_intf, menu, varnames, objects );
+
+ /* Remove playback actions to recreate them */
+ if( !b_keep )
+ {
+ QList< QAction* > actions = menu->actions();
+ for( int i = 0; i < actions.count(); i++ )
+ if( actions[i]->data().toInt() & ACTION_DELETE_ON_REBUILD )
+ delete actions[i];
+ }
+
+ PopupMenuPlaylistEntries( menu, p_intf, p_object );
+
+ return menu;
}
/**
* Help/About Menu
**/
-QMenu *QVLCMenu::HelpMenu( QWidget *parent )
+QMenu *VLCMenuBar::HelpMenu( QWidget *parent )
{
QMenu *menu = new QMenu( parent );
addDPStaticEntry( menu, qtr( "&Help..." ) ,
Populate( p_intf, menu, varnames, objects ); \
menu->popup( QCursor::pos() ); \
-void QVLCMenu::PopupPlayEntries( QMenu *menu,
+void VLCMenuBar::PopupMenuPlaylistEntries( QMenu *menu,
intf_thread_t *p_intf,
input_thread_t *p_input )
{
/* Play or Pause action and icon */
if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S )
{
- action = menu->addAction( qtr( "Play" ),
+ action = menu->addAction( qtr( "&Play" ),
ActionsManager::getInstance( p_intf ), SLOT( play() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/menu/play" ) );
}
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 QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
+void VLCMenuBar::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
bool b_normal )
{
QAction *action;
+ QMenu *rateMenu = new QMenu( qtr( "Sp&eed" ), menu );
+ rateMenu->setTearOffEnabled( true );
if( b_normal )
{
/* Faster/Slower */
- action = menu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
+ action = rateMenu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
SLOT( faster() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/toolbar/faster2") );
#endif
- action->setData( STATIC_ENTRY );
+ action->setData( ACTION_STATIC );
}
- action = menu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
+ action = rateMenu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
SLOT( littlefaster() ) );
- action->setData( STATIC_ENTRY );
+ action->setData( ACTION_STATIC );
- action = menu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(),
+ action = rateMenu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(),
SLOT( normalRate() ) );
- action->setData( STATIC_ENTRY );
+ action->setData( ACTION_STATIC );
- action = menu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(),
+ action = rateMenu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(),
SLOT( littleslower() ) );
- action->setData( STATIC_ENTRY );
+ action->setData( ACTION_STATIC );
if( b_normal )
{
- action = menu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
+ action = rateMenu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
SLOT( slower() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/toolbar/slower2") );
#endif
- action->setData( STATIC_ENTRY );
+ action->setData( ACTION_STATIC );
}
+ action = menu->addMenu( rateMenu );
+ action->setData( ACTION_STATIC );
+
menu->addSeparator();
if( !b_normal ) return;
#ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/toolbar/skip_fw") );
#endif
- action->setData( STATIC_ENTRY );
+ action->setData( ACTION_STATIC );
action = menu->addAction( qtr( "Jump Bac&kward" ), THEMIM->getIM(),
SLOT( jumpBwd() ) );
#ifndef __APPLE__ /* No icons in menus in Mac */
action->setIcon( QIcon( ":/toolbar/skip_back") );
#endif
- action->setData( STATIC_ENTRY );
- addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"",
- SLOT( gotoTimeDialog() ), "Ctrl+T" );
- menu->addSeparator();
-}
+ action->setData( ACTION_STATIC );
-
-void QVLCMenu::PopupMenuPlaylistControlEntries( QMenu *menu,
- intf_thread_t *p_intf )
-{
- bool bEnable = THEMIM->getInput() != NULL;
- 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 */
- addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
- ":/menu/previous", SLOT( prev() ) );
- addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
- ":/menu/next", SLOT( next() ) );
+ action = menu->addAction( qtr( I_MENU_GOTOTIME ), THEDP, SLOT( gotoTimeDialog() ), qtr( "Ctrl+T" ) );
+ action->setData( ACTION_ALWAYS_ENABLED );
menu->addSeparator();
}
-void QVLCMenu::PopupMenuStaticEntries( QMenu *menu )
+void VLCMenuBar::PopupMenuStaticEntries( QMenu *menu )
{
- QMenu *openmenu = new QMenu( qtr( "Open a Media" ), menu );
+ QMenu *openmenu = new QMenu( qtr( "Open Media" ), menu );
addDPStaticEntry( openmenu, qtr( "&Open File..." ),
":/type/file-asym", SLOT( openFileDialog() ) );
addDPStaticEntry( openmenu, qtr( I_OP_OPDIR ),
menu->addMenu( helpmenu );
#endif
- addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/quit",
+ addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/exit",
SLOT( quit() ), "Ctrl+Q", QAction::QuitRole );
}
/* Video Tracks and Subtitles tracks */
-void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf, bool show )
+void VLCMenuBar::VideoPopupMenu( intf_thread_t *p_intf, bool show )
{
POPUP_BOILERPLATE
if( p_input )
}
/* Audio Tracks */
-void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf, bool show )
+void VLCMenuBar::AudioPopupMenu( intf_thread_t *p_intf, bool show )
{
POPUP_BOILERPLATE
if( p_input )
}
/* Navigation stuff, and general menus ( open ), used only for skins */
-void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf, bool show )
+void VLCMenuBar::MiscPopupMenu( intf_thread_t *p_intf, bool show )
{
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 );
}
/* Main Menu that sticks everything together */
-void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
+void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
{
POPUP_BOILERPLATE
/* */
- menu = new QMenu( );
+ menu = new QMenu();
QAction *action;
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 )
}
/* */
- QMenuView *plMenu = new QMenuView( menu );
+ QMenuView *plMenu = new QMenuView( menu, 25 );
plMenu->setTitle( qtr("Playlist") );
PLModel *model = PLModel::getPLModel( p_intf );
plMenu->setModel( model );
#undef POPUP_BOILERPLATE
#undef BAR_DADD
-#ifndef HAVE_MAEMO
/************************************************************************
* Systray Menu *
************************************************************************/
-void QVLCMenu::updateSystrayMenu( MainInterface *mi,
+void VLCMenuBar::updateSystrayMenu( MainInterface *mi,
intf_thread_t *p_intf,
bool b_force_visible )
{
if( mi->isVisible() || b_force_visible )
{
sysMenu->addAction( QIcon( ":/logo/vlc16.png" ),
- qtr( "Hide VLC media player in taskbar" ), mi,
+ qtr( "&Hide VLC media player in taskbar" ), mi,
SLOT( hideUpdateSystrayMenu() ) );
}
else
{
sysMenu->addAction( QIcon( ":/logo/vlc16.png" ),
- qtr( "Show VLC media player" ), mi,
+ qtr( "Sho&w VLC media player" ), mi,
SLOT( showUpdateSystrayMenu() ) );
}
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 );
sysMenu->addSeparator();
- addDPStaticEntry( sysMenu, qtr( "&Open a Media" ),
+ 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 );
}
-#endif
#undef PUSH_VAR
/*************************************************************************
* Builders for automenus
*************************************************************************/
-QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
+QMenu * VLCMenuBar::Populate( intf_thread_t *p_intf,
QMenu *current,
QVector< const char *> & varnames,
QVector<vlc_object_t *> & objects )
#define TEXT_OR_VAR qfu ( text.psz_string ? text.psz_string : psz_var )
-void QVLCMenu::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
+void VLCMenuBar::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
const char *psz_var, vlc_object_t *p_object, bool b_submenu )
{
vlc_value_t val, text;
}
-int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
+int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
vlc_object_t *p_object, bool b_root )
{
vlc_value_t val, val_list, text_list;
#define CURVAL val_list.p_list->p_values[i]
#define CURTEXT text_list.p_list->p_values[i].psz_string
-#define RADIO_OR_COMMAND ( i_type & VLC_VAR_ISCOMMAND ) ? ITEM_NORMAL : ITEM_RADIO
+#define RADIO_OR_COMMAND ( i_type & ( VLC_VAR_ISCOMMAND | VLC_VAR_HASCHOICE ) ) ? ITEM_RADIO : ITEM_NORMAL
for( i = 0; i < val_list.p_list->i_count; i++ )
{
return submenu->isEmpty() ? VLC_EGENERIC : VLC_SUCCESS;
}
-void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
+void VLCMenuBar::CreateAndConnect( QMenu *menu, const char *psz_var,
const QString& text, const QString& help,
int i_item_type, vlc_object_t *p_obj,
vlc_value_t val, int i_val_type,
menu->addAction( action );
}
-void QVLCMenu::DoAction( QObject *data )
+void VLCMenuBar::DoAction( QObject *data )
{
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 QVLCMenu::updateRecents( intf_thread_t *p_intf )
+void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
{
if( recentsMenu )
{
{
for( int i = 0; i < l.count(); ++i )
{
- char *psz_temp = decode_URI_duplicate( qtu( l.at( i ) ) );
+ QString mrl = l.at( i );
+ char *psz = decode_URI_duplicate( qtu( mrl ) );
+ QString text = qfu( psz );
+ free( psz );
action = recentsMenu->addAction(
QString( i < 9 ? "&%1: ": "%1: " ).arg( i + 1 ) +
- QApplication::fontMetrics().elidedText( psz_temp, Qt::ElideLeft, 400 ),
+ QApplication::fontMetrics().elidedText( text,
+ Qt::ElideLeft, 400 ),
rmrl->signalMapper, SLOT( map() ),
i < 9 ? QString( "Ctrl+%1" ).arg( i + 1 ) : "" );
rmrl->signalMapper->setMapping( action, l.at( i ) );
-
- free( psz_temp );
}
recentsMenu->addSeparator();
recentsMenu->addAction( qtr("&Clear"), rmrl, SLOT( clear() ) );
+ recentsMenu->setEnabled( true );
}
}
}