]> git.sesse.net Git - vlc/commitdiff
Qt: make PLModel::getItem return rootItem as well, add id getter to PLItem
authorJakob Leben <jleben@videolan.org>
Thu, 28 Jan 2010 05:50:35 +0000 (06:50 +0100)
committerJakob Leben <jleben@videolan.org>
Thu, 28 Jan 2010 05:54:02 +0000 (06:54 +0100)
modules/gui/qt4/components/playlist/playlist_item.hpp
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.hpp

index ab05a15476a85f429ac840f5e87657f4d66fc152..45f8d8c00a6e5d9de1d6d99011e95dda8ec00486 100644 (file)
@@ -55,6 +55,7 @@ public:
 
     PLItem *parent() { return parentItem; }
     input_item_t *inputItem() { return p_input; }
+    int id() { return i_id; }
 
 protected:
     QList<PLItem*> children;
index eceba07114568bd2889b2d01941917c53e6ea505..a9bef58e5b85e60b6d8dfa1c344c04b76ed20794 100644 (file)
@@ -529,12 +529,6 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input )
 #undef CACHE
 #undef ICACHE
 
-PLItem *PLModel::getItem( QModelIndex index )
-{
-    assert( index.isValid() );
-    return static_cast<PLItem*>( index.internalPointer() );
-}
-
 int PLModel::columnToMeta( int _column ) const
 {
     int meta = 1;
index c8cb8f03936b210cfdc1e0d0c910d914265304d1..cd5b1ecd6116d42a07c5a97778b659a28fd14601 100644 (file)
@@ -96,7 +96,12 @@ public:
     void removeItem( int );
     void rebuild(); void rebuild( playlist_item_t *, bool b_first = false );
 
-    static inline PLItem *getItem( QModelIndex index );
+    inline PLItem *getItem( QModelIndex index ) const
+    {
+        if( index.isValid() )
+            return static_cast<PLItem*>( index.internalPointer() );
+        else return rootItem;
+    }
 
 private: