Changeset 382926a8c14406854dae7eb79de693ffe1284ed0
- Timestamp:
- 09/11/04 00:47:32 (4 years ago)
- git-parent:
- Files:
-
- include/vlc_playlist.h (modified) (1 diff)
- modules/gui/wxwindows/menus.cpp (modified) (1 diff)
- modules/gui/wxwindows/playlist.cpp (modified) (8 diffs)
- modules/gui/wxwindows/wxwindows.h (modified) (2 diffs)
- src/playlist/playlist.c (modified) (3 diffs)
- src/playlist/services_discovery.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_playlist.h
r8b61d4e r382926a 232 232 VLC_EXPORT( void, playlist_ServicesDiscoveryRemove, (playlist_t *, const char *)); 233 233 VLC_EXPORT( int, playlist_AddSDModules, (playlist_t *, char *)); 234 VLC_EXPORT( vlc_bool_t, playlist_IsServicesDiscoveryLoaded, ( playlist_t *,const char *)); 235 234 236 235 237 /* Item management functions (act on items) */ modules/gui/wxwindows/menus.cpp
ra53e5d1 r382926a 978 978 if( p_intf->p_sys->p_popup_menu ) 979 979 { 980 p_menuitem = 980 p_menuitem = 981 981 p_intf->p_sys->p_popup_menu->FindItem( event.GetId() ); 982 982 } modules/gui/wxwindows/playlist.cpp
r4ae5bec r382926a 108 108 UpdateItem_Event, 109 109 110 MenuDummy_Event = wxID_HIGHEST + 999, 111 110 112 FirstView_Event = wxID_HIGHEST + 1000, 113 LastView_Event = wxID_HIGHEST + 1100, 114 115 FirstSD_Event = wxID_HIGHEST + 2000, 116 LastSD_Event = wxID_HIGHEST + 2100, 111 117 }; 112 118 … … 206 212 207 213 p_view_menu = NULL; 214 p_sd_menu = SDMenu(); 208 215 209 216 i_current_view = VIEW_SIMPLE; … … 222 229 manage_menu->Append( AddFile_Event, wxU(_("&Simple Add...")) ); 223 230 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 ); 224 234 manage_menu->AppendSeparator(); 225 235 manage_menu->Append( Open_Event, wxU(_("&Open Playlist...")) ); … … 1091 1101 void Playlist::OnSelectAll( wxCommandEvent& WXUNUSED(event) ) 1092 1102 { 1093 #if 01094 for( long item = 0; item < listview->GetItemCount(); item++ )1095 {1096 listview->Select( item, TRUE );1097 }1098 #endif1099 1103 } 1100 1104 … … 1204 1208 void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) ) 1205 1209 { 1206 /* We use the first selected item, so find it */1207 #if 01208 long i_item = listview->GetNextItem( -1, wxLIST_NEXT_ALL,1209 wxLIST_STATE_SELECTED );1210 ShowInfos( i_item );1211 #endif1212 1210 } 1213 1211 … … 1221 1219 return; 1222 1220 } 1223 #if 01224 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 #endif1232 1221 vlc_object_release( p_playlist ); 1233 1222 } … … 1267 1256 return; 1268 1257 } 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 } 1292 1298 vlc_object_release( p_playlist ); 1293 1299 } … … 1338 1344 1339 1345 return p_view_menu; 1346 } 1347 1348 wxMenu *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; 1340 1387 } 1341 1388 modules/gui/wxwindows/wxwindows.h
rbcec187 r382926a 807 807 808 808 wxMenu *ViewMenu(); 809 wxMenu *SDMenu(); 809 810 810 811 void OnUp( wxCommandEvent& event); … … 850 851 851 852 wxMenu *p_view_menu; 853 wxMenu *p_sd_menu; 854 855 char **pp_sds; 852 856 853 857 ItemInfoDialog *iteminfo_dialog; src/playlist/playlist.c
r8b61d4e r382926a 61 61 playlist_t * __playlist_Create ( vlc_object_t *p_parent ) 62 62 { 63 int i_index; 63 64 playlist_t *p_playlist; 64 65 playlist_view_t *p_view; … … 91 92 val.b_bool = VLC_TRUE; 92 93 var_Set( p_playlist, "intf-show", val ); 94 93 95 94 96 /* Variables to control playback */ … … 924 926 { 925 927 playlist_t *p_playlist = (playlist_t *)param; 928 int i_index; 926 929 927 930 //p_playlist->b_need_update = VLC_TRUE; src/playlist/services_discovery.c
r8b61d4e r382926a 114 114 } 115 115 116 vlc_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 116 135 /** 117 136 * Load all service discovery modules in a string
