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 */
56 #include <QActionGroup>
57 #include <QSignalMapper>
58 #include <QSystemTrayIcon>
60 #include <QFontMetrics>
63 This file defines the main menus and the pop-up menu (right-click menu)
64 and the systray menu (in that order in the file)
66 There are 4 menus that have to be rebuilt everytime there are called:
67 Audio, Video, Navigation, view
68 4 functions are building those menus: AudioMenu, VideoMenu, NavigMenu, View
69 and 3 functions associated are collecting the objects :
70 InputAutoMenuBuilder, AudioAutoMenuBuilder, VideoAutoMenuBuilder.
72 A QSignalMapper decides when to rebuild those menus cf MenuFunc in the .hpp
73 Just before one of those menus are aboutToShow(), they are rebuild.
78 ITEM_NORMAL, /* not a checkbox, nor a radio */
79 ITEM_CHECK, /* Checkbox */
80 ITEM_RADIO /* Radiobox */
83 static QActionGroup *currentGroup;
85 QMenu *VLCMenuBar::recentsMenu = NULL;
88 * @brief Add static entries to DP in menus
90 QAction *addDPStaticEntry( QMenu *menu,
94 const char *shortcut = NULL,
95 QAction::MenuRole = QAction::NoRole
98 QAction *action = NULL;
99 #ifndef __APPLE__ /* We don't set icons in menus in MacOS X */
100 if( !EMPTY_STR( icon ) )
102 if( !EMPTY_STR( shortcut ) )
103 action = menu->addAction( QIcon( icon ), text, THEDP,
104 member, qtr( shortcut ) );
106 action = menu->addAction( QIcon( icon ), text, THEDP, member );
111 if( !EMPTY_STR( shortcut ) )
112 action = menu->addAction( text, THEDP, member, qtr( shortcut ) );
114 action = menu->addAction( text, THEDP, member );
116 action->setData( VLCMenuBar::ACTION_STATIC );
121 * @brief Add static entries to MIM in menus
123 QAction* addMIMStaticEntry( intf_thread_t *p_intf,
128 bool bStatic = false )
131 #ifndef __APPLE__ /* We don't set icons in menus in MacOS X */
132 if( !EMPTY_STR( icon ) )
134 action = menu->addAction( text, THEMIM, member );
135 action->setIcon( QIcon( icon ) );
140 action = menu->addAction( text, THEMIM, member );
142 action->setData( VLCMenuBar::ACTION_STATIC |
143 ( bStatic ) ? VLCMenuBar::ACTION_ALWAYS_ENABLED
144 : VLCMenuBar::ACTION_NONE
150 * @brief Enable all static entries of a menu, disable the others
151 * @param menu the menu in which the entries will be disabled
152 * @param enable if false, disable all entries
154 void VLCMenuBar::EnableStaticEntries( QMenu *menu, bool enable = true )
158 QList< QAction* > actions = menu->actions();
159 for( int i = 0; i < actions.count(); ++i )
161 int actionflags = actions[i]->data().toInt();
162 if ( actionflags & ACTION_MANAGED )
163 actions[i]->setEnabled(
164 ( actionflags & ACTION_ALWAYS_ENABLED )
172 * \return Number of static entries
174 inline int DeleteNonStaticEntries( QMenu *menu )
176 if( !menu ) return VLC_EGENERIC;
180 QList< QAction* > actions = menu->actions();
181 for( int i = 0; i < actions.count(); ++i )
183 if( actions[i]->data().toInt() & VLCMenuBar::ACTION_NO_CLEANUP )
192 * \return QAction associated to psz_var variable
194 static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
196 QList< QAction* > actions = menu->actions();
197 for( int i = 0; i < actions.count(); ++i )
199 if( actions[i]->data().toString() == psz_var )
205 /*****************************************************************************
206 * Definitions of variables for the dynamic menus
207 *****************************************************************************/
208 #define PUSH_VAR( var ) varnames.append( var ); \
209 objects.append( VLC_OBJECT(p_object) )
211 #define PUSH_INPUTVAR( var ) varnames.append( var ); \
212 objects.append( VLC_OBJECT(p_input) );
214 static int InputAutoMenuBuilder( input_thread_t *p_object,
215 QVector<vlc_object_t *> &objects,
216 QVector<const char *> &varnames )
218 PUSH_VAR( "bookmark" );
220 PUSH_VAR( "chapter" );
221 PUSH_VAR( "navigation" );
222 PUSH_VAR( "program" );
226 static int VideoAutoMenuBuilder( vout_thread_t *p_object,
227 input_thread_t *p_input,
228 QVector<vlc_object_t *> &objects,
229 QVector<const char *> &varnames )
231 PUSH_INPUTVAR( "video-es" );
232 PUSH_INPUTVAR( "spu-es" );
233 PUSH_VAR( "fullscreen" );
234 PUSH_VAR( "video-on-top" );
235 PUSH_VAR( "video-wallpaper" );
236 PUSH_VAR( "video-snapshot" );
238 PUSH_VAR( "autoscale" );
239 PUSH_VAR( "aspect-ratio" );
241 PUSH_VAR( "deinterlace" );
242 PUSH_VAR( "deinterlace-mode" );
243 PUSH_VAR( "postprocess" );
248 static int AudioAutoMenuBuilder( audio_output_t *p_object,
249 input_thread_t *p_input,
250 QVector<vlc_object_t *> &objects,
251 QVector<const char *> &varnames )
253 PUSH_INPUTVAR( "audio-es" );
254 PUSH_VAR( "audio-channels" );
255 PUSH_VAR( "audio-device" );
256 PUSH_VAR( "visual" );
260 /*****************************************************************************
263 *****************************************************************************/
266 static inline void addMenuToMainbar( QMenu *func, QString title, QMenuBar *bar ) {
267 func->setTitle( title );
272 #define BAR_DADD( func, title, id ) { \
273 QMenu *_menu = func; _menu->setTitle( title ); bar->addMenu( _menu ); \
274 MenuFunc *f = new MenuFunc( _menu, id ); \
275 CONNECT( _menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
276 THEDP->menusUpdateMapper->setMapping( _menu, f ); }
278 // Add a simple action
279 static inline void addAction( QMenu *_menu, QVariant val, QString title ) {
280 QAction *_action = new QAction( title, _menu );
281 _action->setData( val );
282 _menu->addAction( _action );
285 // Add an action with a submenu
286 static inline QMenu *addActionWithSubmenu( QMenu *_menu, QVariant val, QString title ) {
287 QAction *_action = new QAction( title, _menu );
288 QMenu *_submenu = new QMenu( _menu );
289 _action->setData( val );
290 _action->setMenu( _submenu );
291 _menu->addAction( _action );
295 // Add an action that is a checkbox
296 static inline void addActionWithCheckbox( QMenu *_menu, QVariant val, QString title ) {
297 QAction *_action = new QAction( title, _menu );
298 _action->setData( val );
299 _action->setCheckable( true );
300 _menu->addAction( _action );
304 * Main Menu Bar Creation
306 void VLCMenuBar::createMenuBar( MainInterface *mi,
307 intf_thread_t *p_intf )
309 /* QMainWindows->menuBar()
310 gives the QProcess::destroyed timeout issue on Cleanlooks style with
311 setDesktopAware set to false */
312 QMenuBar *bar = mi->menuBar();
314 addMenuToMainbar( FileMenu( p_intf, bar, mi ), qtr( "&Media" ), bar );
316 /* Dynamic menus, rebuilt before being showed */
317 BAR_DADD( NavigMenu( p_intf, bar ), qtr( "P&layback" ), 3 );
318 BAR_DADD( AudioMenu( p_intf, bar ), qtr( "&Audio" ), 1 );
319 BAR_DADD( VideoMenu( p_intf, bar ), qtr( "&Video" ), 2 );
321 addMenuToMainbar( ToolsMenu( bar ), qtr( "&Tools" ), bar );
323 /* View menu, a bit different */
324 BAR_DADD( ViewMenu( p_intf, NULL, mi ), qtr( "V&iew" ), 4 );
326 addMenuToMainbar( HelpMenu( bar ), qtr( "&Help" ), bar );
331 * Media ( File ) Menu
332 * Opening, streaming and quit
334 QMenu *VLCMenuBar::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterface *mi )
336 QMenu *menu = new QMenu( parent );
339 addDPStaticEntry( menu, qtr( "Open &File..." ),
340 ":/type/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" );
341 addDPStaticEntry( menu, qtr( I_OP_OPDIR ),
342 ":/type/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" );
343 addDPStaticEntry( menu, qtr( "Open &Disc..." ),
344 ":/type/disc", SLOT( openDiscDialog() ), "Ctrl+D" );
345 addDPStaticEntry( menu, qtr( "Open &Network Stream..." ),
346 ":/type/network", SLOT( openNetDialog() ), "Ctrl+N" );
347 addDPStaticEntry( menu, qtr( "Open &Capture Device..." ),
348 ":/type/capture-card", SLOT( openCaptureDialog() ), "Ctrl+C" );
350 menu->addSeparator();
352 addDPStaticEntry( menu, qtr( "&Open (advanced)..." ),
353 ":/type/file-asym", SLOT( openFileDialog() ), "Ctrl+Shift+O" );
354 menu->addSeparator();
356 addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ),
357 NULL, SLOT( openUrlDialog() ), "Ctrl+V" );
359 if( var_InheritBool( p_intf, "qt-recentplay" ) )
361 recentsMenu = new QMenu( qtr( "Open &Recent Media" ), menu );
362 updateRecents( p_intf );
363 menu->addMenu( recentsMenu );
365 menu->addSeparator();
367 addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", SLOT( saveAPlaylist() ),
369 menu->addSeparator();
372 addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "",
373 SLOT( openAndTranscodingDialogs() ), "Ctrl+R" );
374 addDPStaticEntry( menu, qtr( "&Stream..." ),
375 ":/menu/stream", SLOT( openAndStreamingDialogs() ), "Ctrl+S" );
376 menu->addSeparator();
379 action = addMIMStaticEntry( p_intf, menu, qtr( "Quit at the end of playlist" ), "",
380 SLOT( activatePlayQuit( bool ) ) );
381 action->setCheckable( true );
382 action->setChecked( THEMIM->getPlayExitState() );
384 if( mi->getSysTray() )
386 action = menu->addAction( qtr( "Close to systray"), mi,
387 SLOT( toggleUpdateSystrayMenu() ) );
390 addDPStaticEntry( menu, qtr( "&Quit" ) ,
391 ":/menu/quit", SLOT( quit() ), "Ctrl+Q" );
396 * Tools, like Media Information, Preferences or Messages
398 QMenu *VLCMenuBar::ToolsMenu( QMenu *menu )
400 addDPStaticEntry( menu, qtr( "&Effects and Filters"), ":/menu/settings",
401 SLOT( extendedDialog() ), "Ctrl+E" );
403 addDPStaticEntry( menu, qtr( "&Track Synchronization"), ":/menu/settings",
404 SLOT( synchroDialog() ), "" );
406 addDPStaticEntry( menu, qtr( I_MENU_INFO ) , ":/menu/info",
407 SLOT( mediaInfoDialog() ), "Ctrl+I" );
408 addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) ,
409 ":/menu/info", SLOT( mediaCodecDialog() ), "Ctrl+J" );
412 addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", SLOT( vlmDialog() ),
416 addDPStaticEntry( menu, qtr( "Program Guide" ), "", SLOT( epgDialog() ),
419 addDPStaticEntry( menu, qtr( I_MENU_MSG ),
420 ":/menu/messages", SLOT( messagesDialog() ), "Ctrl+M" );
422 addDPStaticEntry( menu, qtr( "Plu&gins and extensions" ),
423 "", SLOT( pluginDialog() ) );
424 menu->addSeparator();
426 addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ),
427 ":/menu/preferences", SLOT( toolbarDialog() ) );
429 addDPStaticEntry( menu, qtr( "&Preferences" ),
430 ":/menu/preferences", SLOT( prefsDialog() ), "Ctrl+P", QAction::PreferencesRole );
437 * Interface modification, load other interfaces, activate Extensions
438 * \param current, set to NULL for menu creation, else for menu update
440 QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterface *_mi )
445 MainInterface *mi = _mi ? _mi : p_intf->p_sys->p_mi;
450 menu = new QMenu( qtr( "&View" ), mi );
456 //HACK menu->clear() does not delete submenus
457 QList<QAction*> actions = menu->actions();
458 foreach( QAction *a, actions )
460 QMenu *m = a->menu();
461 if( a->parent() == menu ) delete a;
462 else menu->removeAction( a );
463 if( m && m->parent() == menu ) delete m;
469 QIcon( ":/menu/playlist_menu" ),
471 qtr( "Play&list" ), mi,
472 SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) );
474 menu->addSeparator();
477 action = menu->addAction( qtr( "Mi&nimal Interface" ) );
478 action->setShortcut( qtr( "Ctrl+H" ) );
479 action->setCheckable( true );
480 action->setChecked( (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) );
482 CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) );
483 CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) );
485 /* FullScreen View */
486 action = menu->addAction( qtr( "&Fullscreen Interface" ), mi,
487 SLOT( toggleInterfaceFullScreen() ), QString( "F11" ) );
488 action->setCheckable( true );
489 action->setChecked( mi->isInterfaceFullScreen() );
490 CONNECT( mi, fullscreenInterfaceToggled( bool ),
491 action, setChecked( bool ) );
493 /* Advanced Controls */
494 action = menu->addAction( qtr( "&Advanced Controls" ), mi,
495 SLOT( toggleAdvancedButtons() ) );
496 action->setCheckable( true );
497 if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
498 action->setChecked( true );
500 /* Docked Playlist */
501 action = menu->addAction( qtr( "Docked Playlist" ) );
502 action->setCheckable( true );
503 action->setChecked( mi->isPlDocked() );
504 CONNECT( action, triggered( bool ), mi, dockPlaylist( bool ) );
506 action = menu->addAction( qtr( "Status Bar" ) );
507 action->setCheckable( true );
508 action->setChecked( mi->statusBar()->isVisible() );
509 CONNECT( action, triggered( bool ), mi, setStatusBarVisibility( bool) );
510 #if 0 /* For Visualisations. Not yet working */
511 adv = menu->addAction( qtr( "Visualizations selector" ), mi,
513 adv->setCheckable( true );
514 if( visual_selector_enabled ) adv->setChecked( true );
517 menu->addSeparator();
519 InterfacesMenu( p_intf, menu );
520 menu->addSeparator();
523 ExtensionsMenu( p_intf, menu );
529 * Interface Sub-Menu, to list extras interface and skins
531 QMenu *VLCMenuBar::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
533 QVector<vlc_object_t *> objects;
534 QVector<const char *> varnames;
535 varnames.append( "intf-add" );
536 objects.append( VLC_OBJECT(p_intf) );
538 return Populate( p_intf, current, varnames, objects );
542 * Extensions menu: populate the current menu with extensions
544 void VLCMenuBar::ExtensionsMenu( intf_thread_t *p_intf, QMenu *extMenu )
546 /* Get ExtensionsManager and load extensions if needed */
547 ExtensionsManager *extMgr = ExtensionsManager::getInstance( p_intf );
549 if( !var_InheritBool( p_intf, "qt-autoload-extensions")
550 && !extMgr->isLoaded() )
555 if( !extMgr->isLoaded() && !extMgr->cannotLoad() )
557 extMgr->loadExtensions();
560 /* Let the ExtensionsManager build itself the menu */
561 extMenu->addSeparator();
562 extMgr->menu( extMenu );
565 static inline void VolumeEntries( intf_thread_t *p_intf, QMenu *current )
567 current->addSeparator();
569 QAction *action = current->addAction( qtr( "Increase Volume" ),
570 ActionsManager::getInstance( p_intf ), SLOT( AudioUp() ) );
571 action->setData( VLCMenuBar::ACTION_STATIC );
572 action = current->addAction( qtr( "Decrease Volume" ),
573 ActionsManager::getInstance( p_intf ), SLOT( AudioDown() ) );
574 action->setData( VLCMenuBar::ACTION_STATIC );
575 action = current->addAction( qtr( "Mute" ),
576 ActionsManager::getInstance( p_intf ), SLOT( toggleMuteAudio() ) );
577 action->setData( VLCMenuBar::ACTION_STATIC );
583 QMenu *VLCMenuBar::AudioMenu( intf_thread_t *p_intf, QMenu * current )
585 QVector<vlc_object_t *> objects;
586 QVector<const char *> varnames;
587 audio_output_t *p_aout;
588 input_thread_t *p_input;
590 if( current->isEmpty() )
592 addActionWithSubmenu( current, "audio-es", qtr( "Audio &Track" ) );
593 addActionWithSubmenu( current, "audio-channels", qtr( "Audio &Channels" ) );
594 addActionWithSubmenu( current, "audio-device", qtr( "Audio &Device" ) );
595 current->addSeparator();
597 addActionWithSubmenu( current, "visual", qtr( "&Visualizations" ) );
598 VolumeEntries( p_intf, current );
601 p_input = THEMIM->getInput();
602 p_aout = THEMIM->getAout();
603 EnableStaticEntries( current, ( p_aout != NULL ) );
604 AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
607 vlc_object_release( p_aout );
610 return Populate( p_intf, current, varnames, objects );
614 QMenu *VLCMenuBar::SubtitleMenu( QMenu *current )
617 QMenu *submenu = new QMenu( qtr( "&Subtitles Track" ), current );
618 action = current->addMenu( submenu );
619 action->setData( "spu-es" );
620 addDPStaticEntry( submenu, qtr( "Open File..." ), "",
621 SLOT( loadSubtitlesFile() ) );
622 submenu->addSeparator();
628 * Subtitles are part of Video.
630 QMenu *VLCMenuBar::VideoMenu( intf_thread_t *p_intf, QMenu *current, bool b_subtitle )
632 vout_thread_t *p_vout;
633 input_thread_t *p_input;
634 QVector<vlc_object_t *> objects;
635 QVector<const char *> varnames;
637 if( current->isEmpty() )
639 addActionWithSubmenu( current, "video-es", qtr( "Video &Track" ) );
641 SubtitleMenu( current );
643 current->addSeparator();
644 /* Surface modifiers */
645 addActionWithCheckbox( current, "fullscreen", qtr( "&Fullscreen" ) );
646 addActionWithCheckbox( current, "autoscale", qtr( "Always Fit &Window" ) );
647 addActionWithCheckbox( current, "video-on-top", qtr( "Always &on Top" ) );
648 addActionWithCheckbox( current, "video-wallpaper", qtr( "Set as Wall&paper" ) );
650 current->addSeparator();
652 addActionWithSubmenu( current, "zoom", qtr( "&Zoom" ) );
653 addActionWithSubmenu( current, "aspect-ratio", qtr( "&Aspect Ratio" ) );
654 addActionWithSubmenu( current, "crop", qtr( "&Crop" ) );
656 current->addSeparator();
657 /* Rendering modifiers */
658 addActionWithSubmenu( current, "deinterlace", qtr( "&Deinterlace" ) );
659 addActionWithSubmenu( current, "deinterlace-mode", qtr( "&Deinterlace mode" ) );
660 addActionWithSubmenu( current, "postprocess", qtr( "&Post processing" ) );
662 current->addSeparator();
664 addAction( current, "video-snapshot", qtr( "Take &Snapshot" ) );
667 p_input = THEMIM->getInput();
669 p_vout = THEMIM->getVout();
670 VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
673 vlc_object_release( p_vout );
675 return Populate( p_intf, current, varnames, objects );
680 * For DVD, MP4, MOV and other chapter based format
682 QMenu *VLCMenuBar::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
687 addActionWithSubmenu( menu, "title", qtr( "T&itle" ) );
688 addActionWithSubmenu( menu, "chapter", qtr( "&Chapter" ) );
689 submenu = addActionWithSubmenu( menu, "navigation", qtr( "&Navigation" ) );
690 submenu->setTearOffEnabled( true );
691 addActionWithSubmenu( menu, "program", qtr( "&Program" ) );
693 /* FixMe: sync I_MENU_BOOKMARK string */
694 submenu = new QMenu( qtr( "Custom &Bookmarks" ), menu );
695 submenu->setTearOffEnabled( true );
696 addDPStaticEntry( submenu, qtr( "&Manage" ), "",
697 SLOT( bookmarksDialog() ), "Ctrl+B" );
698 submenu->addSeparator();
699 action = menu->addMenu( submenu );
700 action->setData( "bookmark" );
702 menu->addSeparator();
704 PopupMenuControlEntries( menu, p_intf );
706 EnableStaticEntries( menu, ( THEMIM->getInput() != NULL ) );
707 return RebuildNavigMenu( p_intf, menu, true );
710 QMenu *VLCMenuBar::RebuildNavigMenu( intf_thread_t *p_intf, QMenu *menu, bool b_keep )
714 input_thread_t *p_object;
715 QVector<vlc_object_t *> objects;
716 QVector<const char *> varnames;
718 /* Get the input and hold it */
719 p_object = THEMIM->getInput();
721 InputAutoMenuBuilder( p_object, objects, varnames );
723 /* Title and so on */
724 PUSH_VAR( "prev-title" );
725 PUSH_VAR( "next-title" );
726 PUSH_VAR( "prev-chapter" );
727 PUSH_VAR( "next-chapter" );
729 /* Remove playback actions to recreate them */
732 QList< QAction* > actions = menu->actions();
733 if( actions.count() > 4 )
734 for( int i = actions.count() - 1 ; i >= actions.count() - 1 - 4 ; --i )
738 PopupPlayEntries( menu, p_intf, p_object );
739 PopupMenuPlaylistControlEntries( menu, p_intf );
742 EnableStaticEntries( menu, (p_object != NULL ) );
743 return Populate( p_intf, menu, varnames, objects );
749 QMenu *VLCMenuBar::HelpMenu( QWidget *parent )
751 QMenu *menu = new QMenu( parent );
752 addDPStaticEntry( menu, qtr( "&Help..." ) ,
753 ":/menu/help", SLOT( helpDialog() ), "F1" );
755 addDPStaticEntry( menu, qtr( "Check for &Updates..." ) , "",
756 SLOT( updateDialog() ) );
758 menu->addSeparator();
759 addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), ":/menu/info",
760 SLOT( aboutDialog() ), "Shift+F1", QAction::AboutRole );
764 /*****************************************************************************
765 * Popup menus - Right Click menus *
766 *****************************************************************************/
767 #define POPUP_BOILERPLATE \
768 static QMenu* menu = NULL; \
769 delete menu; menu = NULL; \
772 QVector<vlc_object_t *> objects; \
773 QVector<const char *> varnames; \
774 input_thread_t *p_input = THEMIM->getInput();
776 #define CREATE_POPUP \
777 menu = new QMenu(); \
778 Populate( p_intf, menu, varnames, objects ); \
779 menu->popup( QCursor::pos() ); \
781 void VLCMenuBar::PopupPlayEntries( QMenu *menu,
782 intf_thread_t *p_intf,
783 input_thread_t *p_input )
787 /* Play or Pause action and icon */
788 if( !p_input || var_GetInteger( p_input, "state" ) != PLAYING_S )
790 action = menu->addAction( qtr( "Play" ),
791 ActionsManager::getInstance( p_intf ), SLOT( play() ) );
792 #ifndef __APPLE__ /* No icons in menus in Mac */
793 action->setIcon( QIcon( ":/menu/play" ) );
798 addMIMStaticEntry( p_intf, menu, qtr( "Pause" ),
799 ":/menu/pause", SLOT( togglePlayPause() ) );
803 void VLCMenuBar::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf,
807 QMenu *rateMenu = new QMenu( qtr( "Sp&eed" ), menu );
808 rateMenu->setTearOffEnabled( true );
813 action = rateMenu->addAction( qtr( "&Faster" ), THEMIM->getIM(),
815 #ifndef __APPLE__ /* No icons in menus in Mac */
816 action->setIcon( QIcon( ":/toolbar/faster2") );
818 action->setData( ACTION_STATIC );
821 action = rateMenu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(),
822 SLOT( littlefaster() ) );
823 action->setData( ACTION_STATIC );
825 action = rateMenu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(),
826 SLOT( normalRate() ) );
827 action->setData( ACTION_STATIC );
829 action = rateMenu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(),
830 SLOT( littleslower() ) );
831 action->setData( ACTION_STATIC );
835 action = rateMenu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(),
837 #ifndef __APPLE__ /* No icons in menus in Mac */
838 action->setIcon( QIcon( ":/toolbar/slower2") );
840 action->setData( ACTION_STATIC );
843 action = menu->addMenu( rateMenu );
844 action->setData( ACTION_STATIC );
846 menu->addSeparator();
848 if( !b_normal ) return;
850 action = menu->addAction( qtr( "&Jump Forward" ), THEMIM->getIM(),
852 #ifndef __APPLE__ /* No icons in menus in Mac */
853 action->setIcon( QIcon( ":/toolbar/skip_fw") );
855 action->setData( ACTION_STATIC );
857 action = menu->addAction( qtr( "Jump Bac&kward" ), THEMIM->getIM(),
859 #ifndef __APPLE__ /* No icons in menus in Mac */
860 action->setIcon( QIcon( ":/toolbar/skip_back") );
862 action->setData( ACTION_STATIC );
863 addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"",
864 SLOT( gotoTimeDialog() ), "Ctrl+T" );
865 menu->addSeparator();
868 void VLCMenuBar::PopupMenuPlaylistControlEntries( QMenu *menu,
869 intf_thread_t *p_intf )
871 bool bEnable = THEMIM->getInput() != NULL;
872 bool bPlaylistEmpty = THEMIM->hasEmptyPlaylist();
873 QAction *action = addMIMStaticEntry( p_intf, menu, qtr( "&Stop" ),
874 ":/menu/stop", SLOT( stop() ), true );
875 /* Disable Stop in the right-click popup menu */
877 action->setEnabled( false );
879 /* Next / Previous */
880 action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
881 ":/menu/previous", SLOT( prev() ), true );
882 action->setEnabled( !bPlaylistEmpty );
883 action->setData( ACTION_NO_CLEANUP );
884 CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
886 action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
887 ":/menu/next", SLOT( next() ), true );
888 action->setEnabled( !bPlaylistEmpty );
889 action->setData( ACTION_NO_CLEANUP );
890 CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
892 menu->addSeparator();
895 void VLCMenuBar::PopupMenuStaticEntries( QMenu *menu )
897 QMenu *openmenu = new QMenu( qtr( "Open a Media" ), menu );
898 addDPStaticEntry( openmenu, qtr( "&Open File..." ),
899 ":/type/file-asym", SLOT( openFileDialog() ) );
900 addDPStaticEntry( openmenu, qtr( I_OP_OPDIR ),
901 ":/type/folder-grey", SLOT( PLOpenDir() ) );
902 addDPStaticEntry( openmenu, qtr( "Open &Disc..." ),
903 ":/type/disc", SLOT( openDiscDialog() ) );
904 addDPStaticEntry( openmenu, qtr( "Open &Network..." ),
905 ":/type/network", SLOT( openNetDialog() ) );
906 addDPStaticEntry( openmenu, qtr( "Open &Capture Device..." ),
907 ":/type/capture-card", SLOT( openCaptureDialog() ) );
908 menu->addMenu( openmenu );
910 menu->addSeparator();
912 QMenu *helpmenu = HelpMenu( menu );
913 helpmenu->setTitle( qtr( "Help" ) );
914 menu->addMenu( helpmenu );
917 addDPStaticEntry( menu, qtr( "Quit" ), ":/menu/quit",
918 SLOT( quit() ), "Ctrl+Q", QAction::QuitRole );
921 /* Video Tracks and Subtitles tracks */
922 void VLCMenuBar::VideoPopupMenu( intf_thread_t *p_intf, bool show )
927 vout_thread_t *p_vout = THEMIM->getVout();
930 VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
931 vlc_object_release( p_vout );
938 void VLCMenuBar::AudioPopupMenu( intf_thread_t *p_intf, bool show )
943 audio_output_t *p_aout = THEMIM->getAout();
944 AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
946 vlc_object_release( p_aout );
951 /* Navigation stuff, and general menus ( open ), used only for skins */
952 void VLCMenuBar::MiscPopupMenu( intf_thread_t *p_intf, bool show )
958 varnames.append( "audio-es" );
959 InputAutoMenuBuilder( p_input, objects, varnames );
960 menu->addSeparator();
964 Populate( p_intf, menu, varnames, objects );
966 menu->addSeparator();
967 PopupPlayEntries( menu, p_intf, p_input );
968 PopupMenuPlaylistControlEntries( menu, p_intf);
970 menu->addSeparator();
971 PopupMenuControlEntries( menu, p_intf );
973 menu->addSeparator();
974 PopupMenuStaticEntries( menu );
976 menu->popup( QCursor::pos() );
979 /* Main Menu that sticks everything together */
980 void VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show )
987 bool b_isFullscreen = false;
988 MainInterface *mi = p_intf->p_sys->p_mi;
990 PopupPlayEntries( menu, p_intf, p_input );
991 PopupMenuPlaylistControlEntries( menu, p_intf );
992 menu->addSeparator();
997 vout_thread_t *p_vout = THEMIM->getVout();
999 /* Add a fullscreen switch button, since it is the most used function */
1002 vlc_value_t val; var_Get( p_vout, "fullscreen", &val );
1004 b_isFullscreen = !( !val.b_bool );
1005 if( b_isFullscreen )
1008 CreateAndConnect( menu, "fullscreen",
1009 qtr( "Leave Fullscreen" ),"" , ITEM_NORMAL,
1010 VLC_OBJECT(p_vout), val, VLC_VAR_BOOL, b_isFullscreen );
1012 vlc_object_release( p_vout );
1014 menu->addSeparator();
1018 InputAutoMenuBuilder( p_input, objects, varnames );
1021 submenu = new QMenu( menu );
1022 action = menu->addMenu( AudioMenu( p_intf, submenu ) );
1023 action->setText( qtr( "&Audio" ) );
1024 if( action->menu()->isEmpty() )
1025 action->setEnabled( false );
1028 submenu = new QMenu( menu );
1029 action = menu->addMenu( VideoMenu( p_intf, submenu, false ) );
1030 action->setText( qtr( "&Video" ) );
1031 if( action->menu()->isEmpty() )
1032 action->setEnabled( false );
1034 submenu = SubtitleMenu( menu );
1035 submenu->setTitle( qtr( "Subti&tle") );
1036 UpdateItem( p_intf, menu, "spu-es", VLC_OBJECT(p_input), true );
1038 /* Playback menu for chapters */
1039 submenu = new QMenu( menu );
1040 action = menu->addMenu( NavigMenu( p_intf, submenu ) );
1041 action->setText( qtr( "&Playback" ) );
1042 if( action->menu()->isEmpty() )
1043 action->setEnabled( false );
1046 menu->addSeparator();
1048 /* Add some special entries for windowed mode: Interface Menu */
1049 if( !b_isFullscreen )
1051 QMenu *submenu = new QMenu( qtr( "Tools" ), menu );
1052 /*QMenu *tools =*/ ToolsMenu( submenu );
1053 submenu->addSeparator();
1055 /* In skins interface, append some items */
1058 submenu->setTitle( qtr( "Interface" ) );
1059 if( p_intf->p_sys->b_isDialogProvider )
1061 vlc_object_t* p_object = p_intf->p_parent;
1063 objects.clear(); varnames.clear();
1064 objects.append( p_object );
1065 varnames.append( "intf-skins" );
1066 Populate( p_intf, submenu, varnames, objects );
1068 objects.clear(); varnames.clear();
1069 objects.append( p_object );
1070 varnames.append( "intf-skins-interactive" );
1071 Populate( p_intf, submenu, varnames, objects );
1074 msg_Warn( p_intf, "could not find parent interface" );
1078 QMenu *bar = menu; // Needed for next macro
1079 BAR_DADD( ViewMenu( p_intf, NULL, mi ), qtr( "V&iew" ), 4 );
1082 menu->addMenu( submenu );
1086 QMenuView *plMenu = new QMenuView( menu );
1087 plMenu->setTitle( qtr("Playlist") );
1088 PLModel *model = PLModel::getPLModel( p_intf );
1089 plMenu->setModel( model );
1090 CONNECT( plMenu, activated(const QModelIndex&),
1091 model, activateItem(const QModelIndex&));
1092 menu->addMenu( plMenu );
1094 /* Static entries for ending, like open */
1095 PopupMenuStaticEntries( menu );
1097 menu->popup( QCursor::pos() );
1101 #undef POPUP_BOILERPLATE
1104 /************************************************************************
1106 ************************************************************************/
1108 void VLCMenuBar::updateSystrayMenu( MainInterface *mi,
1109 intf_thread_t *p_intf,
1110 bool b_force_visible )
1112 input_thread_t *p_input = THEMIM->getInput();
1114 /* Get the systray menu and clean it */
1115 QMenu *sysMenu = mi->getSysTrayMenu();
1119 /* Hide / Show VLC and cone */
1120 if( mi->isVisible() || b_force_visible )
1122 sysMenu->addAction( QIcon( ":/logo/vlc16.png" ),
1123 qtr( "Hide VLC media player in taskbar" ), mi,
1124 SLOT( hideUpdateSystrayMenu() ) );
1128 sysMenu->addAction( QIcon( ":/logo/vlc16.png" ),
1129 qtr( "Show VLC media player" ), mi,
1130 SLOT( showUpdateSystrayMenu() ) );
1132 sysMenu->addSeparator();
1135 PopupPlayEntries( sysMenu, p_intf, p_input );
1136 PopupMenuPlaylistControlEntries( sysMenu, p_intf);
1137 PopupMenuControlEntries( sysMenu, p_intf, false );
1139 VolumeEntries( p_intf, sysMenu );
1140 sysMenu->addSeparator();
1141 addDPStaticEntry( sysMenu, qtr( "&Open a Media" ),
1142 ":/type/file-wide", SLOT( openFileDialog() ) );
1143 addDPStaticEntry( sysMenu, qtr( "&Quit" ) ,
1144 ":/menu/quit", SLOT( quit() ) );
1147 mi->getSysTray()->setContextMenu( sysMenu );
1153 /*************************************************************************
1154 * Builders for automenus
1155 *************************************************************************/
1156 QMenu * VLCMenuBar::Populate( intf_thread_t *p_intf,
1158 QVector< const char *> & varnames,
1159 QVector<vlc_object_t *> & objects )
1161 QMenu *menu = current;
1164 currentGroup = NULL;
1166 for( int i = 0; i < (int)objects.count() ; i++ )
1168 if( !varnames[i] || !*varnames[i] )
1170 menu->addSeparator();
1174 UpdateItem( p_intf, menu, varnames[i], objects[i], true );
1179 /*****************************************************************************
1181 *****************************************************************************/
1183 static bool IsMenuEmpty( const char *psz_var,
1184 vlc_object_t *p_object,
1185 bool b_root = true )
1187 vlc_value_t val, val_list;
1188 int i_type, i_result, i;
1190 /* Check the type of the object variable */
1191 i_type = var_Type( p_object, psz_var );
1193 /* Check if we want to display the variable */
1194 if( !( i_type & VLC_VAR_HASCHOICE ) ) return false;
1196 var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
1197 if( val.i_int == 0 ) return true;
1199 if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE )
1201 if( val.i_int == 1 && b_root ) return true;
1205 /* Check children variables in case of VLC_VAR_VARIABLE */
1206 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
1211 for( i = 0, i_result = true; i < val_list.p_list->i_count; i++ )
1213 if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
1221 /* clean up everything */
1222 var_FreeList( &val_list, NULL );
1227 #define TEXT_OR_VAR qfu ( text.psz_string ? text.psz_string : psz_var )
1229 void VLCMenuBar::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
1230 const char *psz_var, vlc_object_t *p_object, bool b_submenu )
1232 vlc_value_t val, text;
1235 QAction *action = FindActionWithVar( menu, psz_var );
1237 DeleteNonStaticEntries( action->menu() );
1242 action->setEnabled( false );
1246 /* Check the type of the object variable */
1247 /* This HACK is needed so we have a radio button for audio and video tracks
1248 instread of a checkbox */
1249 if( !strcmp( psz_var, "audio-es" )
1250 || !strcmp( psz_var, "video-es" ) )
1251 i_type = VLC_VAR_INTEGER | VLC_VAR_HASCHOICE;
1253 i_type = var_Type( p_object, psz_var );
1255 switch( i_type & VLC_VAR_TYPE )
1259 case VLC_VAR_VARIABLE:
1260 case VLC_VAR_STRING:
1261 case VLC_VAR_INTEGER:
1265 /* Variable doesn't exist or isn't handled */
1267 action->setEnabled( false );
1271 /* Make sure we want to display the variable */
1272 if( menu->isEmpty() && IsMenuEmpty( psz_var, p_object ) )
1275 action->setEnabled( false );
1279 /* Get the descriptive name of the variable */
1280 int i_ret = var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
1281 if( i_ret != VLC_SUCCESS )
1283 text.psz_string = NULL;
1288 action = new QAction( TEXT_OR_VAR, menu );
1289 menu->addAction( action );
1290 action->setData( psz_var );
1293 /* Some specific stuff */
1294 bool forceDisabled = false;
1295 if( !strcmp( psz_var, "spu-es" ) )
1297 vout_thread_t *p_vout = THEMIM->getVout();
1298 forceDisabled = ( p_vout == NULL );
1300 vlc_object_release( p_vout );
1303 if( i_type & VLC_VAR_HASCHOICE )
1305 /* Append choices menu */
1309 submenu = action->menu();
1312 submenu = new QMenu( menu );
1313 action->setMenu( submenu );
1317 CreateChoicesMenu( submenu, psz_var, p_object, true ) == 0 );
1319 action->setEnabled( false );
1324 CreateChoicesMenu( menu, psz_var, p_object, true ) == 0 );
1326 FREENULL( text.psz_string );
1330 switch( i_type & VLC_VAR_TYPE )
1333 val.i_int = 0; // Prevent the copy of an uninitialized value
1334 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
1335 p_object, val, i_type );
1339 var_Get( p_object, psz_var, &val );
1340 val.b_bool = !val.b_bool;
1341 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
1342 p_object, val, i_type, !val.b_bool );
1345 FREENULL( text.psz_string );
1350 /** HACK for the navigation submenu:
1351 * "title %2i" variables take the value 0 if not set
1353 static bool CheckTitle( vlc_object_t *p_object, const char *psz_var )
1356 if( sscanf( psz_var, "title %2i", &i_title ) <= 0 )
1359 int i_current_title = var_GetInteger( p_object, "title" );
1360 return ( i_title == i_current_title );
1364 int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
1365 vlc_object_t *p_object, bool b_root )
1367 vlc_value_t val, val_list, text_list;
1370 /* Check the type of the object variable */
1371 i_type = var_Type( p_object, psz_var );
1373 /* Make sure we want to display the variable */
1374 if( submenu->isEmpty() && IsMenuEmpty( psz_var, p_object, b_root ) )
1375 return VLC_EGENERIC;
1377 switch( i_type & VLC_VAR_TYPE )
1381 case VLC_VAR_VARIABLE:
1382 case VLC_VAR_STRING:
1383 case VLC_VAR_INTEGER:
1387 /* Variable doesn't exist or isn't handled */
1388 return VLC_EGENERIC;
1391 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
1392 &val_list, &text_list ) < 0 )
1394 return VLC_EGENERIC;
1397 #define CURVAL val_list.p_list->p_values[i]
1398 #define CURTEXT text_list.p_list->p_values[i].psz_string
1399 #define RADIO_OR_COMMAND ( i_type & VLC_VAR_ISCOMMAND ) ? ITEM_NORMAL : ITEM_RADIO
1401 for( i = 0; i < val_list.p_list->i_count; i++ )
1403 vlc_value_t another_val;
1405 QMenu *subsubmenu = new QMenu( submenu );
1407 switch( i_type & VLC_VAR_TYPE )
1409 case VLC_VAR_VARIABLE:
1410 CreateChoicesMenu( subsubmenu, CURVAL.psz_string, p_object, false );
1411 subsubmenu->setTitle( qfu( CURTEXT ? CURTEXT :CURVAL.psz_string ) );
1412 submenu->addMenu( subsubmenu );
1415 case VLC_VAR_STRING:
1416 var_Get( p_object, psz_var, &val );
1417 another_val.psz_string = strdup( CURVAL.psz_string );
1418 menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
1419 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
1420 p_object, another_val, i_type,
1421 val.psz_string && !strcmp( val.psz_string, CURVAL.psz_string ) );
1423 free( val.psz_string );
1426 case VLC_VAR_INTEGER:
1427 var_Get( p_object, psz_var, &val );
1428 if( CURTEXT ) menutext = qfu( CURTEXT );
1429 else menutext = QString::number( CURVAL.i_int );
1430 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
1431 p_object, CURVAL, i_type,
1432 ( CURVAL.i_int == val.i_int )
1433 && CheckTitle( p_object, psz_var ) );
1437 var_Get( p_object, psz_var, &val );
1438 if( CURTEXT ) menutext = qfu( CURTEXT );
1439 else menutext.sprintf( "%.2f", CURVAL.f_float );
1440 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
1441 p_object, CURVAL, i_type,
1442 CURVAL.f_float == val.f_float );
1449 currentGroup = NULL;
1451 /* clean up everything */
1452 var_FreeList( &val_list, &text_list );
1454 #undef RADIO_OR_COMMAND
1457 return submenu->isEmpty() ? VLC_EGENERIC : VLC_SUCCESS;
1460 void VLCMenuBar::CreateAndConnect( QMenu *menu, const char *psz_var,
1461 const QString& text, const QString& help,
1462 int i_item_type, vlc_object_t *p_obj,
1463 vlc_value_t val, int i_val_type,
1466 QAction *action = FindActionWithVar( menu, psz_var );
1471 action = new QAction( text, menu );
1472 menu->addAction( action );
1476 action->setToolTip( help );
1477 action->setEnabled( p_obj != NULL );
1479 if( i_item_type == ITEM_CHECK )
1481 action->setCheckable( true );
1483 else if( i_item_type == ITEM_RADIO )
1485 action->setCheckable( true );
1487 currentGroup = new QActionGroup( menu );
1488 currentGroup->addAction( action );
1491 action->setChecked( checked );
1493 MenuItemData *itemData = qFindChild<MenuItemData*>( action, QString() );
1495 itemData = new MenuItemData( action, p_obj, i_val_type, val, psz_var );
1497 /* remove previous signal-slot connection(s) if any */
1498 action->disconnect( );
1500 CONNECT( action, triggered(), THEDP->menusMapper, map() );
1501 THEDP->menusMapper->setMapping( action, itemData );
1504 menu->addAction( action );
1507 void VLCMenuBar::DoAction( QObject *data )
1509 MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
1510 vlc_object_t *p_object = itemData->p_obj;
1511 if( p_object == NULL ) return;
1513 /* Preserve settings across vouts via the playlist object: */
1514 if( !strcmp( itemData->psz_var, "fullscreen" )
1515 || !strcmp( itemData->psz_var, "video-on-top" ) )
1516 var_Set( pl_Get( p_object ), itemData->psz_var, itemData->val );
1518 var_Set( p_object, itemData->psz_var, itemData->val );
1521 void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
1526 RecentsMRL* rmrl = RecentsMRL::getInstance( p_intf );
1527 QStringList l = rmrl->recents();
1529 recentsMenu->clear();
1533 recentsMenu->setEnabled( false );
1537 for( int i = 0; i < l.count(); ++i )
1539 QString mrl = l.at( i );
1540 char *psz = decode_URI_duplicate( qtu( mrl ) );
1541 QString text = qfu( psz );
1544 action = recentsMenu->addAction(
1545 QString( i < 9 ? "&%1: ": "%1: " ).arg( i + 1 ) +
1546 QApplication::fontMetrics().elidedText( text,
1547 Qt::ElideLeft, 400 ),
1548 rmrl->signalMapper, SLOT( map() ),
1549 i < 9 ? QString( "Ctrl+%1" ).arg( i + 1 ) : "" );
1550 rmrl->signalMapper->setMapping( action, l.at( i ) );
1553 recentsMenu->addSeparator();
1554 recentsMenu->addAction( qtr("&Clear"), rmrl, SLOT( clear() ) );
1555 recentsMenu->setEnabled( true );