]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_model.hpp
Qt4: cache currentItem index
[vlc] / modules / gui / qt4 / components / playlist / playlist_model.hpp
index 2bd9ef2e7df314daee8c2587e22027dfdf9554c8..033cdc691ac1e576ee82d64c273d2b3c7e40bbe2 100644 (file)
 #include <QSignalMapper>
 #include <QAbstractItemModel>
 #include <QVariant>
+#include <QAction>
 
-class QSignalMapper;
 class PLItem;
+class PLSelector;
+class PlMimeData;
 
 class PLModel : public QAbstractItemModel
 {
     Q_OBJECT
 
 friend class PLItem;
+friend class PLSelector;
 
 public:
     enum {
@@ -139,12 +142,14 @@ private:
     void updateChildren( playlist_item_t *, PLItem * );
 
     /* Deep actions (affect core playlist) */
-    void dropAppendCopy( QByteArray& data, PLItem *target );
-    void dropMove( QByteArray& data, PLItem *target, int new_pos );
+    void dropAppendCopy( const PlMimeData * data, PLItem *target, int pos );
+    void dropMove( const PlMimeData * data, PLItem *target, int new_pos );
 
     /* Popup */
     int i_popup_item, i_popup_parent, i_popup_column;
     QModelIndexList current_selection;
+    QMenu *sortingMenu;
+    QSignalMapper *sortingMapper;
 
     /* Lookups */
     PLItem *findById( PLItem *, int );
@@ -156,6 +161,7 @@ private:
     PLItem *p_cached_item_bi;
     int i_cached_id;
     int i_cached_input_id;
+    QModelIndex current_index;
 
 private slots:
     void popupPlay();
@@ -165,12 +171,28 @@ private slots:
     void popupSave();
     void popupExplore();
     void popupAddNode();
-    void popupSortAsc();
-    void popupSortDesc();
+    void popupSort( int column );
     void processInputItemUpdate( input_item_t *);
     void processInputItemUpdate( input_thread_t* p_input );
     void processItemRemoval( int i_id );
     void processItemAppend( int item, int parent );
+    void cacheCurrent( const QModelIndex & );
+};
+
+class PlMimeData : public QMimeData
+{
+    Q_OBJECT
+
+public:
+    PlMimeData();
+    ~PlMimeData();
+    void appendItem( input_item_t *p_item );
+    QList<input_item_t*> inputItems() const;
+    QStringList formats () const;
+
+private:
+    QList<input_item_t*> _inputItems;
+    QMimeData *_mimeData;
 };
 
 #endif