]> git.sesse.net Git - vlc/commitdiff
QT4: only scroll playlist to new item when it changes
authorIlkka Ollakka <ileoo@videolan.org>
Sat, 25 Jul 2009 12:26:07 +0000 (15:26 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Sat, 25 Jul 2009 12:28:55 +0000 (15:28 +0300)
should fix bug #2947 ,now it scrolls to new item when theres actual
input-change, not just data changed.

modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/standardpanel.cpp

index f17b7dfe6ce2fe9ed3a02a0cf3790201a28ef04e..998ebb2a162f9bc3056809337aa8ebeb6588e1fa 100644 (file)
@@ -530,6 +530,11 @@ void PLModel::ProcessInputItemUpdate( input_thread_t *p_input )
 {
     if( !p_input ) return;
     ProcessInputItemUpdate( input_GetItem( p_input )->i_id );
+    if( p_input && !( p_input->b_dead || !vlc_object_alive( p_input ) ) )
+    {
+        PLItem *item = FindByInput( rootItem, input_GetItem( p_input )->i_id );
+        emit currentChanged( index( item, 0 ) );
+    }
 }
 void PLModel::ProcessInputItemUpdate( int i_input_id )
 {
index 6e55161baf9164fb91ed7c27cfeb4e3629c1bf51..a28c3a8dbb45a07e113b41352eb2a9ce07ce70c8 100644 (file)
@@ -167,6 +167,8 @@ private:
     int i_cached_input_id;
 signals:
     void shouldRemove( int );
+    void currentChanged( const QModelIndex& );
+
 
 public slots:
     void activateItem( const QModelIndex &index );
index 7b41816e8ced8f61c55f8fa00237679756fd7b69..51cb0f9f15b7c95170e0359901de402cc51f12b6 100644 (file)
@@ -72,7 +72,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     view->setDragEnabled( true );
     view->setAcceptDrops( true );
     view->setDropIndicatorShown( true );
-    view->setAutoScroll( true );
 
 
     getSettings()->beginGroup("Playlist");
@@ -97,10 +96,10 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
              model,activateItem( const QModelIndex& ) );
     CONNECT( view, rightClicked( QModelIndex , QPoint ),
              this, doPopup( QModelIndex, QPoint ) );
-    CONNECT( model, dataChanged( const QModelIndex&, const QModelIndex& ),
-             this, handleExpansion( const QModelIndex& ) );
     CONNECT( view->header(), customContextMenuRequested( const QPoint & ),
              this, popupSelectColumn( QPoint ) );
+    CONNECT( model, currentChanged( const QModelIndex& ),
+             this, handleExpansion( const QModelIndex& ) );
 
     currentRootId = -1;
     CONNECT( parent, rootChanged( int ), this, setCurrentRootId( int ) );
@@ -207,10 +206,9 @@ void StandardPLPanel::gotoPlayingItem()
     view->scrollTo( view->currentIndex() );
 }
 
-void StandardPLPanel::handleExpansion( const QModelIndex &index )
+void StandardPLPanel::handleExpansion( const QModelIndexindex )
 {
-    if( model->isCurrent( index ) )
-        view->scrollTo( index, QAbstractItemView::EnsureVisible );
+    view->scrollTo( index, QAbstractItemView::EnsureVisible );
 }
 
 void StandardPLPanel::setCurrentRootId( int _new )