Changeset 382926a8c14406854dae7eb79de693ffe1284ed0

Show
Ignore:
Timestamp:
09/11/04 00:47:32 (4 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1099957652 +0000
git-parent:

[e56a6361d0a683a25522ece9b54dcad1c740ec56]

git-author:
Clément Stenac <zorglub@videolan.org> 1099957652 +0000
Message:

include services discovery in interface

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_playlist.h

    r8b61d4e r382926a  
    232232VLC_EXPORT( void, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *)); 
    233233VLC_EXPORT( int, playlist_AddSDModules, (playlist_t *, char *)); 
     234VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *)); 
     235 
    234236 
    235237/* Item management functions (act on items) */ 
  • modules/gui/wxwindows/menus.cpp

    ra53e5d1 r382926a  
    978978        if( p_intf->p_sys->p_popup_menu ) 
    979979        { 
    980             p_menuitem =  
     980            p_menuitem = 
    981981                p_intf->p_sys->p_popup_menu->FindItem( event.GetId() ); 
    982982        } 
  • modules/gui/wxwindows/playlist.cpp

    r4ae5bec r382926a  
    108108    UpdateItem_Event, 
    109109 
     110    MenuDummy_Event = wxID_HIGHEST + 999, 
     111 
    110112    FirstView_Event = wxID_HIGHEST + 1000, 
     113    LastView_Event = wxID_HIGHEST + 1100, 
     114 
     115    FirstSD_Event = wxID_HIGHEST + 2000, 
     116    LastSD_Event = wxID_HIGHEST + 2100, 
    111117}; 
    112118 
     
    206212 
    207213    p_view_menu = NULL; 
     214    p_sd_menu = SDMenu(); 
    208215 
    209216    i_current_view = VIEW_SIMPLE; 
     
    222229    manage_menu->Append( AddFile_Event, wxU(_("&Simple Add...")) ); 
    223230    manage_menu->Append( AddMRL_Event, wxU(_("&Add MRL...")) ); 
     231    manage_menu->AppendSeparator(); 
     232    manage_menu->Append( MenuDummy_Event, wxU(_("Services discovery")), 
     233                         p_sd_menu ); 
    224234    manage_menu->AppendSeparator(); 
    225235    manage_menu->Append( Open_Event, wxU(_("&Open Playlist...")) ); 
     
    10911101void Playlist::OnSelectAll( wxCommandEvent& WXUNUSED(event) ) 
    10921102{ 
    1093 #if 0 
    1094     for( long item = 0; item < listview->GetItemCount(); item++ ) 
    1095     { 
    1096         listview->Select( item, TRUE ); 
    1097     } 
    1098 #endif 
    10991103} 
    11001104 
     
    12041208void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) ) 
    12051209{ 
    1206     /* We use the first selected item, so find it */ 
    1207 #if 0 
    1208     long i_item = listview->GetNextItem( -1, wxLIST_NEXT_ALL, 
    1209                                          wxLIST_STATE_SELECTED ); 
    1210     ShowInfos( i_item ); 
    1211 #endif 
    12121210} 
    12131211 
     
    12211219        return; 
    12221220    } 
    1223 #if 0 
    1224     long i_item = listview->GetNextItem( -1, wxLIST_NEXT_ALL, 
    1225                                          wxLIST_STATE_SELECTED ); 
    1226  
    1227     if( i_item >= 0 && i_item < p_playlist->i_size ) 
    1228     { 
    1229        Rebuild(); 
    1230     } 
    1231 #endif 
    12321221    vlc_object_release( p_playlist ); 
    12331222} 
     
    12671256        return; 
    12681257    } 
    1269  
    1270     int i_new_view = event.GetId() - FirstView_Event; 
    1271  
    1272     playlist_view_t *p_view = playlist_ViewFind( p_playlist, i_new_view ); 
    1273  
    1274     if( p_view != NULL ) 
    1275     { 
    1276         i_current_view = i_new_view; 
    1277         playlist_ViewUpdate( p_playlist, i_new_view ); 
    1278         Rebuild(); 
    1279         vlc_object_release( p_playlist ); 
    1280         return; 
    1281     } 
    1282     else if( i_new_view >= VIEW_FIRST_SORTED && i_new_view <= VIEW_LAST_SORTED ) 
    1283     { 
    1284         playlist_ViewInsert( p_playlist, i_new_view, "View" ); 
    1285         playlist_ViewUpdate( p_playlist, i_new_view ); 
    1286  
    1287         i_current_view = i_new_view; 
    1288  
    1289         Rebuild(); 
    1290     } 
    1291  
     1258    else if( event.GetId() < LastView_Event ) 
     1259    { 
     1260 
     1261        int i_new_view = event.GetId() - FirstView_Event; 
     1262 
     1263        playlist_view_t *p_view = playlist_ViewFind( p_playlist, i_new_view ); 
     1264 
     1265        if( p_view != NULL ) 
     1266        { 
     1267            i_current_view = i_new_view; 
     1268            playlist_ViewUpdate( p_playlist, i_new_view ); 
     1269            Rebuild(); 
     1270            vlc_object_release( p_playlist ); 
     1271            return; 
     1272        } 
     1273        else if( i_new_view >= VIEW_FIRST_SORTED && 
     1274                 i_new_view <= VIEW_LAST_SORTED ) 
     1275        { 
     1276            playlist_ViewInsert( p_playlist, i_new_view, "View" ); 
     1277            playlist_ViewUpdate( p_playlist, i_new_view ); 
     1278 
     1279            i_current_view = i_new_view; 
     1280 
     1281            Rebuild(); 
     1282        } 
     1283    } 
     1284    else if( event.GetId() >= FirstSD_Event && event.GetId() < LastSD_Event ) 
     1285    { 
     1286        if( !playlist_IsServicesDiscoveryLoaded( p_playlist, 
     1287                                pp_sds[event.GetId() - FirstSD_Event] ) ) 
     1288        { 
     1289            playlist_ServicesDiscoveryAdd( p_playlist, 
     1290                            pp_sds[event.GetId() - FirstSD_Event] ); 
     1291        } 
     1292        else 
     1293        { 
     1294            playlist_ServicesDiscoveryRemove( p_playlist, 
     1295                            pp_sds[event.GetId() - FirstSD_Event] ); 
     1296        } 
     1297    } 
    12921298    vlc_object_release( p_playlist ); 
    12931299} 
     
    13381344 
    13391345    return p_view_menu; 
     1346} 
     1347 
     1348wxMenu *Playlist::SDMenu() 
     1349{ 
     1350 
     1351    playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, 
     1352                              VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); 
     1353    if( !p_playlist ) 
     1354    { 
     1355        return NULL; 
     1356    } 
     1357    vlc_value_t val, val_list, text_list; 
     1358    p_sd_menu = new wxMenu; 
     1359 
     1360    vlc_list_t *p_list = vlc_list_find( p_playlist, VLC_OBJECT_MODULE, 
     1361                                        FIND_ANYWHERE ); 
     1362 
     1363    int i_number = 0; 
     1364    for( int i_index = 0; i_index < p_list->i_count; i_index++ ) 
     1365    { 
     1366        module_t * p_parser = (module_t *)p_list->p_values[i_index].p_object ; 
     1367 
     1368        if( !strcmp( p_parser->psz_capability, "services_discovery" ) ) 
     1369        { 
     1370            p_sd_menu->AppendCheckItem( FirstSD_Event + i_number , 
     1371                       wxU( p_parser->psz_longname ? p_parser->psz_longname : 
     1372                            p_parser->psz_shortname ) ); 
     1373 
     1374            if( playlist_IsServicesDiscoveryLoaded( p_playlist, 
     1375                                    p_parser->psz_shortname ) ) 
     1376            { 
     1377                p_sd_menu->Check( FirstSD_Event + i_number, TRUE ); 
     1378            } 
     1379 
     1380            INSERT_ELEM( (void**)pp_sds, i_number, i_number, 
     1381                         (void*)p_parser->psz_shortname ); 
     1382        } 
     1383    } 
     1384    vlc_list_release( p_list ); 
     1385    vlc_object_release( p_playlist ); 
     1386    return p_sd_menu; 
    13401387} 
    13411388 
  • modules/gui/wxwindows/wxwindows.h

    rbcec187 r382926a  
    807807 
    808808    wxMenu *ViewMenu(); 
     809    wxMenu *SDMenu(); 
    809810 
    810811    void OnUp( wxCommandEvent& event); 
     
    850851 
    851852    wxMenu *p_view_menu; 
     853    wxMenu *p_sd_menu; 
     854 
     855    char **pp_sds; 
    852856 
    853857    ItemInfoDialog *iteminfo_dialog; 
  • src/playlist/playlist.c

    r8b61d4e r382926a  
    6161playlist_t * __playlist_Create ( vlc_object_t *p_parent ) 
    6262{ 
     63    int i_index; 
    6364    playlist_t *p_playlist; 
    6465    playlist_view_t *p_view; 
     
    9192    val.b_bool = VLC_TRUE; 
    9293    var_Set( p_playlist, "intf-show", val ); 
     94 
    9395 
    9496    /* Variables to control playback */ 
     
    924926{ 
    925927    playlist_t *p_playlist = (playlist_t *)param; 
     928    int i_index; 
    926929 
    927930    //p_playlist->b_need_update = VLC_TRUE; 
  • src/playlist/services_discovery.c

    r8b61d4e r382926a  
    114114} 
    115115 
     116vlc_bool_t playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist, 
     117                                              const char *psz_module ) 
     118{ 
     119    int i; 
     120    vlc_mutex_lock( &p_playlist->object_lock ); 
     121 
     122    for( i = 0 ; i< p_playlist->i_sds ; i ++ ) 
     123    { 
     124        if( !strcmp( psz_module, p_playlist->pp_sds[i]->psz_module ) ) 
     125        { 
     126            vlc_mutex_unlock( &p_playlist->object_lock ); 
     127            return VLC_TRUE; 
     128        } 
     129    } 
     130    vlc_mutex_unlock( &p_playlist->object_lock ); 
     131    return VLC_FALSE; 
     132} 
     133 
     134 
    116135/** 
    117136 * Load all service discovery modules in a string