Commit a3b7bce4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt, playlist: simplifications

parent 7ec2e3f0
......@@ -30,7 +30,6 @@
#include "qt4.hpp"
#include "playlist_item.hpp"
#include <vlc_intf_strings.h>
#include "sorting.h"
......@@ -45,14 +44,12 @@
PLItem have a parent, and id and a input Id
*/
void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent )
{
parentItem = parent; /* Can be NULL, but only for the rootItem */
i_id = _playlist_item->i_id; /* Playlist item specific id */
p_input = _playlist_item->p_input;
vlc_gc_incref( p_input );
}
/*
......@@ -79,11 +76,16 @@ PLItem::~PLItem()
/* So far signal is always true.
Using signal false would not call PLModel... Why ?
*/
void PLItem::insertChild( PLItem *item, int i_pos, bool signal )
inline void PLItem::insertChild( PLItem *item, int i_pos, bool signal )
{
children.insert( i_pos, item );
}
inline void PLItem::appendChild( PLItem *item, bool signal )
{
children.insert( children.count(), item );
}
void PLItem::removeChild( PLItem *item )
{
children.removeOne( item );
......
......@@ -35,16 +35,12 @@ class PLItem
friend class PLModel;
public:
PLItem( playlist_item_t *, PLItem *parent );
PLItem( playlist_item_t * );
~PLItem();
int row() const;
void insertChild( PLItem *, int p, bool signal = true );
void appendChild( PLItem *item, bool signal = true )
{
children.insert( children.count(), item );
};
void insertChild( PLItem *, int pos, bool signal = true );
void appendChild( PLItem *item, bool signal = true );
void removeChild( PLItem * );
void removeChildren();
void takeChildAt( int );
......@@ -59,12 +55,13 @@ public:
protected:
QList<PLItem*> children;
PLItem *parentItem;
int i_id;
input_item_t *p_input;
private:
PLItem( playlist_item_t * );
void init( playlist_item_t *, PLItem * );
PLItem *parentItem;
};
#endif
......
......@@ -92,8 +92,7 @@ public:
void search( const QString& search_text, const QModelIndex & root, bool b_recursive );
void sort( const int column, Qt::SortOrder order );
void sort( const int i_root_id, const int column, Qt::SortOrder order );
void rebuild();
void rebuild( playlist_item_t * );
void rebuild( playlist_item_t * p = NULL );
inline PLItem *getItem( QModelIndex index ) const
{
......@@ -174,7 +173,7 @@ class PlMimeData : public QMimeData
Q_OBJECT
public:
PlMimeData();
PlMimeData() {}
~PlMimeData();
void appendItem( input_item_t *p_item );
QList<input_item_t*> inputItems() const;
......
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