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

Qt, playlist: simplifications

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