[vlc-devel] commit: Revert "Qt4 Playlist: Disable dropping on non-container items" ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Oct 4 19:05:42 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct  4 19:34:27 2009 +0300| [c8e93dd439ee0b64ea3fa737e1f9ba9ec742c16e] | committer: Rémi Denis-Courmont 

Revert "Qt4 Playlist: Disable dropping on non-container items"

This reverts commit c10bdb0712b9dcb42c459927609f2c8bbba6bd40.
This broke drag&drop for manual sort.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c8e93dd439ee0b64ea3fa737e1f9ba9ec742c16e
---

 .../gui/qt4/components/playlist/playlist_item.cpp  |   14 +++++---------
 .../gui/qt4/components/playlist/playlist_item.hpp  |    5 ++---
 .../gui/qt4/components/playlist/playlist_model.cpp |    7 +------
 .../gui/qt4/components/playlist/standardpanel.cpp  |    6 +-----
 4 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_item.cpp b/modules/gui/qt4/components/playlist/playlist_item.cpp
index b0436f0..0edde6a 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.cpp
@@ -48,7 +48,7 @@
 */
 
 
-void PLItem::init( int _i_id, int _i_input_id, bool _is_node, PLItem *parent, PLModel *m, QSettings *settings )
+void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m, QSettings *settings )
 {
     parentItem = parent;          /* Can be NULL, but only for the rootItem */
     i_id       = _i_id;           /* Playlist item specific id */
@@ -56,7 +56,6 @@ void PLItem::init( int _i_id, int _i_input_id, bool _is_node, PLItem *parent, PL
     model      = m;               /* PLModel (QAbsmodel) */
     i_type     = -1;              /* Item type - Avoid segfault */
     b_current  = false;           /* Is the item the current Item or not */
-    b_is_node = _is_node;
 
     assert( model );              /* We need a model */
 
@@ -92,21 +91,19 @@ void PLItem::init( int _i_id, int _i_input_id, bool _is_node, PLItem *parent, PL
    Call the above function init
    So far the first constructor isn't used...
    */
-PLItem::PLItem( int _i_id, int _i_input_id, bool _is_node, PLItem *parent, PLModel *m )
+PLItem::PLItem( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
 {
-    init( _i_id, _i_input_id, _is_node, parent, m, NULL );
+    init( _i_id, _i_input_id, parent, m, NULL );
 }
 
 PLItem::PLItem( playlist_item_t * p_item, PLItem *parent, PLModel *m )
 {
-    init( p_item->i_id, p_item->p_input->i_id, p_item->i_children > -1,
-        parent, m, NULL );
+    init( p_item->i_id, p_item->p_input->i_id, parent, m, NULL );
 }
 
 PLItem::PLItem( playlist_item_t * p_item, QSettings *settings, PLModel *m )
 {
-    init( p_item->i_id, p_item->p_input->i_id, p_item->i_children > -1,
-        NULL, m, settings );
+    init( p_item->i_id, p_item->p_input->i_id, NULL, m, settings );
 }
 
 PLItem::~PLItem()
@@ -177,7 +174,6 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
     /* Useful for the model */
     i_type = p_item->p_input->i_type;
     b_current = iscurrent;
-    b_is_node = p_item->i_children > -1;
 
     item_col_strings.clear();
 
diff --git a/modules/gui/qt4/components/playlist/playlist_item.hpp b/modules/gui/qt4/components/playlist/playlist_item.hpp
index c9d186b..26ce13c 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.hpp
@@ -40,7 +40,7 @@ class PLItem
 {
     friend class PLModel;
 public:
-    PLItem( int, int, bool, PLItem *parent , PLModel * );
+    PLItem( int, int, PLItem *parent , PLModel * );
     PLItem( playlist_item_t *, PLItem *parent, PLModel * );
     PLItem( playlist_item_t *, QSettings *, PLModel * );
     ~PLItem();
@@ -72,10 +72,9 @@ protected:
     int i_id;
     int i_input_id;
     int i_showflags;
-    bool b_is_node;
 
 private:
-    void init( int, int, bool, PLItem *, PLModel *, QSettings * );
+    void init( int, int, PLItem *, PLModel *, QSettings * );
     void updateColumnHeaders();
     PLItem *parentItem;
     PLModel *model;
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 9a28d42..add3ddc 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -119,12 +119,7 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
 {
     Qt::ItemFlags defaultFlags = QAbstractItemModel::flags( index );
     if( index.isValid() )
-    {
-        PLItem *item = static_cast<PLItem*>( index.internalPointer() );
-        if ( item->b_is_node )
-            defaultFlags |= Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
-        else defaultFlags |= Qt::ItemIsDragEnabled;
-    }
+        return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
     else if ( rootItem->i_id != p_playlist->p_root_onelevel->i_id
           && rootItem->i_id != p_playlist->p_root_category->i_id )
               defaultFlags |= Qt::ItemIsDropEnabled;
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index c9e5550..ca421c6 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -87,15 +87,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
         view->header()->resizeSection( 0, 200 );
         view->header()->resizeSection( 1, 80 );
     }
+    view->header()->setSortIndicatorShown( true );
     view->header()->setClickable( true );
     view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
     getSettings()->endGroup();
 
-    /* Set sorting enable by hand, so it doesn't run sort on start */
-    view->header()->setSortIndicator( -1, Qt::AscendingOrder );
-    view->header()->setSortIndicatorShown( true );
-    CONNECT( view->header(), sortIndicatorChanged( int, Qt::SortOrder ),
-             view, sortByColumn( int ) );
     /* Connections for the TreeView */
     CONNECT( view, activated( const QModelIndex& ) ,
              model,activateItem( const QModelIndex& ) );




More information about the vlc-devel mailing list