Commit 12f48a5b authored by Clément Stenac's avatar Clément Stenac

Add directory in wxWidgets

Update TODO
parent 5b903151
......@@ -123,7 +123,6 @@ Todo:<br />
- Helper modules<br />
- ** ASX and B4S parsers (see below)<br />
- * Rewrite SLP announce discovery<br />
- *** Finish new SAP parser (see above)<br />
- ** Adapt CDDAX<br />
- ** Fix MP4, LIVE.COM<br />
- *** Implement in MacOS X and Skins 2 interfaces<br />
......@@ -132,11 +131,9 @@ Todo:<br />
- ** Support item move/copy<br />
- * Explorer view<br />
- *** Fix search<br />
- *** Play Node vs Play all<br />
- ** Clever update using i_serial<br />
- * Playlist preferences panel<br />
- ** Improve iteminfo dialog<br />
- ** Support item types<br />
Status: Assigned to zorglub
Task
......
......@@ -223,6 +223,7 @@ typedef struct playlist_view_t playlist_view_t;
typedef struct playlist_export_t playlist_export_t;
typedef struct services_discovery_t services_discovery_t;
typedef struct services_discovery_sys_t services_discovery_sys_t;
typedef struct playlist_add_t playlist_add_t;
/* Modules */
typedef struct module_bank_t module_bank_t;
......
......@@ -142,6 +142,8 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#define INTF_DIALOG_CAPTURE 5
#define INTF_DIALOG_SAT 6
#define INTF_DIALOG_DIRECTORY 7
#define INTF_DIALOG_STREAMWIZARD 8
#define INTF_DIALOG_WIZARD 9
......
......@@ -194,6 +194,15 @@ struct playlist_t
/*@}*/
};
/* Helper to add an item */
struct playlist_add_t
{
playlist_item_t *p_parent;
playlist_item_t *p_item;
int i_view;
int i_position;
};
#define SORT_ID 0
#define SORT_TITLE 1
#define SORT_AUTHOR 2
......@@ -296,6 +305,7 @@ VLC_EXPORT( void, playlist_ItemToNode, (playlist_t *,playlist_item_t *) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetById, (playlist_t *, int) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetByPos, (playlist_t *, int) );
VLC_EXPORT( int, playlist_GetPositionById, (playlist_t *,int ) );
VLC_EXPORT( playlist_item_t *, playlist_ItemGetByInput, (playlist_t *,input_item_t * ) );
/* Info functions */
VLC_EXPORT( char * , playlist_GetInfo, ( playlist_t * , int, const char *, const char *) );
......
......@@ -60,6 +60,7 @@ private:
void OnOpenFileGeneric( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenDirectory( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
......@@ -80,6 +81,7 @@ public:
/* Secondary windows */
OpenDialog *p_open_dialog;
wxFileDialog *p_file_dialog;
wxDirDialog *p_dir_dialog;
Playlist *p_playlist_dialog;
Messages *p_messages_dialog;
FileInfo *p_fileinfo_dialog;
......@@ -105,6 +107,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnOpenFileSimple)
EVT_COMMAND(INTF_DIALOG_FILE_GENERIC, wxEVT_DIALOG,
DialogsProvider::OnOpenFileGeneric)
EVT_COMMAND(INTF_DIALOG_DIRECTORY, wxEVT_DIALOG,
DialogsProvider::OnOpenDirectory)
EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG,
DialogsProvider::OnPlaylist)
......@@ -365,6 +369,37 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
vlc_object_release( p_playlist );
}
void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_dir_dialog == NULL )
p_dir_dialog = new wxDirDialog( NULL );
if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
{
playlist_item_t *p_item;
wxString path = p_dir_dialog->GetPath();
int i_id = playlist_Add( p_playlist, (const char *)path.mb_str(),
(const char *)path.mb_str(),
PLAYLIST_APPEND, PLAYLIST_END );
p_item = playlist_ItemGetById( p_playlist, i_id );
if( p_item )
{
input_CreateThread( p_intf, &p_item->input );
}
}
vlc_object_release( p_playlist );
}
void DialogsProvider::OnOpenFile( wxCommandEvent& event )
{
Open( FILE_ACCESS, event.GetInt() );
......
......@@ -65,6 +65,7 @@ enum
{
/* menu items */
AddFile_Event = 1,
AddDir_Event,
AddMRL_Event,
Close_Event,
Open_Event,
......@@ -123,6 +124,7 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
/* Menu events */
EVT_MENU(AddFile_Event, Playlist::OnAddFile)
EVT_MENU(AddDir_Event, Playlist::OnAddDir)
EVT_MENU(AddMRL_Event, Playlist::OnAddMRL)
EVT_MENU(Close_Event, Playlist::OnClose)
EVT_MENU(Open_Event, Playlist::OnOpen)
......@@ -226,7 +228,8 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
/* Create our "Manage" menu */
wxMenu *manage_menu = new wxMenu;
manage_menu->Append( AddFile_Event, wxU(_("&Simple Add...")) );
manage_menu->Append( AddFile_Event, wxU(_("&Simple Add File...")) );
manage_menu->Append( AddDir_Event, wxU(_("Add &Directory...")) );
manage_menu->Append( AddMRL_Event, wxU(_("&Add MRL...")) );
manage_menu->AppendSeparator();
manage_menu->Append( MenuDummy_Event, wxU(_("Services discovery")),
......@@ -854,6 +857,12 @@ void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) )
}
void Playlist::OnAddDir( wxCommandEvent& WXUNUSED(event) )
{
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_DIRECTORY, 0, 0 );
}
void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) )
{
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE, 0, 0 );
......
......@@ -326,6 +326,7 @@ private:
void OnAbout( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenDir( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
......@@ -791,6 +792,7 @@ private:
/* Menu Handlers */
void OnAddFile( wxCommandEvent& event );
void OnAddDir( wxCommandEvent& event );
void OnAddMRL( wxCommandEvent& event );
void OnClose( wxCommandEvent& event );
void OnSearch( wxCommandEvent& event );
......
......@@ -425,6 +425,26 @@ playlist_item_t * playlist_ItemGetById( playlist_t * p_playlist , int i_id )
return NULL;
}
/**
* Search an item by its input_item_t
*
* \param p_playlist the playlist
* \param p_item the input_item_t to find
* \return the item, or NULL on failure
*/
playlist_item_t * playlist_ItemGetByInput( playlist_t * p_playlist ,
input_item_t *p_item )
{
int i;
for( i = 0 ; i < p_playlist->i_size ; i++ )
{
if( &p_playlist->pp_items[i]->input == p_item )
{
return p_playlist->pp_items[i];
}
}
return NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment