]> git.sesse.net Git - vlc/blob - modules/gui/qt4/menus.cpp
Cosmetic.
[vlc] / modules / gui / qt4 / menus.cpp
1 /*****************************************************************************
2  * menus.cpp : Qt menus
3  *****************************************************************************
4  * Copyright ( C ) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *          Jean-Philippe André <jpeg@videolan.org>
10  *
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.
15  *
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.
20  *
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  *****************************************************************************/
25
26 /** \todo
27  * - Remove static currentGroup
28  */
29
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include <vlc_common.h>
35
36 #include <vlc_intf_strings.h>
37
38 #include "main_interface.hpp"
39 #include "menus.hpp"
40 #include "dialogs_provider.hpp"
41 #include "input_manager.hpp"
42
43 #include <QMenu>
44 #include <QMenuBar>
45 #include <QAction>
46 #include <QActionGroup>
47 #include <QSignalMapper>
48 #include <QSystemTrayIcon>
49
50 enum
51 {
52     ITEM_NORMAL,
53     ITEM_CHECK,
54     ITEM_RADIO
55 };
56
57 static QActionGroup *currentGroup;
58
59 // Add static entries to menus
60 void addDPStaticEntry( QMenu *menu,
61                        const QString text,
62                        const char *help,
63                        const char *icon,
64                        const char *member,
65                        const char *shortcut = NULL )
66 {
67     QAction *action = NULL;
68     if( !EMPTY_STR( icon ) > 0 )
69     {
70         if( !EMPTY_STR( shortcut ) > 0 )
71             action = menu->addAction( QIcon( icon ), text, THEDP,
72                                       member, qtr( shortcut ) );
73         else
74             action = menu->addAction( QIcon( icon ), text, THEDP, member );
75     }
76     else
77     {
78         if( !EMPTY_STR( shortcut ) > 0 )
79             action = menu->addAction( text, THEDP, member, qtr( shortcut ) );
80         else
81             action = menu->addAction( text, THEDP, member );
82     }
83     action->setData( "_static_" );
84 }
85
86 void addMIMStaticEntry( intf_thread_t *p_intf,
87                         QMenu *menu,
88                         const QString text,
89                         const char *help,
90                         const char *icon,
91                         const char *member )
92 {
93     if( strlen( icon ) > 0 )
94     {
95         QAction *action = menu->addAction( text, THEMIM,  member );
96         action->setIcon( QIcon( icon ) );
97     }
98     else
99     {
100         menu->addAction( text, THEMIM, member );
101     }
102 }
103
104 void EnableDPStaticEntries( QMenu *menu, bool enable = true )
105 {
106     if( !menu )
107         return;
108
109     QAction *action;
110     foreach( action, menu->actions() )
111     {
112         if( action->data().toString() == "_static_" )
113             action->setEnabled( enable );
114     }
115 }
116
117 /**
118  * \return Number of static entries
119  */
120 int DeleteNonStaticEntries( QMenu *menu )
121 {
122     int i_ret = 0;
123     QAction *action;
124     if( !menu )
125         return VLC_EGENERIC;
126     foreach( action, menu->actions() )
127     {
128         if( action->data().toString() != "_static_" )
129             delete action;
130         else
131             i_ret++;
132     }
133 }
134
135 /*****************************************************************************
136  * Definitions of variables for the dynamic menus
137  *****************************************************************************/
138 #define PUSH_VAR( var ) varnames.push_back( var ); \
139     objects.push_back( p_object ? p_object->i_object_id : 0 )
140
141 #define PUSH_INPUTVAR( var ) varnames.push_back( var ); \
142     objects.push_back( p_input ? p_input->i_object_id : 0 );
143
144 #define PUSH_SEPARATOR if( objects.size() != i_last_separator ) { \
145     objects.push_back( 0 ); varnames.push_back( "" ); \
146     i_last_separator = objects.size(); }
147
148 static int InputAutoMenuBuilder( vlc_object_t *p_object,
149         vector<int> &objects,
150         vector<const char *> &varnames )
151 {
152     PUSH_VAR( "bookmark" );
153     PUSH_VAR( "title" );
154     PUSH_VAR( "chapter" );
155     PUSH_VAR( "program" );
156     PUSH_VAR( "navigation" );
157     PUSH_VAR( "dvd_menus" );
158     return VLC_SUCCESS;
159 }
160
161 static int VideoAutoMenuBuilder( vlc_object_t *p_object,
162         input_thread_t *p_input,
163         vector<int> &objects,
164         vector<const char *> &varnames )
165 {
166     PUSH_INPUTVAR( "video-es" );
167     PUSH_INPUTVAR( "spu-es" );
168     PUSH_VAR( "fullscreen" );
169     PUSH_VAR( "zoom" );
170     PUSH_VAR( "deinterlace" );
171     PUSH_VAR( "aspect-ratio" );
172     PUSH_VAR( "crop" );
173     PUSH_VAR( "video-on-top" );
174     PUSH_VAR( "directx-wallpaper" );
175     PUSH_VAR( "video-snapshot" );
176
177     if( p_object )
178     {
179         vlc_object_t *p_dec_obj = ( vlc_object_t * )vlc_object_find( p_object,
180                 VLC_OBJECT_DECODER,
181                 FIND_PARENT );
182         if( p_dec_obj )
183         {
184             vlc_object_t *p_object = p_dec_obj;
185             PUSH_VAR( "ffmpeg-pp-q" );
186             vlc_object_release( p_dec_obj );
187         }
188     }
189     return VLC_SUCCESS;
190 }
191
192 static int AudioAutoMenuBuilder( vlc_object_t *p_object,
193         input_thread_t *p_input,
194         vector<int> &objects,
195         vector<const char *> &varnames )
196 {
197     PUSH_INPUTVAR( "audio-es" );
198     PUSH_VAR( "audio-device" );
199     PUSH_VAR( "audio-channels" );
200     PUSH_VAR( "visual" );
201     PUSH_VAR( "equalizer" );
202     return VLC_SUCCESS;
203 }
204
205 static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
206 {
207     QAction *action;
208     foreach( action, menu->actions() )
209     {
210         if( action->data().toString() == psz_var )
211             return action;
212     }
213     return NULL;
214 }
215
216 static QAction * FindActionWithText( QMenu *menu, QString &text )
217 {
218     QAction *action;
219     foreach( action, menu->actions() )
220     {
221         if( action->text() == text )
222             return action;
223     }
224     return NULL;
225 }
226
227 /*****************************************************************************
228  * All normal menus
229  * Simple Code
230  *****************************************************************************/
231
232 #define BAR_ADD( func, title ) { \
233     QMenu *_menu = func; _menu->setTitle( title ); bar->addMenu( _menu ); }
234
235 #define BAR_DADD( func, title, id ) { \
236     QMenu *_menu = func; _menu->setTitle( title ); bar->addMenu( _menu ); \
237     MenuFunc *f = new MenuFunc( _menu, id ); \
238     CONNECT( _menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
239     THEDP->menusUpdateMapper->setMapping( _menu, f ); }
240
241 #define ACT_ADD( _menu, val, title ) { \
242     QAction *_action = new QAction( title, _menu ); _action->setData( val ); \
243     _menu->addAction( _action ); }
244
245 /**
246  * Main Menu Bar Creation
247  **/
248 void QVLCMenu::createMenuBar( MainInterface *mi,
249                               intf_thread_t *p_intf,
250                               bool visual_selector_enabled )
251 {
252     /* QMainWindows->menuBar()
253        gives the QProcess::destroyed timeout issue on Cleanlooks style with
254        setDesktopAware set to false */
255     QMenuBar *bar = mi->menuBar();
256     BAR_ADD( FileMenu(), qtr( "&Media" ) );
257     BAR_ADD( PlaylistMenu( p_intf, mi ), qtr( "&Playlist" ) );
258     BAR_ADD( ToolsMenu( p_intf, NULL, mi, visual_selector_enabled, true ),
259              qtr( "&Tools" ) );
260     BAR_DADD( AudioMenu( p_intf, NULL ), qtr( "&Audio" ), 1 );
261     BAR_DADD( VideoMenu( p_intf, NULL ), qtr( "&Video" ), 2 );
262     BAR_DADD( NavigMenu( p_intf, NULL ), qtr( "&Playback" ), 3 );
263     BAR_ADD( HelpMenu( NULL ), qtr( "&Help" ) );
264 }
265 #undef BAR_ADD
266 #undef BAR_DADD
267
268 /**
269  * Media ( File ) Menu
270  * Opening, streaming and quit
271  **/
272 QMenu *QVLCMenu::FileMenu()
273 {
274     QMenu *menu = new QMenu();
275
276     addDPStaticEntry( menu, qtr( "&Open File..." ), "",
277         ":/pixmaps/file-asym_16px.png", SLOT( openFileDialog() ), "Ctrl+O" );
278     addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "",
279         ":/pixmaps/folder-grey_16px.png", SLOT( PLAppendDir() ), "Ctrl+F" );
280     addDPStaticEntry( menu, qtr( "Open &Disc..." ), "",
281         ":/pixmaps/disc_16px.png", SLOT( openDiscDialog() ), "Ctrl+D" );
282     addDPStaticEntry( menu, qtr( "Open &Network..." ), "",
283         ":/pixmaps/network_16px.png", SLOT( openNetDialog() ), "Ctrl+N" );
284     addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), "",
285         ":/pixmaps/capture-card_16px.png", SLOT( openCaptureDialog() ),
286         "Ctrl+C" );
287     menu->addSeparator();
288
289     addDPStaticEntry( menu, qtr( "&Streaming..." ), "",
290         ":/pixmaps/menus_stream_16px.png", SLOT( openThenStreamingDialogs() ),
291         "Ctrl+S" );
292     addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", "",
293         SLOT( openThenTranscodingDialogs() ), "Ctrl+R" );
294     menu->addSeparator();
295
296     addDPStaticEntry( menu, qtr( "&Quit" ) , "",
297         ":/pixmaps/menus_quit_16px.png", SLOT( quit() ), "Ctrl+Q" );
298     return menu;
299 }
300
301 /* Playlist/MediaLibrary Control */
302 QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf, MainInterface *mi )
303 {
304     QMenu *menu = new QMenu();
305     menu->addMenu( SDMenu( p_intf ) );
306     menu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ),
307                      qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) );
308     menu->addSeparator();
309
310     addDPStaticEntry( menu, qtr( I_PL_LOAD ), "", "", SLOT( openAPlaylist() ),
311         "Ctrl+X" );
312     addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", "", SLOT( saveAPlaylist() ),
313         "Ctrl+Y" );
314     menu->addSeparator();
315     menu->addAction( qtr( "Undock from interface" ), mi,
316                      SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );
317     return menu;
318 }
319
320 /**
321  * Tools/View Menu
322  * This is kept in the same menu for now, but could change if it gets much
323  * longer.
324  * This menu can be an interface menu but also a right click menu.
325  **/
326 QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf,
327                             QMenu *current,
328                             MainInterface *mi,
329                             bool visual_selector_enabled,
330                             bool with_intf )
331 {
332     QMenu *menu = new QMenu( current );
333     if( mi )
334     {
335         menu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ),
336                          qtr( "Playlist..." ), mi, SLOT( togglePlaylist() ),
337                          qtr( "Ctrl+L" ) );
338     }
339     addDPStaticEntry( menu, qtr( I_MENU_EXT ), "",
340         ":/pixmaps/menus_settings_16px.png", SLOT( extendedDialog() ),
341         "Ctrl+E" );
342
343     menu->addSeparator();
344
345     if( with_intf )
346     {
347         QMenu *intfmenu = InterfacesMenu( p_intf, menu );
348         intfmenu->setTitle( qtr( "Add Interfaces" ) );
349         MenuFunc *f = new MenuFunc( intfmenu, 4 );
350         CONNECT( intfmenu, aboutToShow(), THEDP->menusUpdateMapper, map() );
351         THEDP->menusUpdateMapper->setMapping( intfmenu, f );
352         menu->addMenu( intfmenu );
353         menu->addSeparator();
354     }
355     if( mi )
356     {
357         /* Minimal View */
358         QAction *action=menu->addAction( qtr( "Minimal View..." ), mi,
359                 SLOT( toggleMinimalView() ), qtr( "Ctrl+H" ) );
360         action->setCheckable( true );
361         if( mi->getControlsVisibilityStatus() & CONTROLS_VISIBLE )
362             action->setChecked( true );
363
364         /* FullScreen View */
365         action = menu->addAction( qtr( "Toggle Fullscreen Interface" ), mi,
366                 SLOT( toggleFullScreen() ), qtr( "F11" ) );
367
368         /* Advanced Controls */
369         action = menu->addAction( qtr( "Advanced controls" ), mi,
370                 SLOT( toggleAdvanced() ) );
371         action->setCheckable( true );
372         if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED )
373             action->setChecked( true );
374 #if 0 /* For Visualisations. Not yet working */
375         adv = menu->addAction( qtr( "Visualizations selector" ),
376                 mi, SLOT( visual() ) );
377         adv->setCheckable( true );
378         if( visual_selector_enabled ) adv->setChecked( true );
379 #endif
380     }
381
382     menu->addSeparator();
383
384     addDPStaticEntry( menu, qtr( I_MENU_MSG ), "",
385         ":/pixmaps/menus_messages_16px.png", SLOT( messagesDialog() ),
386         "Ctrl+M" );
387     addDPStaticEntry( menu, qtr( I_MENU_INFO ) , "", "",
388         SLOT( mediaInfoDialog() ), "Ctrl+I" );
389     addDPStaticEntry( menu, qtr( I_MENU_CODECINFO ) , "",
390         ":/pixmaps/menus_info_16px.png", SLOT( mediaCodecDialog() ), "Ctrl+J" );
391     addDPStaticEntry( menu, qtr( I_MENU_BOOKMARK ), "","",
392                       SLOT( bookmarksDialog() ), "Ctrl+B" );
393 #ifdef ENABLE_VLM
394     addDPStaticEntry( menu, qtr( I_MENU_VLM ), "", "", SLOT( vlmDialog() ),
395         "Ctrl+W" );
396 #endif
397
398     menu->addSeparator();
399     addDPStaticEntry( menu, qtr( "Preferences..." ), "",
400         ":/pixmaps/menus_preferences_16px.png", SLOT( prefsDialog() ), "Ctrl+P" );
401     return menu;
402 }
403
404 /**
405  * Interface Sub-Menu, to list extras interface and skins
406  **/
407 QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
408 {
409     vector<int> objects;
410     vector<const char *> varnames;
411     /** \todo add "switch to XXX" */
412     varnames.push_back( "intf-add" );
413     objects.push_back( p_intf->i_object_id );
414
415     QMenu *submenu = new QMenu( current );
416     QMenu *menu = Populate( p_intf, submenu, varnames, objects );
417
418     return menu;
419 }
420
421 /**
422  * Main Audio Menu
423  */
424 QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
425 {
426     vector<int> objects;
427     vector<const char *> varnames;
428     vlc_object_t *p_aout;
429     input_thread_t *p_input;
430
431     if( !current ) current = new QMenu();
432
433     if( current->isEmpty() )
434     {
435         ACT_ADD( current, "audio-es", qtr( "Audio &Track" ) );
436         ACT_ADD( current, "audio-device", qtr( "Audio &Device" ) );
437         ACT_ADD( current, "audio-channels", qtr( "Audio &Channels" ) );
438         ACT_ADD( current, "visual", qtr( "&Visualizations" ) );
439         ACT_ADD( current, "equalizer", qtr( "&Equalizer" ) );
440     }
441
442     p_input = THEMIM->getInput();
443     if( p_input )
444         vlc_object_yield( p_input );
445     p_aout = ( vlc_object_t * ) vlc_object_find( p_intf,
446                                                  VLC_OBJECT_AOUT,
447                                                  FIND_ANYWHERE );
448
449     AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
450
451     if( p_aout )
452         vlc_object_release( p_aout );
453     if( p_input )
454         vlc_object_release( p_input );
455
456     return Populate( p_intf, current, varnames, objects );
457 }
458
459 /**
460  * Main Video Menu
461  * Subtitles are part of Video.
462  **/
463 QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
464 {
465     vlc_object_t *p_object;
466     input_thread_t *p_input;
467     vector<int> objects;
468     vector<const char *> varnames;
469
470     if( !current ) current = new QMenu();
471
472     if( current->isEmpty() )
473     {
474         ACT_ADD( current, "video-es", qtr( "Video &Track" ) );
475
476         QAction *action;
477         QMenu *submenu = new QMenu( qtr( "&Subtitles Track" ), current );
478         action = current->addMenu( submenu );
479         action->setData( "spu-es" );
480         addDPStaticEntry( submenu, qtr( "Load File..." ), "", "",
481                           SLOT( loadSubtitlesFile() ) );
482
483         ACT_ADD( current, "fullscreen", qtr( "Toggle &Fullscreen" ) );
484         ACT_ADD( current, "zoom", qtr( "&Zoom" ) );
485         ACT_ADD( current, "deinterlace", qtr( "&Deinterlace" ) );
486         ACT_ADD( current, "aspect-ratio", qtr( "&Aspect Ratio" ) );
487         ACT_ADD( current, "crop", qtr( "&Crop" ) );
488         ACT_ADD( current, "video-on-top", qtr( "Always &On Top" ) );
489         /* ACT_ADD( current, "directx-wallpaper", qtr( "DirectX Wallpaper" ) ); */
490         ACT_ADD( current, "video-snapshot", qtr( "Snapshot" ) );
491         /* ACT_ADD( current, "ffmpeg-pp-q", qtr( "Decoder" ) ); */
492     }
493
494     p_input = THEMIM->getInput();
495     if( p_input )
496         vlc_object_yield( p_input );
497     p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_VOUT,
498             FIND_ANYWHERE );
499
500     VideoAutoMenuBuilder( p_object, p_input, objects, varnames );
501
502     if( p_object )
503         vlc_object_release( p_object );
504     if( p_input )
505         vlc_object_release( p_input );
506
507     return Populate( p_intf, current, varnames, objects );
508 }
509
510 /**
511  * Navigation Menu
512  * For DVD, MP4, MOV and other chapter based format
513  **/
514 QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *menu )
515 {
516     vlc_object_t *p_object;
517     vector<int> objects;
518     vector<const char *> varnames;
519
520     if( !menu ) menu = new QMenu();
521
522     if( menu->isEmpty() )
523     {
524         addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ), "","",
525                           SLOT( gotoTimeDialog() ), "Ctrl+T" );
526         menu->addSeparator();
527
528         ACT_ADD( menu, "bookmark", qtr( "&Bookmarks" ) );
529         ACT_ADD( menu, "title", qtr( "&Title" ) );
530         ACT_ADD( menu, "chapter", qtr( "&Chapter" ) );
531         ACT_ADD( menu, "program", qtr( "&Program" ) );
532         ACT_ADD( menu, "navigation", qtr( "&Navigation" ) );
533     }
534
535     p_object = ( vlc_object_t * )vlc_object_find( p_intf, VLC_OBJECT_INPUT,
536             FIND_ANYWHERE );
537     InputAutoMenuBuilder(  p_object, objects, varnames );
538     PUSH_VAR( "prev-title" );
539     PUSH_VAR( "next-title" );
540     PUSH_VAR( "prev-chapter" );
541     PUSH_VAR( "next-chapter" );
542     EnableDPStaticEntries( menu, ( p_object != NULL ) );
543     if( p_object )
544     {
545         vlc_object_release( p_object );
546     }
547     return Populate( p_intf, menu, varnames, objects, true );
548 }
549
550 /**
551  * Service Discovery SubMenu
552  **/
553 QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
554 {
555     QMenu *menu = new QMenu();
556     menu->setTitle( qtr( I_PL_SD ) );
557     char **ppsz_longnames;
558     char **ppsz_names = services_discovery_GetServicesNames( p_intf,
559                                                              &ppsz_longnames );
560     if( !ppsz_names )
561         return menu;
562
563     char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
564     for( ; *ppsz_name; ppsz_name++, ppsz_longname++ )
565     {
566         QAction *a = new QAction( qfu( *ppsz_longname ), menu );
567         a->setCheckable( true );
568         if( playlist_IsServicesDiscoveryLoaded( THEPL, *ppsz_name ) )
569             a->setChecked( true );
570         CONNECT( a , triggered(), THEDP->SDMapper, map() );
571         THEDP->SDMapper->setMapping( a, QString( *ppsz_name ) );
572         menu->addAction( a );
573
574         if( !strcmp( *ppsz_name, "podcast" ) )
575         {
576             QAction *b = new QAction( qfu( "Configure podcasts..." ), menu );
577             //b->setEnabled( a->isChecked() );
578             menu->addAction( b );
579             CONNECT( b, triggered(), THEDP, podcastConfigureDialog() );
580         }
581         free( *ppsz_name );
582         free( *ppsz_longname );
583     }
584     free( ppsz_names );
585     free( ppsz_longnames );
586     return menu;
587 }
588 /**
589  * Help/About Menu
590 **/
591 QMenu *QVLCMenu::HelpMenu( QMenu *current )
592 {
593     QMenu *menu = new QMenu( current );
594     addDPStaticEntry( menu, qtr( "Help..." ) , "",
595         ":/pixmaps/menus_help_16px.png", SLOT( helpDialog() ), "F1" );
596 #ifdef UPDATE_CHECK
597     addDPStaticEntry( menu, qtr( "Check for updates..." ) , "", "",
598                       SLOT( updateDialog() ), "");
599 #endif
600     menu->addSeparator();
601     addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), "", "", SLOT( aboutDialog() ),
602         "Ctrl+F1" );
603     return menu;
604 }
605
606 /*****************************************************************************
607  * Popup menus - Right Click menus                                           *
608  *****************************************************************************/
609 #define POPUP_BOILERPLATE \
610     unsigned int i_last_separator = 0; \
611     vector<int> objects; \
612     vector<const char *> varnames; \
613     input_thread_t *p_input = THEMIM->getInput();
614
615 #define CREATE_POPUP \
616     Populate( p_intf, menu, varnames, objects ); \
617     p_intf->p_sys->p_popup_menu = menu; \
618     menu->popup( QCursor::pos() ); \
619     p_intf->p_sys->p_popup_menu = NULL; \
620     i_last_separator = 0;
621
622 void QVLCMenu::PopupMenuControlEntries( QMenu *menu,
623                                         intf_thread_t *p_intf,
624                                         input_thread_t *p_input )
625 {
626     if( p_input )
627     {
628         vlc_value_t val;
629         var_Get( p_input, "state", &val );
630         if( val.i_int == PLAYING_S )
631             addMIMStaticEntry( p_intf, menu, qtr( "Pause" ), "",
632                     ":/pixmaps/pause_16px.png", SLOT( togglePlayPause() ) );
633         else
634             addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "",
635                     ":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) );
636     }
637     else if( THEPL->items.i_size )
638         addMIMStaticEntry( p_intf, menu, qtr( "Play" ), "",
639                 ":/pixmaps/play_16px.png", SLOT( togglePlayPause() ) );
640
641     addMIMStaticEntry( p_intf, menu, qtr( "Stop" ), "",
642             ":/pixmaps/stop_16px.png", SLOT( stop() ) );
643     addMIMStaticEntry( p_intf, menu, qtr( "Previous" ), "",
644             ":/pixmaps/previous_16px.png", SLOT( prev() ) );
645     addMIMStaticEntry( p_intf, menu, qtr( "Next" ), "",
646             ":/pixmaps/next_16px.png", SLOT( next() ) );
647     }
648
649 void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu )
650 {
651 #if 0
652     QMenu *toolsmenu = ToolsMenu( p_intf, menu, false, true );
653     toolsmenu->setTitle( qtr( "Tools" ) );
654     menu->addMenu( toolsmenu );
655 #endif
656
657     QMenu *openmenu = new QMenu( qtr( "Open" ), menu );
658     addDPStaticEntry( openmenu, qtr( "&Open File..." ), "",
659         ":/pixmaps/file-asym_16px.png", SLOT( openFileDialog() ) );
660     addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ), "",
661         ":/pixmaps/folder-grey_16px.png", SLOT( PLAppendDir() ) );
662     addDPStaticEntry( openmenu, qtr( "Open &Disc..." ), "",
663         ":/pixmaps/disc_16px.png", SLOT( openDiscDialog() ) );
664     addDPStaticEntry( openmenu, qtr( "Open &Network..." ), "",
665         ":/pixmaps/network_16px.png", SLOT( openNetDialog() ) );
666     addDPStaticEntry( openmenu, qtr( "Open &Capture Device..." ), "",
667         ":/pixmaps/capture-card_16px.png", SLOT( openCaptureDialog() ) );
668     menu->addMenu( openmenu );
669
670     menu->addSeparator();
671 #if 0
672     QMenu *helpmenu = HelpMenu( menu );
673     helpmenu->setTitle( qtr( "Help" ) );
674     menu->addMenu( helpmenu );
675 #endif
676
677     addDPStaticEntry( menu, qtr( "Quit" ), "", ":/pixmaps/menus_quit_16px.png",
678                       SLOT( quit() ), "Ctrl+Q" );
679 }
680
681 /* Video Tracks and Subtitles tracks */
682 void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
683 {
684     POPUP_BOILERPLATE;
685     if( p_input )
686     {
687         vlc_object_yield( p_input );
688         vlc_object_t *p_vout = ( vlc_object_t * )vlc_object_find( p_input,
689                 VLC_OBJECT_VOUT, FIND_CHILD );
690         if( p_vout )
691         {
692             VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
693             vlc_object_release( p_vout );
694         }
695         vlc_object_release( p_input );
696     }
697     QMenu *menu = new QMenu();
698     CREATE_POPUP;
699 }
700
701 /* Audio Tracks */
702 void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
703 {
704     POPUP_BOILERPLATE;
705     if( p_input )
706     {
707         vlc_object_yield( p_input );
708         vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input,
709                 VLC_OBJECT_AOUT, FIND_ANYWHERE );
710         AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
711         if( p_aout )
712             vlc_object_release( p_aout );
713         vlc_object_release( p_input );
714     }
715     QMenu *menu = new QMenu();
716     CREATE_POPUP;
717 }
718
719 /* Navigation stuff, and general menus ( open ) */
720 void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
721 {
722     vlc_value_t val;
723     POPUP_BOILERPLATE;
724
725     if( p_input )
726     {
727         vlc_object_yield( p_input );
728         varnames.push_back( "audio-es" );
729         InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
730         PUSH_SEPARATOR;
731     }
732
733     QMenu *menu = new QMenu();
734     Populate( p_intf, menu, varnames, objects );
735
736     menu->addSeparator();
737     PopupMenuControlEntries( menu, p_intf, p_input );
738
739     menu->addSeparator();
740     PopupMenuStaticEntries( p_intf, menu );
741
742     p_intf->p_sys->p_popup_menu = menu;
743     menu->popup( QCursor::pos() );
744     p_intf->p_sys->p_popup_menu = NULL;
745 }
746
747 /* Main Menu that sticks everything together  */
748 void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
749 {
750     MainInterface *mi = p_intf->p_sys->p_mi;
751     if( show )
752     {
753         /* Delete and recreate a popup if there is one */
754         if( p_intf->p_sys->p_popup_menu )
755             delete p_intf->p_sys->p_popup_menu;
756
757         QMenu *menu = new QMenu();
758         QMenu *submenu;
759         QAction *action;
760
761         POPUP_BOILERPLATE;
762
763         PopupMenuControlEntries( menu, p_intf, p_input );
764         menu->addSeparator();
765         bool b_fullscreen;
766
767         if( p_input )
768         {
769             vlc_object_yield( p_input );
770             InputAutoMenuBuilder( VLC_OBJECT( p_input ), objects, varnames );
771
772             vlc_object_t *p_aout = ( vlc_object_t * )
773                 vlc_object_find( p_input, VLC_OBJECT_AOUT, FIND_ANYWHERE );
774             vlc_object_t *p_vout = ( vlc_object_t * )
775                 vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD );
776
777             /* Add a fullscreen switch button */
778             if( p_vout )
779             {
780                 vlc_value_t val;
781                 var_Get( p_vout, "fullscreen", &val );
782                 val.b_bool = !val.b_bool;
783                 CreateAndConnect( menu, "fullscreen", qtr( "Fullscreen" ), "",
784                      ITEM_CHECK, p_vout->i_object_id, val, VLC_VAR_BOOL,
785                      !val.b_bool );
786                 b_fullscreen = !val.b_bool;
787             }
788
789             /* Audio menu */
790             AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
791             if( p_aout )
792                 vlc_object_release( p_aout );
793             submenu = Populate( p_intf, NULL, varnames, objects );
794             varnames.clear(); objects.clear();
795             action = menu->addMenu( submenu );
796             action->setText( qtr( "Audio" ) );
797             if( submenu->isEmpty() )
798                 action->setEnabled( false );
799
800             /* Video menu */
801             submenu = new QMenu();
802             ACT_ADD( submenu, "video-es", qtr( "Video Track" ) );
803             QMenu *subsubmenu = new QMenu( qtr( "&Subtitles Track" ), submenu );
804             addDPStaticEntry( subsubmenu, qtr( "Load File..." ), "", "",
805                               SLOT( loadSubtitlesFile() ) );
806             action = submenu->addMenu( subsubmenu );
807             action->setData( "spu-es" );
808
809             VideoAutoMenuBuilder( p_vout, p_input, objects, varnames );
810             if( p_vout )
811                 vlc_object_release( p_vout );
812             Populate( p_intf, submenu, varnames, objects );
813             varnames.clear(); objects.clear();
814             action = menu->addMenu( submenu );
815             action->setText( qtr( "Video" ) );
816             if( submenu->isEmpty() )
817                 action->setEnabled( false );
818
819             vlc_object_release( p_input );
820         }
821
822         menu->addSeparator();
823
824         /* Add some special entries for windowed mode */
825         if( !b_fullscreen )
826         {
827             submenu = new QMenu( qtr( "Interface" ), menu );
828             submenu->addAction( QIcon( ":/pixmaps/playlist_16px.png" ),
829                  qtr( "Show Playlist" ), mi, SLOT( togglePlaylist() ) );
830             addDPStaticEntry( submenu, qtr( I_MENU_EXT ), "",
831                  ":/pixmaps/menus_settings_16px.png", SLOT( extendedDialog() ) );
832             action = submenu->addAction( QIcon( "" ),
833                  qtr( "Minimal View..." ), mi, SLOT( toggleMinimalView() ) );
834             action->setCheckable( true );
835             action->setChecked( !( mi->getControlsVisibilityStatus() &
836                                    CONTROLS_VISIBLE ) );
837             action = submenu->addAction( QIcon( "" ),
838                  qtr( "Toggle Fullscreen Interface" ),
839                  mi, SLOT( toggleFullScreen() ) );
840             action->setCheckable( true );
841             action->setChecked( mi->isFullScreen() );
842             menu->addMenu( submenu );
843         }
844
845         PopupMenuStaticEntries( p_intf, menu );
846
847         p_intf->p_sys->p_popup_menu = menu;
848         p_intf->p_sys->p_popup_menu->popup( QCursor::pos() );
849     }
850     else
851     {
852         // destroy popup if there is one
853         delete p_intf->p_sys->p_popup_menu;
854         p_intf->p_sys->p_popup_menu = NULL;
855     }
856 }
857
858 #undef ACT_ADD
859
860 /************************************************************************
861  * Systray Menu                                                         *
862  ************************************************************************/
863
864 void QVLCMenu::updateSystrayMenu( MainInterface *mi,
865                                   intf_thread_t *p_intf,
866                                   bool b_force_visible )
867 {
868     POPUP_BOILERPLATE;
869
870     /* Get the systray menu and clean it */
871     QMenu *sysMenu = mi->getSysTrayMenu();
872     sysMenu->clear();
873
874     /* Hide / Show VLC and cone */
875     if( mi->isVisible() || b_force_visible )
876     {
877         sysMenu->addAction( QIcon( ":/vlc16.png" ),
878                 qtr( "Hide VLC media player in taskbar" ), mi,
879                 SLOT( toggleUpdateSystrayMenu() ) );
880     }
881     else
882     {
883         sysMenu->addAction( QIcon( ":/vlc16.png" ),
884                 qtr( "Show VLC media player" ), mi,
885                 SLOT( toggleUpdateSystrayMenu() ) );
886     }
887
888     sysMenu->addSeparator();
889     PopupMenuControlEntries( sysMenu, p_intf, p_input );
890
891     sysMenu->addSeparator();
892     addDPStaticEntry( sysMenu, qtr( "&Open Media" ), "",
893             ":/pixmaps/file-wide_16px.png", SLOT( openFileDialog() ), "" );
894     addDPStaticEntry( sysMenu, qtr( "&Quit" ) , "",
895         ":/pixmaps/menus_quit_16px.png", SLOT( quit() ), "" );
896
897     /* Set the menu */
898     mi->getSysTray()->setContextMenu( sysMenu );
899 }
900
901 #undef PUSH_VAR
902 #undef PUSH_SEPARATOR
903
904 /*************************************************************************
905  * Builders for automenus
906  *************************************************************************/
907 QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
908                             QMenu *current,
909                             vector< const char *> & varnames,
910                             vector<int> & objects,
911                             bool append )
912 {
913     QMenu *menu = current;
914     if( !menu ) menu = new QMenu();
915
916     /* Disable all non static entries */
917     QAction *p_action;
918     foreach( p_action, menu->actions() )
919     {
920         if( p_action->data().toString() != "_static_" )
921             p_action->setEnabled( false );
922     }
923
924     currentGroup = NULL;
925
926     vlc_object_t *p_object;
927     int i;
928
929     for( i = 0; i < ( int )objects.size() ; i++ )
930     {
931         if( !varnames[i] || !*varnames[i] )
932         {
933             menu->addSeparator();
934             continue;
935         }
936
937         if( objects[i] == 0 )
938         {
939             p_object = NULL;
940         }
941         else
942         {
943             p_object = ( vlc_object_t * )vlc_object_get( objects[i] );
944             if( !p_object )
945             {
946                 msg_Dbg( p_intf, "object %d not found !", objects[i] );
947                 continue;
948             }
949         }
950
951         /* Ugly specific stuff */
952         if( strstr( varnames[i], "intf-add" ) )
953             UpdateItem( p_intf, menu, varnames[i], p_object, false );
954         else
955             UpdateItem( p_intf, menu, varnames[i], p_object, true );
956         if( p_object )
957             vlc_object_release( p_object );
958     }
959     return menu;
960 }
961
962 /*****************************************************************************
963  * Private methods.
964  *****************************************************************************/
965
966 static bool IsMenuEmpty( const char *psz_var,
967                          vlc_object_t *p_object,
968                          bool b_root = true )
969 {
970     vlc_value_t val, val_list;
971     int i_type, i_result, i;
972
973     /* Check the type of the object variable */
974     i_type = var_Type( p_object, psz_var );
975
976     /* Check if we want to display the variable */
977     if( !( i_type & VLC_VAR_HASCHOICE ) ) return false;
978
979     var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
980     if( val.i_int == 0 ) return true;
981
982     if( ( i_type & VLC_VAR_TYPE ) != VLC_VAR_VARIABLE )
983     {
984         if( val.i_int == 1 && b_root ) return true;
985         else return false;
986     }
987
988     /* Check children variables in case of VLC_VAR_VARIABLE */
989     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
990     {
991         return true;
992     }
993
994     for( i = 0, i_result = true; i < val_list.p_list->i_count; i++ )
995     {
996         if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
997                     p_object, false ) )
998         {
999             i_result = false;
1000             break;
1001         }
1002     }
1003
1004     /* clean up everything */
1005     var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, NULL );
1006
1007     return i_result;
1008 }
1009
1010 #define TEXT_OR_VAR qfu ( text.psz_string ? text.psz_string : psz_var )
1011
1012 void QVLCMenu::UpdateItem( intf_thread_t *p_intf, QMenu *menu,
1013         const char *psz_var, vlc_object_t *p_object, bool b_submenu )
1014 {
1015     vlc_value_t val, text;
1016     int i_type;
1017
1018     QAction *action = FindActionWithVar( menu, psz_var );
1019     if( action )
1020         DeleteNonStaticEntries( action->menu() );
1021
1022     if( !p_object )
1023         return;
1024
1025     /* Check the type of the object variable */
1026     if( !strcmp( psz_var, "audio-es" )
1027      || !strcmp( psz_var, "video-es" ) )
1028         i_type = VLC_VAR_INTEGER | VLC_VAR_HASCHOICE;
1029     else
1030         i_type = var_Type( p_object, psz_var );
1031
1032     switch( i_type & VLC_VAR_TYPE )
1033     {
1034         case VLC_VAR_VOID:
1035         case VLC_VAR_BOOL:
1036         case VLC_VAR_VARIABLE:
1037         case VLC_VAR_STRING:
1038         case VLC_VAR_INTEGER:
1039         case VLC_VAR_FLOAT:
1040             break;
1041         default:
1042             /* Variable doesn't exist or isn't handled */
1043             return;
1044     }
1045
1046     /* Make sure we want to display the variable */
1047     if( menu->isEmpty() && IsMenuEmpty( psz_var, p_object ) )
1048         return;
1049
1050     /* Get the descriptive name of the variable */
1051     int i_ret = var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
1052     if( i_ret != VLC_SUCCESS )
1053     {
1054         text.psz_string = NULL;
1055     }
1056
1057     if( !action )
1058     {
1059         action = new QAction( TEXT_OR_VAR, menu );
1060         menu->addAction( action );
1061         action->setData( psz_var );
1062     }
1063
1064     /* Some specific stuff */
1065     bool forceDisabled = false;
1066     if( !strcmp( psz_var, "spu-es" ) )
1067     {
1068         vlc_object_t *p_vout = ( vlc_object_t* )( vlc_object_find( p_intf,
1069                                     VLC_OBJECT_VOUT, FIND_ANYWHERE ) );
1070         forceDisabled = ( p_vout == NULL );
1071         if( p_vout )
1072             vlc_object_release( p_vout );
1073     }
1074
1075     if( i_type & VLC_VAR_HASCHOICE )
1076     {
1077         /* Append choices menu */
1078         if( b_submenu )
1079         {
1080             QMenu *submenu;
1081             submenu = action->menu();
1082             if( !submenu )
1083             {
1084                 submenu = new QMenu( menu );
1085                 action->setMenu( submenu );
1086             }
1087
1088             action->setEnabled(
1089                CreateChoicesMenu( submenu, psz_var, p_object, true ) == 0 );
1090             if( forceDisabled )
1091                 action->setEnabled( false );
1092         }
1093         else
1094             CreateChoicesMenu( menu, psz_var, p_object, true );
1095         FREENULL( text.psz_string );
1096         return;
1097     }
1098
1099     switch( i_type & VLC_VAR_TYPE )
1100     {
1101         case VLC_VAR_VOID:
1102             var_Get( p_object, psz_var, &val );
1103             CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
1104                     p_object->i_object_id, val, i_type );
1105             break;
1106
1107         case VLC_VAR_BOOL:
1108             var_Get( p_object, psz_var, &val );
1109             val.b_bool = !val.b_bool;
1110             CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
1111                     p_object->i_object_id, val, i_type, !val.b_bool );
1112             break;
1113     }
1114     FREENULL( text.psz_string );
1115 }
1116
1117
1118 int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
1119         vlc_object_t *p_object, bool b_root )
1120 {
1121     vlc_value_t val, val_list, text_list;
1122     int i_type, i;
1123
1124     /* Check the type of the object variable */
1125     i_type = var_Type( p_object, psz_var );
1126
1127     /* Make sure we want to display the variable */
1128     if( submenu->isEmpty() && IsMenuEmpty( psz_var, p_object, b_root ) )
1129         return VLC_EGENERIC;
1130
1131     switch( i_type & VLC_VAR_TYPE )
1132     {
1133         case VLC_VAR_VOID:
1134         case VLC_VAR_BOOL:
1135         case VLC_VAR_VARIABLE:
1136         case VLC_VAR_STRING:
1137         case VLC_VAR_INTEGER:
1138         case VLC_VAR_FLOAT:
1139             break;
1140         default:
1141             /* Variable doesn't exist or isn't handled */
1142             return VLC_EGENERIC;
1143     }
1144
1145     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
1146                 &val_list, &text_list ) < 0 )
1147     {
1148         return VLC_EGENERIC;
1149     }
1150
1151 #define NORMAL_OR_RADIO i_type & VLC_VAR_ISCOMMAND ? ITEM_NORMAL: ITEM_RADIO
1152 #define NOTCOMMAND !( i_type & VLC_VAR_ISCOMMAND )
1153 #define CURVAL val_list.p_list->p_values[i]
1154 #define CURTEXT text_list.p_list->p_values[i].psz_string
1155
1156     for( i = 0; i < val_list.p_list->i_count; i++ )
1157     {
1158         vlc_value_t another_val;
1159         QString menutext;
1160         QMenu *subsubmenu = new QMenu( submenu );
1161
1162         switch( i_type & VLC_VAR_TYPE )
1163         {
1164             case VLC_VAR_VARIABLE:
1165                 CreateChoicesMenu( subsubmenu, CURVAL.psz_string, p_object, false );
1166                 subsubmenu->setTitle( qfu( CURTEXT ? CURTEXT :CURVAL.psz_string ) );
1167                 submenu->addMenu( subsubmenu );
1168                 break;
1169
1170             case VLC_VAR_STRING:
1171                 var_Get( p_object, psz_var, &val );
1172                 another_val.psz_string = strdup( CURVAL.psz_string );
1173                 menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
1174                 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
1175                         p_object->i_object_id, another_val, i_type,
1176                         NOTCOMMAND && val.psz_string &&
1177                         !strcmp( val.psz_string, CURVAL.psz_string ) );
1178
1179                 free( val.psz_string );
1180                 break;
1181
1182             case VLC_VAR_INTEGER:
1183                 var_Get( p_object, psz_var, &val );
1184                 if( CURTEXT ) menutext = qfu( CURTEXT );
1185                 else menutext.sprintf( "%d", CURVAL.i_int );
1186                 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
1187                         p_object->i_object_id, CURVAL, i_type,
1188                         NOTCOMMAND && CURVAL.i_int == val.i_int );
1189                 break;
1190
1191             case VLC_VAR_FLOAT:
1192                 var_Get( p_object, psz_var, &val );
1193                 if( CURTEXT ) menutext = qfu( CURTEXT );
1194                 else menutext.sprintf( "%.2f", CURVAL.f_float );
1195                 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
1196                         p_object->i_object_id, CURVAL, i_type,
1197                         NOTCOMMAND && CURVAL.f_float == val.f_float );
1198                 break;
1199
1200             default:
1201                 break;
1202         }
1203     }
1204     currentGroup = NULL;
1205
1206     /* clean up everything */
1207     var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
1208
1209 #undef NORMAL_OR_RADIO
1210 #undef NOTCOMMAND
1211 #undef CURVAL
1212 #undef CURTEXT
1213     return VLC_SUCCESS;
1214 }
1215
1216 void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
1217         QString text, QString help,
1218         int i_item_type, int i_object_id,
1219         vlc_value_t val, int i_val_type,
1220         bool checked )
1221 {
1222     QAction *action = FindActionWithVar( menu, psz_var );
1223     if( !action )
1224     {
1225         /* This is a value */
1226         action = FindActionWithText( menu, text );
1227         if( !action )
1228         {
1229             action = new QAction( text, menu );
1230             menu->addAction( action );
1231         }
1232     }
1233
1234     action->setText( text );
1235     action->setToolTip( help );
1236
1237     action->setEnabled( i_object_id != 0 );
1238
1239     if( i_item_type == ITEM_CHECK )
1240     {
1241         action->setCheckable( true );
1242     }
1243     else if( i_item_type == ITEM_RADIO )
1244     {
1245         action->setCheckable( true );
1246         if( !currentGroup )
1247             currentGroup = new QActionGroup( menu );
1248         currentGroup->addAction( action );
1249     }
1250
1251     action->setChecked( checked );
1252
1253     MenuItemData *itemData = new MenuItemData( i_object_id, i_val_type,
1254             val, psz_var );
1255     CONNECT( action, triggered(), THEDP->menusMapper, map() );
1256     THEDP->menusMapper->setMapping( action, itemData );
1257     menu->addAction( action );
1258 }
1259
1260 void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
1261 {
1262     MenuItemData *itemData = qobject_cast<MenuItemData *>( data );
1263     vlc_object_t *p_object = ( vlc_object_t * )vlc_object_get( itemData->i_object_id );
1264     if( p_object == NULL ) return;
1265
1266     var_Set( p_object, itemData->psz_var, itemData->val );
1267     vlc_object_release( p_object );
1268 }
1269