Commit 0b3ef518 authored by Jakob Leben's avatar Jakob Leben

qt4 playlist: don't rebuild on move (finally!) + refresh current item on sort

When using tree playlist mode and moving items within sub-nodes, the nodes
will now stay open.
parent 883694a2
...@@ -84,6 +84,25 @@ void PLItem::insertChild( PLItem *item, int i_pos, bool signal ) ...@@ -84,6 +84,25 @@ void PLItem::insertChild( PLItem *item, int i_pos, bool signal )
children.insert( i_pos, item ); children.insert( i_pos, item );
} }
void PLItem::removeChild( PLItem *item )
{
children.removeOne( item );
delete item;
}
void PLItem::removeChildren()
{
qDeleteAll( children );
children.clear();
}
void PLItem::takeChildAt( int index )
{
PLItem *child = children[index];
child->parentItem = NULL;
children.removeAt( index );
}
/* This function is used to get one's parent's row number in the model */ /* This function is used to get one's parent's row number in the model */
int PLItem::row() const int PLItem::row() const
{ {
......
...@@ -46,6 +46,9 @@ public: ...@@ -46,6 +46,9 @@ public:
{ {
children.insert( children.count(), item ); children.insert( children.count(), item );
}; };
void removeChild( PLItem * );
void removeChildren();
void takeChildAt( int );
PLItem *child( int row ) { return children.value( row ); }; PLItem *child( int row ) { return children.value( row ); };
int childCount() const { return children.count(); }; int childCount() const { return children.count(); };
......
...@@ -151,9 +151,12 @@ private: ...@@ -151,9 +151,12 @@ private:
void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList ); void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList );
void doDeleteItem( PLItem *item, QModelIndexList *fullList ); void doDeleteItem( PLItem *item, QModelIndexList *fullList );
void UpdateTreeItem( PLItem *, bool, bool force = false ); void UpdateTreeItem( PLItem *, bool, bool force = false );
void dropAppendCopy( QByteArray& data, PLItem *target );
void dropMove( QByteArray& data, PLItem *target, int new_pos );
void TakeItem( PLItem * );
void InsertChildren( PLItem *node, QList<PLItem*>& items, int i_pos );
/* The following actions will not signal the view! */ /* The following actions will not signal the view! */
void RemoveItem ( PLItem * ); void RemoveItem ( PLItem * );
void RemoveChildren( PLItem * );
void UpdateChildren( PLItem * ); void UpdateChildren( PLItem * );
void UpdateChildren( playlist_item_t *, PLItem * ); void UpdateChildren( playlist_item_t *, PLItem * );
......
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