- QMenu *menu = new QMenu();
- menu->setTitle( qtr( "Additional sources" ) );
- vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
- FIND_ANYWHERE );
- int i_num = 0;
- for( int i_index = 0 ; i_index < p_list->i_count; i_index++ )
- {
- module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object ;
- if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
- i_num++;
- }
- for( int i_index = 0 ; i_index < p_list->i_count; i_index++ )
- {
- module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object;
- if( !strcmp( p_parser->psz_capability, "services_discovery" ) )
- {
- QAction *a = new QAction( qfu( p_parser->psz_longname ), menu );
- a->setCheckable( true );
- /* hack to handle submodules properly */
- int i = -1;
- while( p_parser->pp_shortcuts[++i] != NULL );
- i--;
- if( playlist_IsServicesDiscoveryLoaded( THEPL,
- i>=0?p_parser->pp_shortcuts[i] : p_parser->psz_object_name ) )
- {
- a->setChecked( true );
- }
- connect( a , SIGNAL( triggered() ), SDMapper, SLOT( map() ) );
- SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
- p_parser->psz_object_name );
- menu->addAction( a );
- }
- }
- vlc_list_release( p_list );
- return menu;