[vlc-devel] commit: QT4: only scroll playlist to new item when it changes ( Ilkka Ollakka )

git version control git at videolan.org
Sat Jul 25 19:07:31 CEST 2009


vlc | branch: 1.0-bugfix | Ilkka Ollakka <ileoo at videolan.org> | Sat Jul 25 15:26:07 2009 +0300| [2387f88de99101910d807773788bb35169b5bbd9] | committer: Jean-Baptiste Kempf 

QT4: only scroll playlist to new item when it changes

should fix bug #2947 ,now it scrolls to new item when theres actual
input-change, not just data changed.
(cherry picked from commit 5f81bec53ccae76400188a5baa9d7ce099fdadef)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 .../gui/qt4/components/playlist/playlist_model.cpp |    5 +++++
 .../gui/qt4/components/playlist/playlist_model.hpp |    2 ++
 .../gui/qt4/components/playlist/standardpanel.cpp  |   10 ++++------
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index dc89e65..1f756fc 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -533,6 +533,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 )
 {
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 6e55161..a28c3a8 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -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 );
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index d0cca4d..8db504f 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -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 QModelIndex& index )
 {
-    if( model->isCurrent( index ) )
-        view->scrollTo( index, QAbstractItemView::EnsureVisible );
+    view->scrollTo( index, QAbstractItemView::EnsureVisible );
 }
 
 void StandardPLPanel::setCurrentRootId( int _new )




More information about the vlc-devel mailing list