]> git.sesse.net Git - vlc/commitdiff
Qt4 - add a button to scroll to currentItem. Close #1443
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 21 Jan 2008 22:47:06 +0000 (22:47 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 21 Jan 2008 22:47:06 +0000 (22:47 +0000)
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/standardpanel.cpp

index 1ac3c18474c969f73182a8ae603312a0dff5daeb..e6b41c409c158ab70a530601d3183c501afa4a58 100644 (file)
@@ -72,7 +72,7 @@ protected:
     friend class PlaylistWidget;
 private:
     QTreeView *view;
-    QPushButton *repeatButton , *randomButton,*addButton;
+    QPushButton *repeatButton, *randomButton, *addButton, *gotoPlayingButton;
     ClickLineEdit *searchLine;
     int currentRootId;
     QSignalMapper *ContextUpdateMapper;
@@ -84,6 +84,7 @@ private slots:
     void handleExpansion( const QModelIndex& );
     void toggleRandom();
     void toggleRepeat();
+    void gotoPlayingItem();
     void doPopup( QModelIndex index, QPoint point );
     void search( QString search );
     void clearFilter();
index b3d29f00f41a04d9d770cd85c4d9fd6d10d75a52..4709378c2e054b80d66c37962e6d0b7c7535dfd9 100644 (file)
@@ -133,6 +133,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     BUTTONACT( repeatButton, toggleRepeat() );
     buttons->addWidget( repeatButton );
 
+    /* Goto */
+    gotoPlayingButton = new QPushButton( qtr( "X" ), this );
+    BUTTONACT( gotoPlayingButton, gotoPlayingItem() );
+    buttons->addWidget( gotoPlayingButton );
+
     /* A Spacer and the search possibilities */
     QSpacerItem *spacer = new QSpacerItem( 10, 20 );
     buttons->addItem( spacer );
@@ -193,6 +198,11 @@ void StandardPLPanel::toggleRandom()
     randomButton->setToolTip( prev ? qtr( I_PL_NORANDOM ) : qtr(I_PL_RANDOM ) );
 }
 
+void StandardPLPanel::gotoPlayingItem()
+{
+    view->scrollTo( view->currentIndex() );
+}
+
 void StandardPLPanel::handleExpansion( const QModelIndex &index )
 {
     if( model->isCurrent( index ) )