1 /***************************************************************************
4 begin : Thu Apr 12 2001
5 copyright : (C) 2001 by andres
7 ***************************************************************************/
15 KTitleMenu::KTitleMenu( intf_thread_t *p_intf, QWidget *parent, const char *name ) : KPopupMenu( parent, name )
17 fInterfaceThread = p_intf;
18 connect( this, SIGNAL( aboutToShow() ), this, SLOT( regenerateSlot() ) );
19 fLanguageList = new KActionMenu( "Language", 0, this );
22 KTitleMenu::~KTitleMenu()
26 void KTitleMenu::regenerateSlot()
28 // removal of elements and disconnection of signal/slots happen transparently on delete
30 fLanguageList = new KActionMenu( "Language", 0, this );
33 vlc_mutex_lock( &fInterfaceThread->p_sys->p_input->stream.stream_lock );
35 for( unsigned int i = 0 ;
36 i < fInterfaceThread->p_sys->p_input->stream.i_es_number ;
39 if( fInterfaceThread->p_sys->p_input->stream.pp_es[i]->i_cat /* == i_cat */ )
42 QString language( fInterfaceThread->p_sys->p_input->stream.pp_es[i]->psz_desc );
43 if ( QString::null == language )
45 language += i18n( "Language" );
46 language += " " + i_item;
48 KRadioAction *action = new KRadioAction( language, 0, this, "language_action" );
49 fLanguageList->insert( action );
51 if( /* p_es == */ fInterfaceThread->p_sys->p_input->stream.pp_es[i] )
53 /* don't lose p_item when we append into menu */
54 //p_item_active = p_item;
59 vlc_mutex_unlock( &fInterfaceThread->p_sys->p_input->stream.stream_lock );
62 /* link the new menu to the menubar item */
63 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
65 /* acitvation will call signals so we can only do it
66 * when submenu is attached to menu - to get intf_window */
67 if( p_item_active != NULL )
69 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
74 /* be sure that menu is sensitive if non empty */
77 fLanguageList->setEnabled( true );
81 /** this method is called when the user selects a language */
82 void KTitleMenu::languageSelectedSlot()