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 1ac3c18..e6b41c4 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 b3d29f0..4709378 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 ) )