]> git.sesse.net Git - vlc/commitdiff
Add directory in wxWidgets
authorClément Stenac <zorglub@videolan.org>
Sat, 13 Nov 2004 23:06:53 +0000 (23:06 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 13 Nov 2004 23:06:53 +0000 (23:06 +0000)
Update TODO

TODO
include/vlc_common.h
include/vlc_interface.h
include/vlc_playlist.h
modules/gui/wxwindows/dialogs.cpp
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/wxwindows.h
src/playlist/item-ext.c

diff --git a/TODO b/TODO
index 196c96a91402d2694c2303bbe0f2664a5c3a1626..f751e4ca4f19ea8a72ab543d58b9c0efd271fc07 100644 (file)
--- a/TODO
+++ b/TODO
@@ -123,7 +123,6 @@ Todo:<br />
 - Helper modules<br />\r
    - **  ASX and B4S parsers (see below)<br />\r
    - *   Rewrite SLP announce discovery<br />\r
-   - *** Finish new SAP parser (see above)<br />\r
    - **  Adapt CDDAX<br />\r
    - **  Fix MP4, LIVE.COM<br />\r
 - *** Implement in MacOS X and Skins 2 interfaces<br />\r
@@ -132,11 +131,9 @@ Todo:<br />
    - **  Support item move/copy<br />\r
    - *   Explorer view<br />\r
    - *** Fix search<br />\r
-   - *** Play Node vs Play all<br />\r
    - **  Clever update using i_serial<br />\r
    - *   Playlist preferences panel<br />\r
    - **  Improve iteminfo dialog<br />\r
-   - **  Support item types<br />\r
 Status: Assigned to zorglub\r
 \r
 Task\r
index 8172b263db2c895aa80fb98dbc2760a27134ecf8..d702dfa2aff525520c8139452c0aa635d7c8ac78 100644 (file)
@@ -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;
index cf7c019338f30a292855cf543d0ed00e9eca8254..2626cb5773e9180c72d55515d97eb77750461688 100644 (file)
@@ -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
 
index 05b49c9061bd01773fd9e8c1a92a930d2a70a547..af65a0b6f9a98ad2d1e8a9e44b6808af407e1356 100644 (file)
@@ -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 *) );
index c96ed6b10e06c1750851edfb6747215067d7eec2..7f691894c1605c3736f73fcf70df502f028e8d01 100644 (file)
@@ -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() );
index 4d83695ce0ed02578205394d6ab6058e451fd1db..0a5101f463d499998129281454b89326f8cb1fde 100644 (file)
@@ -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 );
index afdfb09d8273446552c5a5b0d464b5c2c42334c5..ad8edb1e07975a3c330af7d3d2484b854736c4c5 100644 (file)
@@ -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 );
index 606223f3063b58aeaf1c3e0bb05fd37492792258..c63b93646c6ee9c1a9465d5a0ea74fb31e892f40 100644 (file)
@@ -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;
+}