1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
/***************************************************************************
ktitlemenu.cpp - description
-------------------
begin : Thu Apr 12 2001
copyright : (C) 2001 by andres
email : dae@chez.com
***************************************************************************/
#include "ktitlemenu.h"
#include <kaction.h>
#include <klocale.h>
KTitleMenu::KTitleMenu( intf_thread_t *p_intf, QWidget *parent, const char *name ) : KPopupMenu( parent, name )
{
fInterfaceThread = p_intf;
connect( this, SIGNAL( aboutToShow() ), this, SLOT( regenerateSlot() ) );
fLanguageList = new KActionMenu( "Language", 0, this );
}
KTitleMenu::~KTitleMenu()
{
}
void KTitleMenu::regenerateSlot()
{
// removal of elements and disconnection of signal/slots happen transparently on delete
delete fLanguageList;
fLanguageList = new KActionMenu( "Language", 0, this );
int i_item = 0;
vlc_mutex_lock( &fInterfaceThread->p_input->stream.stream_lock );
for( int i = 0 ; i < fInterfaceThread->p_input->stream.i_es_number ; i++ )
{
if( fInterfaceThread->p_input->stream.pp_es[i]->i_cat /* == i_cat */ )
{
i_item++;
QString language( fInterfaceThread->p_input->stream.pp_es[i]->psz_desc );
if ( QString::null == language )
{
language += i18n( "Language" );
language += " " + i_item;
}
KRadioAction *action = new KRadioAction( language, 0, this, "language_action" );
fLanguageList->insert( action );
if( /* p_es == */ fInterfaceThread->p_input->stream.pp_es[i] )
{
/* don't lose p_item when we append into menu */
//p_item_active = p_item;
}
}
}
vlc_mutex_unlock( &fInterfaceThread->p_input->stream.stream_lock );
// /* link the new menu to the menubar item */
// gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu );
//
// /* acitvation will call signals so we can only do it
// * when submenu is attached to menu - to get intf_window */
// if( p_item_active != NULL )
// {
// gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
// TRUE );
// }
/* be sure that menu is sensitive if non empty */
if ( i_item > 0 )
{
fLanguageList->setEnabled( true );
}
}
/** this method is called when the user selects a language */
void KTitleMenu::languageSelectedSlot()
{
}
|