]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_model.hpp
Qt: add a list view
[vlc] / modules / gui / qt4 / components / playlist / playlist_model.hpp
index 67c8726ac6ab3a483103d7c573840ab1e1b0777d..ba112a0a6486f921480d2fab41edec9d445bc863 100644 (file)
@@ -90,6 +90,8 @@ public:
     QModelIndex currentIndex();
     bool isCurrent( const QModelIndex &index ) const;
     int itemId( const QModelIndex &index ) const;
+    static int columnFromMeta( int meta_column );
+    static int columnToMeta( int column );
 
     /* Actions */
     void popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list );
@@ -97,8 +99,8 @@ public:
     void search( const QString& search_text );
     void sort( int column, Qt::SortOrder order );
     void sort( int i_root_id, int column, Qt::SortOrder order );
-    void removeItem( int );
-    void rebuild(); void rebuild( playlist_item_t *, bool b_first = false );
+    void rebuild();
+    void rebuild( playlist_item_t * );
 
     inline PLItem *getItem( QModelIndex index ) const
     {
@@ -107,29 +109,38 @@ public:
         else return rootItem;
     }
 
-private:
+signals:
+    void currentChanged( const QModelIndex& );
+    void rootChanged();
 
+public slots:
+    void activateItem( const QModelIndex &index );
+    void activateItem( playlist_item_t *p_item );
+
+private:
     /* General */
     PLItem *rootItem;
 
     playlist_t *p_playlist;
     intf_thread_t *p_intf;
-    int i_depth;
 
     static QIcon icons[ITEM_TYPE_NUMBER];
 
-    /* Actions */
-    void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList );
+    /* Shallow actions (do not affect core playlist) */
     void updateTreeItem( PLItem * );
     void removeItem ( PLItem * );
+    void removeItem( int );
+    void recurseDelete( QList<PLItem*> children, QModelIndexList *fullList );
     void takeItem( PLItem * ); //will not delete item
     void insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos );
-    void dropAppendCopy( QByteArray& data, PLItem *target );
-    void dropMove( QByteArray& data, PLItem *target, int new_pos );
-    /* The following actions will not signal the view! */
+    /* ...of which  the following will not update the views */
     void updateChildren( PLItem * );
     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 );
+
     /* Popup */
     int i_popup_item, i_popup_parent, i_popup_column;
     QModelIndexList current_selection;
@@ -138,23 +149,13 @@ private:
     PLItem *findById( PLItem *, int );
     PLItem *findByInput( PLItem *, int );
     PLItem *findInner( PLItem *, int , bool );
-
-    int columnFromMeta( int meta_column ) const;
-    int columnToMeta( int column ) const;
     bool canEdit() const;
+
     PLItem *p_cached_item;
     PLItem *p_cached_item_bi;
     int i_cached_id;
     int i_cached_input_id;
 
-signals:
-    void currentChanged( const QModelIndex& );
-    void rootChanged();
-
-public slots:
-    void activateItem( const QModelIndex &index );
-    void activateItem( playlist_item_t *p_item );
-
 private slots:
     void popupPlay();
     void popupDel();