1 /***************************************************************************
2 kde_menu.cpp - description
4 begin : Thu Apr 12 2001
5 copyright : (C) 2001 by andres
7 ***************************************************************************/
14 KTitleMenu::KTitleMenu( intf_thread_t *p_intf, QWidget *parent, const char *name ) : KPopupMenu( parent, name )
16 fInterfaceThread = p_intf;
17 connect( this, SIGNAL( aboutToShow() ), this, SLOT( regenerateSlot() ) );
18 fLanguageList = new KActionMenu( "Language", 0, this );
21 KTitleMenu::~KTitleMenu()
25 void KTitleMenu::regenerateSlot()
27 // removal of elements and disconnection of signal/slots happen transparently on delete
29 fLanguageList = new KActionMenu( "Language", 0, this );
32 vlc_mutex_lock( &fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock );
34 for( int i = 0 ; i < fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.i_es_number ; i++ )
36 if( fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.pp_es[i]->i_cat /* == i_cat */ )
39 QString language( fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.pp_es[i]->psz_desc );
40 if ( QString::null == language )
42 language += i18n( "Language" );
43 language += " " + i_item;
45 KRadioAction *action = new KRadioAction( language, 0, this, "language_action" );
46 fLanguageList->insert( action );
48 if( /* p_es == */ fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.pp_es[i] )
50 /* don't lose p_item when we append into menu */
51 //p_item_active = p_item;
56 vlc_mutex_unlock( &fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock );
59 /* link the new menu to the menubar item */
60 gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
62 /* acitvation will call signals so we can only do it
63 * when submenu is attached to menu - to get intf_window */
64 if( p_item_active != NULL )
66 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
71 /* be sure that menu is sensitive if non empty */
74 fLanguageList->setEnabled( true );
78 /** this method is called when the user selects a language */
79 void KTitleMenu::languageSelectedSlot()