1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright © 2006-2011 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
9 * Jean-Philippe André <jpeg@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * ( at your option ) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
27 * - Remove static currentGroup
30 #define __STDC_FORMAT_MACROS 1
31 #define __STDC_CONSTANT_MACROS 1
37 #include <vlc_common.h>
38 #include <vlc_intf_strings.h>
39 #include <vlc_vout.h> /* vout_thread_t */
40 #include <vlc_aout.h> /* audio_output_t */
44 #include "main_interface.hpp" /* View modifications */
45 #include "dialogs_provider.hpp" /* Dialogs display */
46 #include "input_manager.hpp" /* Input Management */
47 #include "recents.hpp" /* Recent Items */
48 #include "actions_manager.hpp" /* Actions Management: play+volume */
49 #include "extensions_manager.hpp" /* Extensions menu */
50 #include "util/qmenuview.hpp" /* Simple Playlist menu */
51 #include "components/playlist/playlist_model.hpp" /* PLModel getter */
52 #include "components/playlist/standardpanel.hpp" /* PLView getter */
57 #include <QActionGroup>
58 #include <QSignalMapper>
62 This file defines the main menus and the pop-up menu (right-click menu)
63 and the systray menu (in that order in the file)
65 There are 4 menus that have to be rebuilt everytime there are called:
66 Audio, Video, Navigation, view
67 4 functions are building those menus: AudioMenu, VideoMenu, NavigMenu, View
68 and 3 functions associated are collecting the objects :
69 InputAutoMenuBuilder, AudioAutoMenuBuilder, VideoAutoMenuBuilder.
71 A QSignalMapper decides when to rebuild those menus cf MenuFunc in the .hpp
72 Just before one of those menus are aboutToShow(), they are rebuild.
77 ITEM_NORMAL, /* not a checkbox, nor a radio */
78 ITEM_CHECK, /* Checkbox */
79 ITEM_RADIO /* Radiobox */
82 static QActionGroup *currentGroup;
84 QMenu *VLCMenuBar::recentsMenu = NULL;
87 * @brief Add static entries to DP in menus
89 QAction *addDPStaticEntry( QMenu *menu,
93 const char *shortcut = NULL,
94 QAction::MenuRole role = QAction::NoRole
97 QAction *action = NULL;
98 #ifndef __APPLE__ /* We don't set icons in menus in MacOS X */
99 if( !EMPTY_STR( icon ) )
101 if( !EMPTY_STR( shortcut ) )
102 action = menu->addAction( QIcon( icon ), text, THEDP,
103 member, qtr( shortcut ) );
105 action = menu->addAction( QIcon( icon ), text, THEDP, member );
110 if( !EMPTY_STR( shortcut ) )
111 action = menu->addAction( text, THEDP, member, qtr( shortcut ) );
113 action = menu->addAction( text, THEDP, member );
116 action->setMenuRole( role );
120 action->setData( VLCMenuBar::ACTION_STATIC );
125 * @brief Add static entries to MIM in menus
127 QAction* addMIMStaticEntry( intf_thread_t *p_intf,
132 bool bStatic = false )
135 #ifndef __APPLE__ /* We don't set icons in menus in MacOS X */
136 if( !EMPTY_STR( icon ) )
138 action = menu->addAction( text, THEMIM, member );
139 action->setIcon( QIcon( icon ) );
144 action = menu->addAction( text, THEMIM, member );
146 action->setData( VLCMenuBar::ACTION_STATIC |
147 ( bStatic ) ? VLCMenuBar::ACTION_ALWAYS_ENABLED
148 : VLCMenuBar::ACTION_NONE
154 * @brief Enable all static entries of a menu, disable the others
155 * @param menu the menu in which the entries will be disabled
156 * @param enable if false, disable all entries
158 void VLCMenuBar::EnableStaticEntries( QMenu *menu, bool enable = true )
162 QList< QAction* > actions = menu->actions();
163 for( int i = 0; i < actions.count(); ++i )
165 int actionflags = actions[i]->data().toInt();
166 if ( actionflags & ACTION_MANAGED )
167 actions[i]->setEnabled(
168 ( actionflags & ACTION_ALWAYS_ENABLED )
176 * \return Number of static entries
178 inline int DeleteNonStaticEntries( QMenu *menu )
180 if( !menu ) return VLC_EGENERIC;
184 QList< QAction* > actions = menu->actions();
185 for( int i = 0; i < actions.count(); ++i )
187 if( actions[i]->data().toInt() & VLCMenuBar::ACTION_NO_CLEANUP )
196 * \return QAction associated to psz_var variable
198 static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
200 QList< QAction* > actions = menu->actions();
201 for( int i = 0; i < actions.count(); ++i )
203 if( actions[i]->data().toString() == psz_var )
209 /*****************************************************************************
210 * Definitions of variables for the dynamic menus
211 *****************************************************************************/
212 #define PUSH_VAR( var ) varnames.append( var ); \
213 objects.append( VLC_OBJECT(p_object) )
215 #define PUSH_INPUTVAR( var ) varnames.append( var ); \
216 objects.append( VLC_OBJECT(p_input) );
218 static int InputAutoMenuBuilder( input_thread_t *p_object,
219 QVector<vlc_object_t *> &objects,
220 QVector<const char *> &varnames )
222 PUSH_VAR( "bookmark" );
224 PUSH_VAR( "chapter" );
225 PUSH_VAR( "navigation" );
226 PUSH_VAR( "program" );
230 static int VideoAutoMenuBuilder( vout_thread_t *p_object,
231 input_thread_t *p_input,
232 QVector<vlc_object_t *> &objects,
233 QVector<const char *> &varnames )
235 PUSH_INPUTVAR( "video-es" );
236 PUSH_INPUTVAR( "spu-es" );
237 PUSH_VAR( "fullscreen" );
238 PUSH_VAR( "video-on-top" );
239 PUSH_VAR( "video-wallpaper" );
240 PUSH_VAR( "video-snapshot" );
242 PUSH_VAR( "autoscale" );
243 PUSH_VAR( "aspect-ratio" );
245 PUSH_VAR( "deinterlace" );
246 PUSH_VAR( "deinterlace-mode" );
247 PUSH_VAR( "postprocess" );
252 static int AudioAutoMenuBuilder( audio_output_t *p_object,
253 input_thread_t *p_input,
254 QVector<vlc_object_t *> &objects,
255 QVector<const char *> &varnames )
257 PUSH_INPUTVAR( "audio-es" );
258 PUSH_VAR( "audio-channels" );
259 PUSH_VAR( "audio-device" );
260 PUSH_VAR( "visual" );
264 /*****************************************************************************
267 *****************************************************************************/
270 static inline void addMenuToMainbar( QMenu *func, QString title, QMenuBar *bar ) {
271 func->setTitle( title );
276 #define BAR_DADD( func, title, id ) { \
277 QMenu *_menu = func; _menu->setTitle( title ); bar->addMenu( _menu ); \
278 MenuFunc *f = new MenuFunc( _menu, id ); \
279 CONNECT( _menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
280 THEDP->menusUpdateMapper->setMapping( _menu, f ); }
282 // Add a simple action
283 static inline void addAction( QMenu *_menu, QVariant val, QString title ) {
284 QAction *_action = new QAction( title, _menu );
285 _action->setData( val );
286 _menu->addAction( _action );
289 // Add an action with a submenu
290 static inline QMenu *addActionWithSubmenu( QMenu *_menu, QVariant val, QString title ) {
291 QAction *_action = new QAction( title, _menu );
292 QMenu *_submenu = new QMenu( _menu );
293 _action->setData( val );
294 _action->setMenu( _submenu );
295 _menu->addAction( _action );
299 // Add an action that is a checkbox
300 static inline void addActionWithCheckbox( QMenu *_menu, QVariant val, QString title ) {
301 QAction *_action = new QAction( title, _menu );
302 _action->setData( val );
303 _action->setCheckable( true );
304 _menu->addAction( _action );
308 * Main Menu Bar Creation
310 void VLCMenuBar::createMenuBar( MainInterface *mi,
311 intf_thread_t *p_intf )
313 /* QMainWindows->menuBar()
314 gives the QProcess::destroyed timeout issue on Cleanlooks style with
315 setDesktopAware set to false */
316 QMenuBar *bar = mi->menuBar();
318 addMenuToMainbar( FileMenu( p_intf, bar, mi ), qtr( "&Media" ), bar );
320 /* Dynamic menus, rebuilt before being showed */
321 BAR_DADD( NavigMenu( p_intf, bar ), qtr( "P&layback" ), 3 );
322 BAR_DADD( AudioMenu( p_intf, bar ), qtr( "&Audio" ), 1 );
323 BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 );
325 addMenuToMainbar( ToolsMenu( bar ), qtr( "&Tools" ), bar );
327 /* View menu, a bit different */
328 BAR_DADD( ViewMenu( p_intf, NULL, mi ), qtr( "V&iew" ), 4 );
330 addMenuToMainbar( HelpMenu( bar ), qtr( "&Help" ), bar );
335 * Media ( File ) Menu
336 * Opening, streaming and quit
338 QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterface *mi )
340 QMenu *menu = new QMenu( parent );
343 addDPStaticEntry( menu, qtr( "Open &File..." ),
344 ":/type/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" );
345 addDPStaticEntry( menu, qtr( I_OP_OPDIR ),
346 ":/type/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" );
347 addDPStaticEntry( menu, qtr( "Open &Disc..." ),
348 ":/type/disc", SLOT( openDiscDialog() ), "Ctrl+D" );
349 addDPStaticEntry( menu, qtr( "Open &Network Stream..." ),
350 ":/type/network", SLOT( openNetDialog() ), "Ctrl+N" );
351 addDPStaticEntry( menu, qtr( "Open &Capture Device..." ),
352 ":/type/capture-card", SLOT( openCaptureDialog() ), "Ctrl+C" );
354 menu->addSeparator();
356 addDPStaticEntry( menu, qtr( "&Open (advanced)..." ),
357 ":/type/file-asym", SLOT( openFileDialog() ), "Ctrl+Shift+O" );
358 menu->addSeparator();
360 addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ),
361 NULL, SLOT( openUrlDialog() ), "Ctrl+V" );
363 if( var_InheritBool( p_intf, "qt-recentplay" ) )
365 recentsMenu = new QMenu( qtr( "Open &Recent Media" ), menu );
366 updateRecents( p_intf );
367 menu->addMenu( recentsMenu );
369 menu->addSeparator();
371 addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", SLOT( saveAPlaylist() ),
373 menu->addSeparator();
376 addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "",
377 SLOT( openAndTranscodingDialogs() ), "Ctrl+R" );
378 addDPStaticEntry( menu, qtr( "&Stream..." ),
379 ":/menu/stream", SLOT( openAndStreamingDialogs() ), "Ctrl+S" );
380 menu->addSeparator();
383 action = addMIMStaticEntry( p_intf, menu, qtr( "Quit at the end of playlist" ), "",
384 SLOT( activatePlayQuit( bool ) ) );
385 action->setCheckable( true );
386 action->setChecked( THEMIM->getPlayExitState() );
388 if( mi->getSysTray() )
390 action = menu->addAction( qtr( "Close to systray"), mi,
391 SLOT( toggleUpdateSystrayMenu() ) );
394 addDPStaticEntry( menu, qtr( "&Quit" ) ,
395 ":/menu/quit", SLOT( quit() ), "Ctrl+Q" );
400 * Tools, like Media Information, Preferences or Messages
402 QMenu *VLCMenuBar::ToolsMenu( QMenu *menu )
404 addDPStaticEntry( menu, qtr( "&Effects and Filters"), ":/menu/settings",
405 SLOT( extendedDialog() ), "Ctrl+E" );
407 addDPStaticEntry( menu, qtr( "&Track Synchronization"), ":/menu/settings",
408 SLOT( synchroDialog() ), "" );
410 addDPStaticEntry( menu, qtr( I_MENU_INFO ) , ":/menu/info",
411 SLOT( mediaInfoDialog() ), "Ctrl+I" );
412 addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) ,
413 ":/menu/info", SLOT( mediaCodecDialog() ), "Ctrl+J" );
416 addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", SLOT( vlmDialog() ),
420 addDPStaticEntry( menu, qtr( "Program Guide" ), "", SLOT( epgDialog() ),
423 addDPStaticEntry( menu, qtr( I_MENU_MSG ),
424 ":/menu/messages", SLOT( messagesDialog() ), "Ctrl+M" );
426 addDPStaticEntry( menu, qtr( "Plu&gins and extensions" ),
427 "", SLOT( pluginDialog() ) );
428 menu->addSeparator();
430 addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ),
431 ":/menu/preferences", SLOT( toolbarDialog() ) );
433 addDPStaticEntry( menu, qtr( "&Preferences" ),
434 ":/menu/preferences", SLOT( prefsDialog() ), "Ctrl+P", QAction::PreferencesRole );
441 * Interface modification, load other interfaces, activate Extensions
442 * \param current, set to NULL for menu creation, else for menu update
444 QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface *_mi )
449 MainInterface *mi = _mi ? _mi : p_intf->p_sys->p_mi;
454 menu = new QMenu( qtr( "&View" ), mi );
460 //HACK menu->clear() does not delete submenus
461 QList<QAction*> actions = menu->actions();
462 foreach( QAction *a, actions )
464 QMenu *m = a->menu();
465 if( a->parent() == menu ) delete a;
466 else menu->removeAction( a );
467 if( m && m->parent() == menu ) delete m;
473 QIcon( ":/menu/playlist_menu" ),
475 qtr( "Play&list" ), mi,
476 SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
478 if( mi->getPlaylistView() )
479 menu->addMenu( StandardPLPanel::viewSelectionMenu( mi->getPlaylistView() ) );
480 menu->addSeparator();
483 action = menu->addAction( qtr( "Mi&nimal Interface" ) );
484 action->setShortcut( qtr( "Ctrl+H" ) );
485 action->setCheckable( true );
486 action->setChecked( (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) );
488 CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) );
489 CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) );
491 /* FullScreen View */
492 action = menu->addAction( qtr( "&Fullscreen Interface" ), mi,
493 SLOT( toggleInterfaceFullScreen() ), QString( "F11" ) );
494 action->setCheckable( true );
495 action->setChecked( mi->isInterfaceFullScreen() );
496 CONNECT( mi, fullscreenInterfaceToggled( bool ),
497 action, setChecked( bool ) );
499 /* Advanced Controls */
500 action = menu->addAction( qtr( "&Advanced Controls" ), mi,
501 SLOT( toggleAdvancedButtons() ) );
502 action->setCheckable( true );
503 if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
504 action->setChecked( true );
506 /* Docked Playlist */
507 action = menu->addAction( qtr( "Docked Playlist" ) );
508 action->setCheckable( true );
509 action->setChecked( mi->isPlDocked() );
510 CONNECT( action, triggered( bool ), mi, dockPlaylist( bool ) );
512 action = menu->addAction( qtr( "Status Bar" ) );
513 action->setCheckable( true );
514 action->setChecked( mi->statusBar()->isVisible() );
515 CONNECT( action, triggered( bool ), mi, setStatusBarVisibility( bool) );
516 #if 0 /* For Visualisations. Not yet working */
517 adv = menu->addAction( qtr( "Visualizations selector" ), mi,
519 adv->setCheckable( true );
520 if( visual_selector_enabled ) adv->setChecked( true );
523 menu->addSeparator();
525 InterfacesMenu( p_intf, menu );
526 menu->addSeparator();
529 ExtensionsMenu( p_intf, menu );
535 * Interface Sub-Menu, to list extras interface and skins
537 QMenu *VLCMenuBar::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
539 QVector<vlc_object_t *> objects;
540 QVector<const char *> varnames;
541 varnames.append( "intf-add" );
542 objects.append( VLC_OBJECT(p_intf) );
544 return Populate( p_intf, current, varnames, objects );
548 * Extensions menu: populate the current menu with extensions
550 void VLCMenuBar::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu )
552 /* Get ExtensionsManager and load extensions if needed */
553 ExtensionsManager *extMgr = ExtensionsManager::getInstance( p_intf );
555 if( !var_InheritBool( p_intf, "qt-autoload-extensions")
556 && !extMgr->isLoaded() )
561 if( !extMgr->isLoaded() && !extMgr->cannotLoad() )
563 extMgr->loadExtensions();
566 /* Let the ExtensionsManager build itself the menu */
567 extMenu->addSeparator();
568 extMgr->menu( extMenu );
571 static inline void VolumeEntries( intf_thread_t *p_intf, QMenu *current )
573 current->addSeparator();
575 QAction *action = current->addAction( qtr( "&Increase Volume" ),
576 ActionsManager::getInstance( p_intf ), SLOT( AudioUp() ) );
577 action->setData( VLCMenuBar::ACTION_STATIC );
578 action = current->addAction( qtr( "&Decrease Volume" ),
579 ActionsManager::getInstance( p_intf ), SLOT( AudioDown() ) );
580 action->setData( VLCMenuBar::ACTION_STATIC );
581 action = current->addAction( qtr( "&Mute" ),
582 ActionsManager::getInstance( p_intf ), SLOT( toggleMuteAudio() ) );
583 action->setData( VLCMenuBar::ACTION_STATIC );
589 QMenu *VLCMenuBar::AudioMenu( intf_thread_t *p_intf, QMenu * current )
591 QVector<vlc_object_t *> objects;
592 QVector<const char *> varnames;
593 audio_output_t *p_aout;
594 input_thread_t *p_input;
596 if( current->isEmpty() )
598 addActionWithSubmenu( current, "audio-es", qtr( "Audio &Track" ) );
599 addActionWithSubmenu( current, "audio-channels", qtr( "Audio &Channels" ) );
600 addActionWithSubmenu( current, "audio-device", qtr( "Audio &Device" ) );
601 current->addSeparator();
603 addActionWithSubmenu( current, "visual", qtr( "&Visualizations" ) );
604 VolumeEntries( p_intf, current );
607 p_input = THEMIM->getInput();
608 p_aout = THEMIM->getAout();
609 EnableStaticEntries( current, ( p_aout != NULL ) );
610 AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
613 vlc_object_release( p_aout );
616 return Populate( p_intf, current, varnames, objects );
620 QMenu *VLCMenuBar::SubtitleMenu( QMenu *current )
623 QMenu *submenu = new QMenu( qtr( "&Subtitles Track" ), current );
624 action = current->addMenu( submenu );
625 action->setData( "spu-es" );
626 addDPStaticEntry( submenu, qtr( "Open File..." ), "",
627 SLOT( loadSubtitlesFile() ) );
628 submenu->addSeparator();
634 * Subtitles are part of Video.
636 QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtitle )
638 vout_thread_t *p_vout;
639 input_thread_t *p_input;
640 QVector<vlc_object_t *> objects;
641 QVector<const char *> varnames;
643 if( current->isEmpty() )
645 addActionWithSubmenu( current, "video-es", qtr( "Video &Track" ) );
647 SubtitleMenu( current );
649 current->addSeparator();
650 /* Surface modifiers */
651 addActionWithCheckbox( current, "fullscreen", qtr( "&Fullscreen" ) );
652 addActionWithCheckbox( current, "autoscale", qtr( "Always Fit &Window" ) );
653 addActionWithCheckbox( current, "video-on-top", qtr( "Always &on Top" ) );
654 addActionWithCheckbox( current, "video-wallpaper", qtr( "Set as Wall&paper" ) );
656 current->addSeparator();
658 addActionWithSubmenu( current, "zoom", qtr( "&Zoom" ) );
659 addActionWithSubmenu( current, "aspect-ratio", qtr( "&Aspect Ratio" ) );
660 addActionWithSubmenu( current, "crop", qtr( "&Crop" ) );
662 current->addSeparator();
663 /* Rendering modifiers */
664 addActionWithSubmenu( current, "deinterlace", qtr( "&Deinterlace" ) );
665 addActionWithSubmenu( current, "deinterlace-mode", qtr( "&Deinterlace mode" ) );
666 addActionWithSubmenu( current, "postprocess", qtr( "&Post processing" ) );
668 current->addSeparator();
670 addAction( current, "video-snapshot", qtr( "Take &Snapshot" ) );
673 p_input = THEMIM->getInput();
675 p_vout = THEMIM->getVout();
676 VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
679 vlc_object_release( p_vout );
681 return Populate( p_intf, current, varnames, objects );
686 * For DVD, MP4, MOV and other chapter based format
688 QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
693 addActionWithSubmenu( menu, "title", qtr( "T&itle" ) );
694 addActionWithSubmenu( menu, "chapter", qtr( "&Chapter" ) );
695 submenu = addActionWithSubmenu( menu, "navigation", qtr( "&Navigation" ) );
696 submenu->setTearOffEnabled( true );
697 addActionWithSubmenu( menu, "program", qtr( "&Program" ) );
699 /* FixMe: sync I_MENU_BOOKMARK string */
700 submenu = new QMenu( qtr( "Custom &Bookmarks" ), menu );
701 submenu->setTearOffEnabled( true );
702 addDPStaticEntry( submenu, qtr( "&Manage" ), "",
703 SLOT( bookmarksDialog() ), "Ctrl+B" );
704 submenu->addSeparator();
705 action = menu->addMenu( submenu );
706 action->setData( "bookmark" );
708 menu->addSeparator();
710 PopupMenuControlEntries( menu, p_intf );
712 EnableStaticEntries( menu, ( THEMIM->getInput() != NULL ) );
713 return RebuildNavigMenu( p_intf, menu, true );
716 QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu, bool b_keep )
719 input_thread_t *p_object;
720 QVector<vlc_object_t *> objects;
721 QVector<const char *> varnames;
723 /* Get the input and hold it */
724 p_object = THEMIM->getInput();
726 InputAutoMenuBuilder( p_object, objects, varnames );
728 /* Title and so on */
729 PUSH_VAR( "prev-title" );
730 PUSH_VAR( "next-title" );
731 PUSH_VAR( "prev-chapter" );
732 PUSH_VAR( "next-chapter" );
735 EnableStaticEntries( menu, (p_object != NULL ) );
736 Populate( p_intf, menu, varnames, objects );
738 /* Remove playback actions to recreate them */
741 QList< QAction* > actions = menu->actions();
742 for( int i = 0; i < actions.count(); i++ )
743 if( actions[i]->data().toInt() & ACTION_DELETE_ON_REBUILD )
747 PopupMenuPlaylistEntries( menu, p_intf, p_object );
755 QMenu *VLCMenuBar::HelpMenu( QWidget *parent )
757 QMenu *menu = new QMenu( parent );
758 addDPStaticEntry( menu, qtr( "&Help..." ) ,
759 ":/menu/help", SLOT( helpDialog() ), "F1" );
761 addDPStaticEntry( menu, qtr( "Check for &Updates..." ) , "",
762 SLOT( updateDialog() ) );
764 menu->addSeparator();
765 addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), ":/menu/info",
766 SLOT( aboutDialog() ), "Shift+F1", QAction::AboutRole );
770 /*****************************************************************************
771 * Popup menus - Right Click menus *
772 *****************************************************************************/
773 #define POPUP_BOILERPLATE \
774 static QMenu* menu = NULL; \
775 delete menu; menu = NULL; \
778 QVector<vlc_object_t *> objects; \
779 QVector<const char *> varnames; \
780 input_thread_t *p_input = THEMIM->getInput();
782 #define CREATE_POPUP \
783 menu = new QMenu(); \
784 Populate( p_intf, menu, varnames, objects ); \
785 menu->popup( QCursor::pos() ); \
787 void VLCMenuBar::PopupMenuPlaylistEntries( QMenu *menu,
788 intf_thread_t *p_intf,
789 input_thread_t *p_input )
793 /* Play or Pause action and icon */
794 if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S )
796 action = menu->addAction( qtr( "&Play" ),
797 ActionsManager::getInstance( p_intf ), SLOT( play() ) );
798 #ifndef __APPLE__ /* No icons in menus in Mac */
799 action->setIcon( QIcon( ":/menu/play" ) );
804 action = addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
805 ":/menu/pause", SLOT( togglePlayPause() ) );
807 action->setData( ACTION_DELETE_ON_REBUILD );
810 action = addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ),
811 ":/menu/stop", SLOT( stop() ), true );
813 action->setEnabled( false );
814 action->setData( ACTION_DELETE_ON_REBUILD );
816 /* Next / Previous */
817 bool bPlaylistEmpty = THEMIM->hasEmptyPlaylist();
818 action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
819 ":/menu/previous", SLOT( prev() ), true );
820 action->setEnabled( !bPlaylistEmpty );
821 action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
822 CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
824 action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
825 ":/menu/next", SLOT( next() ), true );
826 action->setEnabled( !bPlaylistEmpty );
827 action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
828 CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
830 menu->addSeparator();
833 void VLCMenuBar::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
837 QMenu *rateMenu = new QMenu( qtr( "Sp&eed" ), menu );
838 rateMenu->setTearOffEnabled( true );
843 action = rateMenu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
845 #ifndef __APPLE__ /* No icons in menus in Mac */
846 action->setIcon( QIcon( ":/toolbar/faster2") );
848 action->setData( ACTION_STATIC );
851 action = rateMenu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
852 SLOT( littlefaster() ) );
853 action->setData( ACTION_STATIC );
855 action = rateMenu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(),
856 SLOT( normalRate() ) );
857 action->setData( ACTION_STATIC );
859 action = rateMenu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(),
860 SLOT( littleslower() ) );
861 action->setData( ACTION_STATIC );
865 action = rateMenu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
867 #ifndef __APPLE__ /* No icons in menus in Mac */
868 action->setIcon( QIcon( ":/toolbar/slower2") );
870 action->setData( ACTION_STATIC );
873 action = menu->addMenu( rateMenu );
874 action->setData( ACTION_STATIC );
876 menu->addSeparator();
878 if( !b_normal ) return;
880 action = menu->addAction( qtr( "&Jump Forward" ), THEMIM->getIM(),
882 #ifndef __APPLE__ /* No icons in menus in Mac */
883 action->setIcon( QIcon( ":/toolbar/skip_fw") );
885 action->setData( ACTION_STATIC );
887 action = menu->addAction( qtr( "Jump Bac&kward" ), THEMIM->getIM(),
889 #ifndef __APPLE__ /* No icons in menus in Mac */
890 action->setIcon( QIcon( ":/toolbar/skip_back") );
892 action->setData( ACTION_STATIC );
894 action = menu->addAction( qtr( I_MENU_GOTOTIME ), THEDP, SLOT( gotoTimeDialog() ), qtr( "Ctrl+T" ) );
895 action->setData( ACTION_ALWAYS_ENABLED );
897 menu->addSeparator();
900 void VLCMenuBar::PopupMenuStaticEntries( QMenu *menu )
902 QMenu *openmenu = new QMenu( qtr( "Open Media" ), menu );
903 addDPStaticEntry( openmenu, qtr( "&Open File..." ),
904 ":/type/file-asym", SLOT( openFileDialog() ) );
905 addDPStaticEntry( openmenu, qtr( I_OP_OPDIR ),
906 ":/type/folder-grey", SLOT( PLOpenDir() ) );
907 addDPStaticEntry( openmenu, qtr( "Open &Disc..." ),
908 ":/type/disc", SLOT( openDiscDialog() ) );
909 addDPStaticEntry( openmenu, qtr( "Open &Network..." ),
910 ":/type/network", SLOT( openNetDialog() ) );
911 addDPStaticEntry( openmenu, qtr( "Open &Capture Device..." ),
912 ":/type/capture-card", SLOT( openCaptureDialog() ) );
913 menu->addMenu( openmenu );
915 menu->addSeparator();
917 QMenu *helpmenu = HelpMenu( menu );
918 helpmenu->setTitle( qtr( "Help" ) );
919 menu->addMenu( helpmenu );
922 addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/quit",
923 SLOT( quit() ), "Ctrl+Q", QAction::QuitRole );
926 /* Video Tracks and Subtitles tracks */
927 void VLCMenuBar::VideoPopupMenu( intf_thread_t *p_intf, bool show )
932 vout_thread_t *p_vout = THEMIM->getVout();
935 VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
936 vlc_object_release( p_vout );
943 void VLCMenuBar::AudioPopupMenu( intf_thread_t *p_intf, bool show )
948 audio_output_t *p_aout = THEMIM->getAout();
949 AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
951 vlc_object_release( p_aout );
956 /* Navigation stuff, and general menus ( open ), used only for skins */
957 void VLCMenuBar::MiscPopupMenu( intf_thread_t *p_intf, bool show )
964 varnames.append( "audio-es" );
965 InputAutoMenuBuilder( p_input, objects, varnames );
966 menu->addSeparator();
969 Populate( p_intf, menu, varnames, objects );
971 menu->addSeparator();
972 PopupMenuPlaylistEntries( menu, p_intf, p_input );
974 menu->addSeparator();
975 PopupMenuControlEntries( menu, p_intf );
977 menu->addSeparator();
978 PopupMenuStaticEntries( menu );
980 menu->popup( QCursor::pos() );
983 /* Main Menu that sticks everything together */
984 void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
991 bool b_isFullscreen = false;
992 MainInterface *mi = p_intf->p_sys->p_mi;
994 PopupMenuPlaylistEntries( menu, p_intf, p_input );
995 menu->addSeparator();
1000 vout_thread_t *p_vout = THEMIM->getVout();
1002 /* Add a fullscreen switch button, since it is the most used function */
1005 vlc_value_t val; var_Get( p_vout, "fullscreen", &val );
1007 b_isFullscreen = !( !val.b_bool );
1008 if( b_isFullscreen )
1011 CreateAndConnect( menu, "fullscreen",
1012 qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL,
1013 VLC_OBJECT(p_vout), val, VLC_VAR_BOOL, b_isFullscreen );
1015 vlc_object_release( p_vout );
1017 menu->addSeparator();
1021 InputAutoMenuBuilder( p_input, objects, varnames );
1024 submenu = new QMenu( menu );
1025 action = menu->addMenu( AudioMenu( p_intf, submenu ) );
1026 action->setText( qtr( "&Audio" ) );
1027 if( action->menu()->isEmpty() )
1028 action->setEnabled( false );
1031 submenu = new QMenu( menu );
1032 action = menu->addMenu( VideoMenu( p_intf, submenu, false ) );
1033 action->setText( qtr( "&Video" ) );
1034 if( action->menu()->isEmpty() )
1035 action->setEnabled( false );
1037 submenu = SubtitleMenu( menu );
1038 submenu->setTitle( qtr( "Subti&tle") );
1039 UpdateItem( p_intf, menu, "spu-es", VLC_OBJECT(p_input), true );
1041 /* Playback menu for chapters */
1042 submenu = new QMenu( menu );
1043 action = menu->addMenu( NavigMenu( p_intf, submenu ) );
1044 action->setText( qtr( "&Playback" ) );
1045 if( action->menu()->isEmpty() )
1046 action->setEnabled( false );
1049 menu->addSeparator();
1051 /* Add some special entries for windowed mode: Interface Menu */
1052 if( !b_isFullscreen )
1054 QMenu *submenu = new QMenu( qtr( "Tools" ), menu );
1055 /*QMenu *tools =*/ ToolsMenu( submenu );
1056 submenu->addSeparator();
1058 /* In skins interface, append some items */
1061 submenu->setTitle( qtr( "Interface" ) );
1062 if( p_intf->p_sys->b_isDialogProvider )
1064 vlc_object_t* p_object = p_intf->p_parent;
1066 objects.clear(); varnames.clear();
1067 objects.append( p_object );
1068 varnames.append( "intf-skins" );
1069 Populate( p_intf, submenu, varnames, objects );
1071 objects.clear(); varnames.clear();
1072 objects.append( p_object );
1073 varnames.append( "intf-skins-interactive" );
1074 Populate( p_intf, submenu, varnames, objects );
1077 msg_Warn( p_intf, "could not find parent interface" );
1081 QMenu *bar = menu; // Needed for next macro
1082 BAR_DADD( ViewMenu( p_intf, NULL, mi ), qtr( "V&iew" ), 4 );
1085 menu->addMenu( submenu );
1089 QMenuView *plMenu = new QMenuView( menu, 25 );
1090 plMenu->setTitle( qtr("Playlist") );
1091 PLModel *model = PLModel::getPLModel( p_intf );
1092 plMenu->setModel( model );
1093 CONNECT( plMenu, activated(const QModelIndex&),
1094 model, activateItem(const QModelIndex&));
1095 menu->addMenu( plMenu );
1097 /* Static entries for ending, like open */
1098 PopupMenuStaticEntries( menu );
1100 menu->popup( QCursor::pos() );
1104 #undef POPUP_BOILERPLATE
1107 /************************************************************************
1109 ************************************************************************/
1111 void VLCMenuBar::updateSystrayMenu( MainInterface *mi,
1112 intf_thread_t *p_intf,
1113 bool b_force_visible )
1115 input_thread_t *p_input = THEMIM->getInput();
1117 /* Get the systray menu and clean it */
1118 QMenu *sysMenu = mi->getSysTrayMenu();
1122 /* Hide / Show VLC and cone */
1123 if( mi->isVisible() || b_force_visible )
1125 sysMenu->addAction( QIcon( ":/logo/vlc16.png" ),
1126 qtr( "&Hide VLC media player in taskbar" ), mi,
1127 SLOT( hideUpdateSystrayMenu() ) );
1131 sysMenu->addAction( QIcon( ":/logo/vlc16.png" ),
1132 qtr( "Sho&w VLC media player" ), mi,
1133 SLOT( showUpdateSystrayMenu() ) );
1135 sysMenu->addSeparator();
1138 PopupMenuPlaylistEntries( sysMenu, p_intf, p_input );
1139 PopupMenuControlEntries( sysMenu, p_intf, false );
1141 VolumeEntries( p_intf, sysMenu );
1142 sysMenu->addSeparator();
1143 addDPStaticEntry( sysMenu, qtr( "&Open Media" ),
1144 ":/type/file-wide", SLOT( openFileDialog() ) );
1145 addDPStaticEntry( sysMenu, qtr( "&Quit" ) ,
1146 ":/menu/quit", SLOT( quit() ) );
1149 mi->getSysTray()->setContextMenu( sysMenu );
1155 /*************************************************************************
1156 * Builders for automenus
1157 *************************************************************************/
1158 QMenu * VLCMenuBar::Populate( intf_thread_t *p_intf,
1160 QVector< const char *> & varnames,
1161 QVector<vlc_object_t *> & objects )
1163 QMenu *menu = current;
1166 currentGroup = NULL;
1168 for( int i = 0; i < (int)objects.count() ; i++ )
1170 if( !varnames[i] || !*varnames[i] )
1172 menu->addSeparator();
1176 UpdateItem( p_intf, menu, varnames[i], objects[i], true );
1181 /*****************************************************************************
1183 *****************************************************************************/
1185 static bool IsMenuEmpty( const char *psz_var,
1186 vlc_object_t *p_object,
1187 bool b_root = true )
1189 vlc_value_t val, val_list;
1190 int i_type, i_result, i;
1192 /* Check the type of the object variable */
1193 i_type = var_Type( p_object, psz_var );
1195 /* Check if we want to display the variable */
1196 if( !( i_type & VLC_VAR_HASCHOICE ) ) return false;
1198 var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
1199 if( val.i_int == 0 ) return true;
1201 if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE )
1203 if( val.i_int == 1 && b_root ) return true;
1207 /* Check children variables in case of VLC_VAR_VARIABLE */
1208 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
1213 for( i = 0, i_result = true; i < val_list.p_list->i_count; i++ )
1215 if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
1223 /* clean up everything */
1224 var_FreeList( &val_list, NULL );
1229 #define TEXT_OR_VAR qfu ( text.psz_string ? text.psz_string : psz_var )
1231 void VLCMenuBar::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
1232 const char *psz_var, vlc_object_t *p_object, bool b_submenu )
1234 vlc_value_t val, text;
1237 QAction *action = FindActionWithVar( menu, psz_var );
1239 DeleteNonStaticEntries( action->menu() );
1244 action->setEnabled( false );
1248 /* Check the type of the object variable */
1249 /* This HACK is needed so we have a radio button for audio and video tracks
1250 instread of a checkbox */
1251 if( !strcmp( psz_var, "audio-es" )
1252 || !strcmp( psz_var, "video-es" ) )
1253 i_type = VLC_VAR_INTEGER | VLC_VAR_HASCHOICE;
1255 i_type = var_Type( p_object, psz_var );
1257 switch( i_type & VLC_VAR_TYPE )
1261 case VLC_VAR_VARIABLE:
1262 case VLC_VAR_STRING:
1263 case VLC_VAR_INTEGER:
1267 /* Variable doesn't exist or isn't handled */
1269 action->setEnabled( false );
1273 /* Make sure we want to display the variable */
1274 if( menu->isEmpty() && IsMenuEmpty( psz_var, p_object ) )
1277 action->setEnabled( false );
1281 /* Get the descriptive name of the variable */
1282 int i_ret = var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
1283 if( i_ret != VLC_SUCCESS )
1285 text.psz_string = NULL;
1290 action = new QAction( TEXT_OR_VAR, menu );
1291 menu->addAction( action );
1292 action->setData( psz_var );
1295 /* Some specific stuff */
1296 bool forceDisabled = false;
1297 if( !strcmp( psz_var, "spu-es" ) )
1299 vout_thread_t *p_vout = THEMIM->getVout();
1300 forceDisabled = ( p_vout == NULL );
1302 vlc_object_release( p_vout );
1305 if( i_type & VLC_VAR_HASCHOICE )
1307 /* Append choices menu */
1311 submenu = action->menu();
1314 submenu = new QMenu( menu );
1315 action->setMenu( submenu );
1319 CreateChoicesMenu( submenu, psz_var, p_object, true ) == 0 );
1321 action->setEnabled( false );
1326 CreateChoicesMenu( menu, psz_var, p_object, true ) == 0 );
1328 FREENULL( text.psz_string );
1332 switch( i_type & VLC_VAR_TYPE )
1335 val.i_int = 0; // Prevent the copy of an uninitialized value
1336 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
1337 p_object, val, i_type );
1341 var_Get( p_object, psz_var, &val );
1342 val.b_bool = !val.b_bool;
1343 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
1344 p_object, val, i_type, !val.b_bool );
1347 FREENULL( text.psz_string );
1352 /** HACK for the navigation submenu:
1353 * "title %2i" variables take the value 0 if not set
1355 static bool CheckTitle( vlc_object_t *p_object, const char *psz_var )
1358 if( sscanf( psz_var, "title %2i", &i_title ) <= 0 )
1361 int i_current_title = var_GetInteger( p_object, "title" );
1362 return ( i_title == i_current_title );
1366 int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
1367 vlc_object_t *p_object, bool b_root )
1369 vlc_value_t val, val_list, text_list;
1372 /* Check the type of the object variable */
1373 i_type = var_Type( p_object, psz_var );
1375 /* Make sure we want to display the variable */
1376 if( submenu->isEmpty() && IsMenuEmpty( psz_var, p_object, b_root ) )
1377 return VLC_EGENERIC;
1379 switch( i_type & VLC_VAR_TYPE )
1383 case VLC_VAR_VARIABLE:
1384 case VLC_VAR_STRING:
1385 case VLC_VAR_INTEGER:
1389 /* Variable doesn't exist or isn't handled */
1390 return VLC_EGENERIC;
1393 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
1394 &val_list, &text_list ) < 0 )
1396 return VLC_EGENERIC;
1399 #define CURVAL val_list.p_list->p_values[i]
1400 #define CURTEXT text_list.p_list->p_values[i].psz_string
1401 #define RADIO_OR_COMMAND ( i_type & ( VLC_VAR_ISCOMMAND | VLC_VAR_HASCHOICE ) ) ? ITEM_RADIO : ITEM_NORMAL
1403 for( i = 0; i < val_list.p_list->i_count; i++ )
1405 vlc_value_t another_val;
1407 QMenu *subsubmenu = new QMenu( submenu );
1409 switch( i_type & VLC_VAR_TYPE )
1411 case VLC_VAR_VARIABLE:
1412 CreateChoicesMenu( subsubmenu, CURVAL.psz_string, p_object, false );
1413 subsubmenu->setTitle( qfu( CURTEXT ? CURTEXT :CURVAL.psz_string ) );
1414 submenu->addMenu( subsubmenu );
1417 case VLC_VAR_STRING:
1418 var_Get( p_object, psz_var, &val );
1419 another_val.psz_string = strdup( CURVAL.psz_string );
1420 menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
1421 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
1422 p_object, another_val, i_type,
1423 val.psz_string && !strcmp( val.psz_string, CURVAL.psz_string ) );
1425 free( val.psz_string );
1428 case VLC_VAR_INTEGER:
1429 var_Get( p_object, psz_var, &val );
1430 if( CURTEXT ) menutext = qfu( CURTEXT );
1431 else menutext = QString::number( CURVAL.i_int );
1432 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
1433 p_object, CURVAL, i_type,
1434 ( CURVAL.i_int == val.i_int )
1435 && CheckTitle( p_object, psz_var ) );
1439 var_Get( p_object, psz_var, &val );
1440 if( CURTEXT ) menutext = qfu( CURTEXT );
1441 else menutext.sprintf( "%.2f", CURVAL.f_float );
1442 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
1443 p_object, CURVAL, i_type,
1444 CURVAL.f_float == val.f_float );
1451 currentGroup = NULL;
1453 /* clean up everything */
1454 var_FreeList( &val_list, &text_list );
1456 #undef RADIO_OR_COMMAND
1459 return submenu->isEmpty() ? VLC_EGENERIC : VLC_SUCCESS;
1462 void VLCMenuBar::CreateAndConnect( QMenu *menu, const char *psz_var,
1463 const QString& text, const QString& help,
1464 int i_item_type, vlc_object_t *p_obj,
1465 vlc_value_t val, int i_val_type,
1468 QAction *action = FindActionWithVar( menu, psz_var );
1473 action = new QAction( text, menu );
1474 menu->addAction( action );
1478 action->setToolTip( help );
1479 action->setEnabled( p_obj != NULL );
1481 if( i_item_type == ITEM_CHECK )
1483 action->setCheckable( true );
1485 else if( i_item_type == ITEM_RADIO )
1487 action->setCheckable( true );
1489 currentGroup = new QActionGroup( menu );
1490 currentGroup->addAction( action );
1493 action->setChecked( checked );
1495 MenuItemData *itemData = qFindChild<MenuItemData*>( action, QString() );
1497 itemData = new MenuItemData( action, p_obj, i_val_type, val, psz_var );
1499 /* remove previous signal-slot connection(s) if any */
1500 action->disconnect( );
1502 CONNECT( action, triggered(), THEDP->menusMapper, map() );
1503 THEDP->menusMapper->setMapping( action, itemData );
1506 menu->addAction( action );
1509 void VLCMenuBar::DoAction( QObject *data )
1511 MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
1512 vlc_object_t *p_object = itemData->p_obj;
1513 if( p_object == NULL ) return;
1515 /* Preserve settings across vouts via the playlist object: */
1516 if( !strcmp( itemData->psz_var, "fullscreen" )
1517 || !strcmp( itemData->psz_var, "video-on-top" ) )
1518 var_Set( pl_Get( p_object ), itemData->psz_var, itemData->val );
1520 var_Set( p_object, itemData->psz_var, itemData->val );
1523 void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
1528 RecentsMRL* rmrl = RecentsMRL::getInstance( p_intf );
1529 QStringList l = rmrl->recents();
1531 recentsMenu->clear();
1535 recentsMenu->setEnabled( false );
1539 for( int i = 0; i < l.count(); ++i )
1541 QString mrl = l.at( i );
1542 char *psz = decode_URI_duplicate( qtu( mrl ) );
1543 QString text = qfu( psz );
1546 action = recentsMenu->addAction(
1547 QString( i < 9 ? "&%1: ": "%1: " ).arg( i + 1 ) +
1548 QApplication::fontMetrics().elidedText( text,
1549 Qt::ElideLeft, 400 ),
1550 rmrl->signalMapper, SLOT( map() ),
1551 i < 9 ? QString( "Ctrl+%1" ).arg( i + 1 ) : "" );
1552 rmrl->signalMapper->setMapping( action, l.at( i ) );
1555 recentsMenu->addSeparator();
1556 recentsMenu->addAction( qtr("&Clear"), rmrl, SLOT( clear() ) );
1557 recentsMenu->setEnabled( true );