[vlc-commits] commit: Qt4: pictureflow, if target futher than 20, jump closer and scroll last 20 items (Ilkka Ollakka )

git at videolan.org git at videolan.org
Fri Nov 19 12:49:00 CET 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Fri Nov 19 13:37:19 2010 +0200| [0c1d5a897672e4f2d153a91ba60ef21a238f8def] | committer: Ilkka Ollakka 

Qt4: pictureflow, if target futher than 20, jump closer and scroll last 20 items

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

 modules/gui/qt4/components/playlist/views.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp
index 3b40a94..3af0233 100644
--- a/modules/gui/qt4/components/playlist/views.cpp
+++ b/modules/gui/qt4/components/playlist/views.cpp
@@ -403,8 +403,15 @@ QRect PicFlowView::visualRect(const QModelIndex &index ) const
 void PicFlowView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint)
 {
      int currentIndex = picFlow->centerIndex();
-     if( qAbs( currentIndex - index.row()) > 100 )
-        picFlow->setCenterIndex( index.row());
+     if( qAbs( currentIndex - index.row()) > 20 )
+     {
+        /* offset is offset from target index toward currentIndex */
+        int offset = -19;
+        if( index.row() > currentIndex )
+            offset = 19;
+        picFlow->setCenterIndex( index.row() + offset );
+        picFlow->showSlide( index.row() );
+     }
      else
         picFlow->showSlide( index.row() );
 }



More information about the vlc-commits mailing list