]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/playlist_manager.cpp
Rename vlc_input_item_* functions to input_Item* for consistency
[vlc] / modules / gui / wxwidgets / playlist_manager.cpp
index 816448c5c79ef06337ce13797b09a52d20b860dd..6c1191ca0b53f5028720f30f1d9b906f56d564ef 100644 (file)
@@ -4,8 +4,8 @@
  * Copyright (C) 2000-2005 the VideoLAN team
  * $Id$
  *
- * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
- *          Clément Stenac <zorglub@videolan.org>
+ * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Clément Stenac <zorglub@videolan.org>
  *          Gildas Bazin <gbazin@videolan.org>
  *
  * This program is free software; you can redistribute it and/OR MODIFy
@@ -20,7 +20,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -42,6 +42,7 @@
 
 #include <wx/dynarray.h>
 #include <wx/imaglist.h>
+#include "vlc_meta.h"
 
 namespace wxvlc {
 /* Callback prototype */
@@ -86,7 +87,7 @@ END_EVENT_TABLE()
 class PlaylistItem : public wxTreeItemData
 {
 public:
-    PlaylistItem( playlist_item_t *p_item ) : i_id(p_item->input.i_id) {}
+    PlaylistItem( playlist_item_t *p_item ) : i_id(p_item->p_input->i_id) {}
     int i_id;
 };
 
@@ -123,7 +124,6 @@ PlaylistManager::PlaylistManager( intf_thread_t *_p_intf, wxWindow *p_parent ):
     sizer = new wxBoxSizer( wxHORIZONTAL );
     SetSizer( sizer );
     sizer->Add( treectrl, 1, wxEXPAND );
-    treectrl->SetSizeHints( 500, 150 );
     sizer->Layout();
     sizer->Fit( this );
 
@@ -220,9 +220,9 @@ static int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
 void PlaylistManager::CreateNode( playlist_item_t *p_node, wxTreeItemId parent)
 {
     wxTreeItemId node =
-        treectrl->AppendItem( parent, wxL2U( p_node->input.psz_name ), -1, -1,
+        treectrl->AppendItem( parent, wxL2U( p_node->p_input->psz_name ), -1, -1,
                               new PlaylistItem( p_node ) );
-    treectrl->SetItemImage( node, p_node->input.i_type );
+    treectrl->SetItemImage( node, p_node->p_input->i_type );
 
     UpdateNodeChildren( p_node, node );
 }
@@ -246,7 +246,7 @@ void PlaylistManager::UpdateNode( playlist_item_t *p_node, wxTreeItemId node )
         }
     }
 
-    treectrl->SetItemImage( node, p_node->input.i_type );
+    treectrl->SetItemImage( node, p_node->p_input->i_type );
 
 }
 
@@ -260,7 +260,7 @@ void PlaylistManager::UpdateNodeChildren( playlist_item_t *p_node,
         {
             wxTreeItemId item =
                 treectrl->AppendItem( node,
-                    wxL2U( p_node->pp_children[i]->input.psz_name ), -1,-1,
+                    wxL2U( p_node->pp_children[i]->p_input->psz_name ), -1,-1,
                            new PlaylistItem( p_node->pp_children[i]) );
 
             UpdateTreeItem( item );
@@ -290,9 +290,9 @@ void PlaylistManager::UpdateTreeItem( wxTreeItemId item )
 
     wxString msg;
     wxString duration = wxU( "" );
-    char *psz_author =
-        vlc_input_item_GetInfo( &p_item->input,
-                                _("Meta-information"), _("Artist"));
+    char *psz_author = p_item->p_input->p_meta->psz_artist ? 
+                        strdup( p_item->p_input->p_meta->psz_artist ) :
+                        strdup( "" );
     if( !psz_author )
     {
         UnlockPlaylist( p_intf->p_sys, p_playlist );
@@ -300,7 +300,7 @@ void PlaylistManager::UpdateTreeItem( wxTreeItemId item )
     }
 
     char psz_duration[MSTRTIME_MAX_SIZE];
-    mtime_t dur = p_item->input.i_duration;
+    mtime_t dur = p_item->p_input->i_duration;
 
     if( dur != -1 )
     {
@@ -309,18 +309,18 @@ void PlaylistManager::UpdateTreeItem( wxTreeItemId item )
                          wxU( " )" ) );
     }
 
-    if( !strcmp( psz_author, "" ) || p_item->input.b_fixed_name == VLC_TRUE )
+    if( !strcmp( psz_author, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
     {
-        msg = wxString( wxU( p_item->input.psz_name ) ) + duration;
+        msg = wxString( wxU( p_item->p_input->psz_name ) ) + duration;
     }
     else
     {
         msg = wxString(wxU( psz_author )) + wxT(" - ") +
-                    wxString(wxU(p_item->input.psz_name)) + duration;
+                    wxString(wxU(p_item->p_input->psz_name)) + duration;
     }
     free( psz_author );
     treectrl->SetItemText( item , msg );
-    treectrl->SetItemImage( item, p_item->input.i_type );
+    treectrl->SetItemImage( item, p_item->p_input->i_type );
 
     if( p_playlist->status.p_item == p_item )
     {
@@ -360,9 +360,9 @@ void PlaylistManager::AppendItem( wxCommandEvent& event )
     item = FindItem( treectrl->GetRootItem(), p_add->i_item );
     if( item.IsOk() ) goto update;
 
-    item = treectrl->AppendItem( node, wxL2U( p_item->input.psz_name ), -1,-1,
+    item = treectrl->AppendItem( node, wxL2U( p_item->p_input->psz_name ), -1,-1,
                                  new PlaylistItem( p_item ) );
-    treectrl->SetItemImage( item, p_item->input.i_type );
+    treectrl->SetItemImage( item, p_item->p_input->i_type );
 
     if( item.IsOk() && p_item->i_children == -1 ) UpdateTreeItem( item );
 
@@ -415,19 +415,15 @@ void PlaylistManager::Update()
  **********************************************************************/
 void PlaylistManager::Rebuild( vlc_bool_t b_root )
 {
-    playlist_view_t *p_view;
-
     i_items_to_append = 0;
     i_cached_item_id = -1;
 
-    p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
-
     treectrl->DeleteAllItems();
     treectrl->AddRoot( wxU(_("root" )), -1, -1,
-                       new PlaylistItem( p_view->p_root ) );
+                       new PlaylistItem( p_playlist->p_root_category ) );
 
     wxTreeItemId root = treectrl->GetRootItem();
-    UpdateNode( p_view->p_root, root );
+    UpdateNode( p_playlist->p_root_category, root );
 }
 
 /**********************************************************************
@@ -506,9 +502,7 @@ void PlaylistManager::OnActivateItem( wxTreeEvent& event )
         p_node = p_item;
         p_item = NULL;
     }
-
-    playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VIEW_CATEGORY,
-                      p_node, p_item );
+    playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_node, p_item );
     UnlockPlaylist( p_intf->p_sys, p_playlist );
 }
 
@@ -562,7 +556,7 @@ static int ItemAppended( vlc_object_t *p_this, const char *psz_variable,
     playlist_add_t *p_add = (playlist_add_t *)malloc(sizeof( playlist_add_t));
     memcpy( p_add, nval.p_address, sizeof( playlist_add_t ) );
 
-    if( p_playlist->i_items_to_append++ > 50 )
+    if( ++p_playlist->i_items_to_append >= 50 )
     {
         /* Too many items waiting to be added, it will be quicker to rebuild
          * the whole playlist */