Commit 76cc0af9 authored by Jakob Leben's avatar Jakob Leben

Qt: make PLModel::getItem return rootItem as well, add id getter to PLItem

parent 6a5e8468
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
PLItem *parent() { return parentItem; } PLItem *parent() { return parentItem; }
input_item_t *inputItem() { return p_input; } input_item_t *inputItem() { return p_input; }
int id() { return i_id; }
protected: protected:
QList<PLItem*> children; QList<PLItem*> children;
......
...@@ -529,12 +529,6 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input ) ...@@ -529,12 +529,6 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input )
#undef CACHE #undef CACHE
#undef ICACHE #undef ICACHE
PLItem *PLModel::getItem( QModelIndex index )
{
assert( index.isValid() );
return static_cast<PLItem*>( index.internalPointer() );
}
int PLModel::columnToMeta( int _column ) const int PLModel::columnToMeta( int _column ) const
{ {
int meta = 1; int meta = 1;
......
...@@ -96,7 +96,12 @@ public: ...@@ -96,7 +96,12 @@ public:
void removeItem( int ); void removeItem( int );
void rebuild(); void rebuild( playlist_item_t *, bool b_first = false ); 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: private:
......
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