[vlc-devel] commit: qt4: no need to store input-type, as we can get it from p_input in playlist_model (Ilkka Ollakka )

git version control git at videolan.org
Sun Aug 16 14:37:38 CEST 2009


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Aug 16 15:36:58 2009 +0300| [d5d50e2fbc710bf5a54dc17dd8fd2692751ba2fc] | committer: Ilkka Ollakka 

qt4: no need to store input-type, as we can get it from p_input in playlist_model

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d5d50e2fbc710bf5a54dc17dd8fd2692751ba2fc
---

 .../gui/qt4/components/playlist/playlist_item.cpp  |    4 ----
 .../gui/qt4/components/playlist/playlist_item.hpp  |    1 -
 .../gui/qt4/components/playlist/playlist_model.cpp |    4 ++--
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_item.cpp b/modules/gui/qt4/components/playlist/playlist_item.cpp
index 8d49500..4faa53c 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.cpp
@@ -53,7 +53,6 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent, PLModel *m,
     parentItem = parent;          /* Can be NULL, but only for the rootItem */
     i_id       = _playlist_item->i_id;           /* Playlist item specific id */
     model      = m;               /* PLModel (QAbsmodel) */
-    i_type     = -1;              /* Item type - Avoid segfault */
     p_input    = _playlist_item->p_input;
     vlc_gc_incref( p_input );
 
@@ -119,8 +118,5 @@ void PLItem::update( playlist_item_t *p_item )
 {
     assert( p_item->p_input == p_input);
 
-    /* Useful for the model */
-    i_type = p_item->p_input->i_type;
-
 }
 
diff --git a/modules/gui/qt4/components/playlist/playlist_item.hpp b/modules/gui/qt4/components/playlist/playlist_item.hpp
index da34983..ef5cfe7 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.hpp
@@ -63,7 +63,6 @@ public:
 
 protected:
     QList<PLItem*> children;
-    int i_type;
     int i_id;
     input_item_t *p_input;
 
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 9b191fa..0b05aa2 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -390,8 +390,8 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
     else if( role == Qt::DecorationRole && index.column() == 0  )
     {
         /* Use to segfault here because i_type wasn't always initialized */
-        if( item->i_type >= 0 )
-            return QVariant( PLModel::icons[item->i_type] );
+        if( item->p_input->i_type >= 0 )
+            return QVariant( PLModel::icons[item->p_input->i_type] );
     }
     else if( role == Qt::FontRole )
     {




More information about the vlc-devel mailing list