#ifndef _PLAYLIST_MODEL_H_
#define _PLAYLIST_MODEL_H_
-#include <QObject>
-#include <QEvent>
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_input.h>
#include <vlc_playlist.h>
+#include <QModelIndex>
+#include <QObject>
+#include <QEvent>
+#include <QMimeData>
+
class PLModel;
class PLItem
static int ItemUpdate_Type = QEvent::User + 2;
static int ItemDelete_Type = QEvent::User + 3;
static int ItemAppend_Type = QEvent::User + 4;
+static int PLUpdate_Type = QEvent::User + 5;
class PLEvent : public QEvent
{
};
#include <QAbstractItemModel>
-#include <QModelIndex>
#include <QVariant>
class PLModel : public QAbstractItemModel
Q_OBJECT
public:
- PLModel( playlist_t *, playlist_item_t *, int, QObject *parent = 0);
+ PLModel( playlist_t *, intf_thread_t *,
+ playlist_item_t *, int, QObject *parent = 0);
~PLModel();
- void customEvent( QEvent * );
-
- /* QModel stuff */
+ /* All types of lookups / QModel stuff */
QVariant data( const QModelIndex &index, int role) const;
Qt::ItemFlags flags( const QModelIndex &index) const;
QVariant headerData( int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
-
QModelIndex index( int r, int c, const QModelIndex &parent ) const;
QModelIndex index( PLItem *, int c ) const;
int itemId( const QModelIndex &index ) const;
bool isCurrent( const QModelIndex &index );
-
QModelIndex parent( const QModelIndex &index) const;
int childrenCount( const QModelIndex &parent = QModelIndex() ) const;
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
bool b_need_update;
int i_items_to_append;
- void Rebuild();
- void rebuildRoot( playlist_item_t * );
+ void rebuild(); void rebuild( playlist_item_t *);
bool hasRandom(); bool hasLoop(); bool hasRepeat();
+
+ /* Actions made by the views */
+ void popup( QModelIndex & index, QPoint &point, QModelIndexList list );
+ void doDelete( QModelIndexList selected );
+ void search( QString search );
+ void sort( int column, Qt::SortOrder order );
+ void removeItem( int );
+
+ /* DnD handling */
+ Qt::DropActions supportedDropActions() const;
+ QMimeData* mimeData(const QModelIndexList &indexes) const;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action,
+ int row, int column, const QModelIndex &target);
+ QStringList mimeTypes() const;
+
+ void sendArt( QString url );
+ void removeArt( );
private:
void addCallbacks();
void delCallbacks();
+ void customEvent( QEvent * );
+
PLItem *rootItem;
playlist_t *p_playlist;
+ intf_thread_t *p_intf;
int i_depth;
static QIcon icons[ITEM_TYPE_NUMBER];
void UpdateNodeChildren( PLItem * );
void UpdateNodeChildren( playlist_item_t *, PLItem * );
+ /* Actions */
+ void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList);
+ void doDeleteItem( PLItem *item, QModelIndexList *fullList );
+
+ /* Popup */
+ int i_popup_item, i_popup_parent;
+ QModelIndexList current_selection;
+
/* Lookups */
PLItem *FindById( PLItem *, int );
PLItem *FindByInput( PLItem *, int );
PLItem *p_cached_item_bi;
int i_cached_id;
int i_cached_input_id;
+signals:
+ void artSet( QString );
+ void shouldRemove( int );
public slots:
void activateItem( const QModelIndex &index );
+ void activateItem( playlist_item_t *p_item );
void setRandom( bool );
void setLoop( bool );
void setRepeat( bool );
+private slots:
+ void popupPlay();
+ void popupDel();
+ void popupInfo();
+ void popupStream();
+ void popupSave();
friend class PLItem;
};