1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: ClÃment Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
27 #include <QActionGroup>
28 #include <QSignalMapper>
30 #include <vlc_intf_strings.h>
32 #include "main_interface.hpp"
34 #include "dialogs_provider.hpp"
35 #include "input_manager.hpp"
44 static QActionGroup *currentGroup;
46 // Add static entries to menus
47 #define DP_SADD( text, help, icon, slot ) { if( strlen(icon) > 0 ) { QAction *action = menu->addAction( text, THEDP, SLOT( slot ) ); action->setIcon(QIcon(icon));} else { menu->addAction( text, THEDP, SLOT( slot ) ); } }
48 #define MIM_SADD( text, help, icon, slot ) { if( strlen(icon) > 0 ) { QAction *action = menu->addAction( text, THEMIM, SLOT( slot ) ); action->setIcon(QIcon(icon));} else { menu->addAction( text, THEMIM, SLOT( slot ) ); } }
51 /*****************************************************************************
52 * Definitions of variables for the dynamic menus
53 *****************************************************************************/
54 #define PUSH_VAR( var ) varnames.push_back( var ); \
55 objects.push_back( p_object->i_object_id )
57 #define PUSH_SEPARATOR if( objects.size() != i_last_separator ) { \
58 objects.push_back( 0 ); varnames.push_back( "" ); \
59 i_last_separator = objects.size(); }
61 static int InputAutoMenuBuilder( vlc_object_t *p_object,
63 vector<const char *> &varnames )
65 PUSH_VAR( "bookmark");
67 PUSH_VAR ("chapter" );
68 PUSH_VAR( "program" );
69 PUSH_VAR( "navigation" );
70 PUSH_VAR( "dvd_menus" );
74 static int VideoAutoMenuBuilder( vlc_object_t *p_object,
76 vector<const char *> &varnames )
78 PUSH_VAR( "fullscreen" );
80 PUSH_VAR( "deinterlace" );
81 PUSH_VAR( "aspect-ratio" );
83 PUSH_VAR( "video-on-top" );
84 PUSH_VAR( "directx-wallpaper" );
85 PUSH_VAR( "video-snapshot" );
87 vlc_object_t *p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
90 if( p_dec_obj != NULL )
92 vlc_object_t *p_object = p_dec_obj;
93 PUSH_VAR( "ffmpeg-pp-q" );
94 vlc_object_release( p_dec_obj );
99 static int AudioAutoMenuBuilder( vlc_object_t *p_object,
100 vector<int> &objects,
101 vector<const char *> &varnames )
103 PUSH_VAR( "audio-device" );
104 PUSH_VAR( "audio-channels" );
105 PUSH_VAR( "visual" );
106 PUSH_VAR( "equalizer" );
110 /*****************************************************************************
112 *****************************************************************************/
114 #define BAR_ADD( func, title ) { \
115 QMenu *menu = func; menu->setTitle( title ); bar->addMenu( menu ); }
117 #define BAR_DADD( func, title, id ) { \
118 QMenu *menu = func; menu->setTitle( title ); bar->addMenu( menu ); \
119 MenuFunc *f = new MenuFunc( menu, id ); \
120 CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
121 THEDP->menusUpdateMapper->setMapping( menu, f ); }
123 void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
124 bool playlist, bool adv_controls_enabled,
125 bool visual_selector_enabled )
127 QMenuBar *bar = mi->menuBar();
128 BAR_ADD( FileMenu(), qtr("Media") );
131 BAR_ADD( PlaylistMenu( mi,p_intf ), qtr("Playlist" ) );
133 BAR_ADD( ToolsMenu( p_intf, mi, adv_controls_enabled,
134 visual_selector_enabled ), qtr("Tools") );
135 BAR_DADD( VideoMenu( p_intf, NULL ), qtr("Video"), 1 );
136 BAR_DADD( AudioMenu( p_intf, NULL ), qtr("Audio"), 2 );
137 BAR_DADD( NavigMenu( p_intf, NULL ), qtr("Navigation"), 3 );
139 BAR_ADD( HelpMenu(), qtr("Help" ) );
141 QMenu *QVLCMenu::FileMenu()
143 QMenu *menu = new QMenu();
144 DP_SADD( qtr("Quick &Open File...") , "", "", simpleOpenDialog() );
145 DP_SADD( qtr("&Advanced Open..." ), "", "", openDialog() );
146 menu->addSeparator();
147 DP_SADD( qtr("Streaming..."), "", "", streamingDialog() );
148 menu->addSeparator();
149 DP_SADD( qtr("&Quit") , "", "", quit() );
153 QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
155 QMenu *menu = new QMenu();
156 menu->addMenu( SDMenu( p_intf ) );
157 menu->addSeparator();
159 DP_SADD( qtr(I_PL_LOAD), "", "", openPlaylist() );
160 DP_SADD( qtr(I_PL_SAVE), "", "", savePlaylist() );
161 menu->addSeparator();
162 menu->addAction( qtr("Undock from interface"), mi,
163 SLOT( undockPlaylist() ) );
167 QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
168 bool adv_controls_enabled,
169 bool visual_selector_enabled, bool with_intf )
171 QMenu *menu = new QMenu();
174 QMenu *intfmenu = InterfacesMenu( p_intf, NULL );
175 intfmenu->setTitle( qtr("Interfaces" ) );
176 menu->addMenu( intfmenu );
177 menu->addSeparator();
179 DP_SADD( qtr(I_MENU_MSG), "", "", messagesDialog() );
180 DP_SADD( qtr(I_MENU_INFO) , "", "", mediaInfoDialog() );
181 DP_SADD( qtr(I_MENU_EXT), "","",extendedDialog() );
184 menu->addSeparator();
185 QAction *adv = menu->addAction( qtr("Advanced controls" ),
186 mi, SLOT( advanced() ) );
187 adv->setCheckable( true );
188 if( adv_controls_enabled ) adv->setChecked( true );
190 adv = menu->addAction( qtr("Visualizations selector" ),
191 mi, SLOT( visual() ) );
192 adv->setCheckable( true );
193 if( visual_selector_enabled ) adv->setChecked( true );
196 menu->addSeparator();
197 DP_SADD( qtr("Preferences"), "", "", prefsDialog() );
201 QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
204 vector<const char *> varnames;
205 /** \todo add "switch to XXX" */
206 varnames.push_back( "intf-add" );
207 objects.push_back( p_intf->i_object_id );
209 QMenu *menu = Populate( p_intf, current, varnames, objects );
211 if( !p_intf->pf_show_dialog )
213 menu->addSeparator();
214 menu->addAction( qtr("Switch to skins"), THEDP, SLOT(switchToSkins()) );
217 CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() );
218 THEDP->menusUpdateMapper->setMapping( menu, 4 );
222 QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
225 vector<const char *> varnames;
227 vlc_object_t *p_object = (vlc_object_t *)vlc_object_find( p_intf,
228 VLC_OBJECT_INPUT, FIND_ANYWHERE );
229 if( p_object != NULL )
231 PUSH_VAR( "audio-es" );
232 vlc_object_release( p_object );
235 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
239 AudioAutoMenuBuilder( p_object, objects, varnames );
240 vlc_object_release( p_object );
242 return Populate( p_intf, current, varnames, objects );
246 QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
248 vlc_object_t *p_object;
250 vector<const char *> varnames;
252 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
254 if( p_object != NULL )
256 PUSH_VAR( "video-es" );
257 PUSH_VAR( "spu-es" );
258 vlc_object_release( p_object );
261 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
263 if( p_object != NULL )
265 VideoAutoMenuBuilder( p_object, objects, varnames );
266 vlc_object_release( p_object );
268 return Populate( p_intf, current, varnames, objects );
271 QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *current )
273 vlc_object_t *p_object;
275 vector<const char *> varnames;
278 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
280 if( p_object != NULL )
282 InputAutoMenuBuilder( p_object, objects, varnames );
283 PUSH_VAR( "prev-title"); PUSH_VAR ( "next-title" );
284 PUSH_VAR( "prev-chapter"); PUSH_VAR( "next-chapter" );
285 vlc_object_release( p_object );
287 return Populate( p_intf, current, varnames, objects );
290 QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
292 QMenu *menu = new QMenu();
293 menu->setTitle( qtr(I_PL_SD) );
294 vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
297 for( int i_index = 0 ; i_index < p_list->i_count; i_index++ )
299 module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object ;
300 if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
303 for( int i_index = 0 ; i_index < p_list->i_count; i_index++ )
305 module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object;
306 if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
308 QAction *a = new QAction( qfu( p_parser->psz_longname ), menu );
309 a->setCheckable( true );
310 /* hack to handle submodules properly */
312 while( p_parser->pp_shortcuts[++i] != NULL );
314 if( playlist_IsServicesDiscoveryLoaded( THEPL,
315 i>=0?p_parser->pp_shortcuts[i] : p_parser->psz_object_name ) )
317 a->setChecked( true );
319 CONNECT( a , triggered(), THEDP->SDMapper, map() );
320 THEDP->SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
321 p_parser->psz_object_name );
322 menu->addAction( a );
325 vlc_list_release( p_list );
329 QMenu *QVLCMenu::HelpMenu()
331 QMenu *menu = new QMenu();
332 DP_SADD( qtr("Help") , "", "", helpDialog() );
333 menu->addSeparator();
334 DP_SADD( qtr(I_MENU_ABOUT), "", "", aboutDialog() );
339 /*****************************************************************************
341 *****************************************************************************/
342 #define POPUP_BOILERPLATE \
343 unsigned int i_last_separator = 0; \
344 vector<int> objects; \
345 vector<const char *> varnames; \
346 input_thread_t *p_input = THEMIM->getInput();
348 #define CREATE_POPUP \
349 QMenu *menu = new QMenu(); \
350 Populate( p_intf, menu, varnames, objects ); \
351 p_intf->p_sys->p_popup_menu = menu; \
352 menu->popup( QCursor::pos() ); \
353 p_intf->p_sys->p_popup_menu = NULL; \
354 i_last_separator = 0;
356 #define POPUP_STATIC_ENTRIES \
358 MIM_SADD( qtr("Stop"), "", "", stop() ); \
359 MIM_SADD( qtr("Previous"), "", "", prev() ); \
360 MIM_SADD( qtr("Next"), "", "", next() ); \
363 var_Get( p_input, "state", &val ); \
364 if( val.i_int == PAUSE_S ) \
365 MIM_SADD( qtr("Play"), "", "", togglePlayPause() ) \
367 MIM_SADD( qtr("Pause"), "", "", togglePlayPause() ) \
369 else if( THEPL->items.i_size && THEPL->i_enabled ) \
370 MIM_SADD( qtr("Play"), "", "", togglePlayPause() ) \
372 QMenu *intfmenu = InterfacesMenu( p_intf, NULL ); \
373 intfmenu->setTitle( qtr("Interfaces" ) ); \
374 menu->addMenu( intfmenu ); \
376 QMenu *toolsmenu = ToolsMenu( p_intf, NULL, false, false ); \
377 toolsmenu->setTitle( qtr("Tools" ) ); \
378 menu->addMenu( toolsmenu ); \
380 void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
385 vlc_object_yield( p_input );
386 varnames.push_back( "video-es" );
387 objects.push_back( p_input->i_object_id );
388 varnames.push_back( "spu-es" );
389 objects.push_back( p_input->i_object_id );
390 vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
391 VLC_OBJECT_VOUT, FIND_CHILD );
394 VideoAutoMenuBuilder( p_vout, objects, varnames );
395 vlc_object_release( p_vout );
397 vlc_object_release( p_input );
402 void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
407 vlc_object_yield( p_input );
408 varnames.push_back( "audio-es" );
409 objects.push_back( p_input->i_object_id );
410 vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
411 VLC_OBJECT_AOUT, FIND_ANYWHERE );
414 AudioAutoMenuBuilder( p_aout, objects, varnames );
415 vlc_object_release( p_aout );
417 vlc_object_release( p_input );
422 /* Navigation stuff, and general */
423 void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
428 vlc_object_yield( p_input );
429 varnames.push_back( "audio-es" );
430 InputAutoMenuBuilder( VLC_OBJECT(p_input), objects, varnames );
434 QMenu *menu = new QMenu();
435 Populate( p_intf, menu, varnames, objects );
436 menu->addSeparator();
437 POPUP_STATIC_ENTRIES;
439 p_intf->p_sys->p_popup_menu = menu;
440 menu->popup( QCursor::pos() );
441 p_intf->p_sys->p_popup_menu = NULL;
444 void QVLCMenu::PopupMenu( intf_thread_t *p_intf )
449 vlc_object_yield( p_input );
450 InputAutoMenuBuilder( VLC_OBJECT(p_input), objects, varnames );
454 varnames.push_back( "video-es" );
455 objects.push_back( p_input->i_object_id );
456 varnames.push_back( "spu-es" );
457 objects.push_back( p_input->i_object_id );
458 vlc_object_t *p_vout = (vlc_object_t *)vlc_object_find( p_input,
459 VLC_OBJECT_VOUT, FIND_CHILD );
462 VideoAutoMenuBuilder( p_vout, objects, varnames );
463 vlc_object_release( p_vout );
467 varnames.push_back( "audio-es" );
468 objects.push_back( p_input->i_object_id );
469 vlc_object_t *p_aout = (vlc_object_t *)vlc_object_find( p_input,
470 VLC_OBJECT_AOUT, FIND_ANYWHERE );
473 AudioAutoMenuBuilder( p_aout, objects, varnames );
474 vlc_object_release( p_aout );
478 QMenu *menu = new QMenu();
479 Populate( p_intf, menu, varnames, objects );
480 menu->addSeparator();
481 POPUP_STATIC_ENTRIES;
483 p_intf->p_sys->p_popup_menu = menu;
484 menu->popup( QCursor::pos() );
485 p_intf->p_sys->p_popup_menu = NULL;
489 #undef PUSH_SEPARATOR
491 /*************************************************************************
492 * Builders for automenus
493 *************************************************************************/
494 QMenu * QVLCMenu::Populate( intf_thread_t *p_intf, QMenu *current,
495 vector< const char *> & varnames,
496 vector<int> & objects, bool append )
498 QMenu *menu = current;
506 vlc_object_t *p_object;
507 vlc_bool_t b_section_empty = VLC_FALSE;
510 #define APPEND_EMPTY { QAction *action = menu->addAction( qtr("Empty" ) ); \
511 action->setEnabled( false ); }
513 for( i = 0; i < (int)objects.size() ; i++ )
515 if( !varnames[i] || !*varnames[i] )
517 if( b_section_empty )
519 menu->addSeparator();
520 b_section_empty = VLC_TRUE;
524 if( objects[i] == 0 )
526 /// \bug What is this ?
527 // Append( menu, varnames[i], NULL );
528 b_section_empty = VLC_FALSE;
532 p_object = (vlc_object_t *)vlc_object_get( p_intf,
534 if( p_object == NULL ) continue;
536 b_section_empty = VLC_FALSE;
537 /* Ugly specific stuff */
538 if( strstr(varnames[i], "intf-add" ) )
539 CreateItem( menu, varnames[i], p_object, false );
541 CreateItem( menu, varnames[i], p_object, true );
542 vlc_object_release( p_object );
545 /* Special case for empty menus */
546 if( menu->actions().size() == 0 || b_section_empty )
552 /*****************************************************************************
554 *****************************************************************************/
556 static bool IsMenuEmpty( const char *psz_var, vlc_object_t *p_object,
559 vlc_value_t val, val_list;
560 int i_type, i_result, i;
562 /* Check the type of the object variable */
563 i_type = var_Type( p_object, psz_var );
565 /* Check if we want to display the variable */
566 if( !(i_type & VLC_VAR_HASCHOICE) ) return FALSE;
568 var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
569 if( val.i_int == 0 ) return TRUE;
571 if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE )
573 /* Very evil hack ! intf-switch can have only one value */
574 if( !strcmp( psz_var, "intf-switch" ) ) return FALSE;
575 if( val.i_int == 1 && b_root ) return TRUE;
579 /* Check children variables in case of VLC_VAR_VARIABLE */
580 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
585 for( i = 0, i_result = TRUE; i < val_list.p_list->i_count; i++ )
587 if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
595 /* clean up everything */
596 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, NULL );
601 void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
602 vlc_object_t *p_object, bool b_submenu )
604 vlc_value_t val, text;
607 /* Check the type of the object variable */
608 i_type = var_Type( p_object, psz_var );
610 switch( i_type & VLC_VAR_TYPE )
614 case VLC_VAR_VARIABLE:
616 case VLC_VAR_INTEGER:
620 /* Variable doesn't exist or isn't handled */
624 /* Make sure we want to display the variable */
625 if( IsMenuEmpty( psz_var, p_object ) ) return;
627 /* Get the descriptive name of the variable */
628 var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
630 if( i_type & VLC_VAR_HASCHOICE )
632 /* Append choices menu */
635 QMenu *submenu = new QMenu();
636 submenu->setTitle( qfu( text.psz_string ?
637 text.psz_string : psz_var ) );
638 if( CreateChoicesMenu( submenu, psz_var, p_object, true ) == 0)
639 menu->addMenu( submenu );
642 CreateChoicesMenu( menu, psz_var, p_object, true );
643 FREENULL( text.psz_string );
647 #define TEXT_OR_VAR qfu ( text.psz_string ? text.psz_string : psz_var )
649 switch( i_type & VLC_VAR_TYPE )
652 var_Get( p_object, psz_var, &val );
653 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_NORMAL,
654 p_object->i_object_id, val, i_type );
658 var_Get( p_object, psz_var, &val );
659 CreateAndConnect( menu, psz_var, TEXT_OR_VAR, "", ITEM_CHECK,
660 p_object->i_object_id, val, i_type, val.b_bool );
663 FREENULL( text.psz_string );
667 int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
668 vlc_object_t *p_object, bool b_root )
670 vlc_value_t val, val_list, text_list;
673 /* Check the type of the object variable */
674 i_type = var_Type( p_object, psz_var );
676 /* Make sure we want to display the variable */
677 if( IsMenuEmpty( psz_var, p_object, b_root ) ) return VLC_EGENERIC;
679 switch( i_type & VLC_VAR_TYPE )
683 case VLC_VAR_VARIABLE:
685 case VLC_VAR_INTEGER:
689 /* Variable doesn't exist or isn't handled */
693 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
694 &val_list, &text_list ) < 0 )
698 #define NORMAL_OR_RADIO i_type & VLC_VAR_ISCOMMAND ? ITEM_NORMAL: ITEM_RADIO
699 #define NOTCOMMAND !(i_type & VLC_VAR_ISCOMMAND)
700 #define CURVAL val_list.p_list->p_values[i]
701 #define CURTEXT text_list.p_list->p_values[i].psz_string
703 for( i = 0; i < val_list.p_list->i_count; i++ )
705 vlc_value_t another_val;
707 QMenu *subsubmenu = new QMenu();
709 switch( i_type & VLC_VAR_TYPE )
711 case VLC_VAR_VARIABLE:
712 CreateChoicesMenu( subsubmenu, CURVAL.psz_string, p_object, false );
713 subsubmenu->setTitle( qfu( CURTEXT ? CURTEXT :CURVAL.psz_string ) );
714 submenu->addMenu( subsubmenu );
718 var_Get( p_object, psz_var, &val );
719 another_val.psz_string = strdup( CURVAL.psz_string );
720 menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
721 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
722 p_object->i_object_id, another_val, i_type,
723 NOTCOMMAND && val.psz_string &&
724 !strcmp( val.psz_string, CURVAL.psz_string ) );
726 if( val.psz_string ) free( val.psz_string );
729 case VLC_VAR_INTEGER:
730 var_Get( p_object, psz_var, &val );
731 if( CURTEXT ) menutext = qfu( CURTEXT );
732 else menutext.sprintf( "%d", CURVAL.i_int);
733 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
734 p_object->i_object_id, CURVAL, i_type,
735 NOTCOMMAND && CURVAL.i_int == val.i_int );
739 var_Get( p_object, psz_var, &val );
740 if( CURTEXT ) menutext = qfu( CURTEXT );
741 else menutext.sprintf( "%.2f", CURVAL.f_float );
742 CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
743 p_object->i_object_id, CURVAL, i_type,
744 NOTCOMMAND && CURVAL.f_float == val.f_float );
753 /* clean up everything */
754 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
756 #undef NORMAL_OR_RADIO
763 void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var,
764 QString text, QString help,
765 int i_item_type, int i_object_id,
766 vlc_value_t val, int i_val_type,
769 QAction *action = new QAction( text, menu );
770 action->setText( text );
771 action->setToolTip( help );
773 if( i_item_type == ITEM_CHECK )
775 action->setCheckable( true );
777 else if( i_item_type == ITEM_RADIO )
779 action->setCheckable( true );
781 currentGroup = new QActionGroup(menu);
782 currentGroup->addAction( action );
787 action->setChecked( true );
789 MenuItemData *itemData = new MenuItemData( i_object_id, i_val_type,
791 CONNECT( action, triggered(), THEDP->menusMapper, map() );
792 THEDP->menusMapper->setMapping( action, itemData );
793 menu->addAction( action );
796 void QVLCMenu::DoAction( intf_thread_t *p_intf, QObject *data )
798 MenuItemData *itemData = qobject_cast<MenuItemData *>(data);
799 vlc_object_t *p_object = (vlc_object_t *)vlc_object_get( p_intf,
800 itemData->i_object_id );
801 if( p_object == NULL ) return;
803 var_Set( p_object, itemData->psz_var, itemData->val );
804 vlc_object_release( p_object );