Commit 2387f88d authored by Ilkka Ollakka's avatar Ilkka Ollakka Committed by 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 5f81bec5)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 68870352
...@@ -533,6 +533,11 @@ void PLModel::ProcessInputItemUpdate( input_thread_t *p_input ) ...@@ -533,6 +533,11 @@ void PLModel::ProcessInputItemUpdate( input_thread_t *p_input )
{ {
if( !p_input ) return; if( !p_input ) return;
ProcessInputItemUpdate( input_GetItem( p_input )->i_id ); 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 ) void PLModel::ProcessInputItemUpdate( int i_input_id )
{ {
......
...@@ -167,6 +167,8 @@ private: ...@@ -167,6 +167,8 @@ private:
int i_cached_input_id; int i_cached_input_id;
signals: signals:
void shouldRemove( int ); void shouldRemove( int );
void currentChanged( const QModelIndex& );
public slots: public slots:
void activateItem( const QModelIndex &index ); void activateItem( const QModelIndex &index );
......
...@@ -72,7 +72,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -72,7 +72,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
view->setDragEnabled( true ); view->setDragEnabled( true );
view->setAcceptDrops( true ); view->setAcceptDrops( true );
view->setDropIndicatorShown( true ); view->setDropIndicatorShown( true );
view->setAutoScroll( true );
getSettings()->beginGroup("Playlist"); getSettings()->beginGroup("Playlist");
...@@ -97,10 +96,10 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -97,10 +96,10 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
model,activateItem( const QModelIndex& ) ); model,activateItem( const QModelIndex& ) );
CONNECT( view, rightClicked( QModelIndex , QPoint ), CONNECT( view, rightClicked( QModelIndex , QPoint ),
this, doPopup( QModelIndex, QPoint ) ); this, doPopup( QModelIndex, QPoint ) );
CONNECT( model, dataChanged( const QModelIndex&, const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
CONNECT( view->header(), customContextMenuRequested( const QPoint & ), CONNECT( view->header(), customContextMenuRequested( const QPoint & ),
this, popupSelectColumn( QPoint ) ); this, popupSelectColumn( QPoint ) );
CONNECT( model, currentChanged( const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
currentRootId = -1; currentRootId = -1;
CONNECT( parent, rootChanged( int ), this, setCurrentRootId( int ) ); CONNECT( parent, rootChanged( int ), this, setCurrentRootId( int ) );
...@@ -207,10 +206,9 @@ void StandardPLPanel::gotoPlayingItem() ...@@ -207,10 +206,9 @@ void StandardPLPanel::gotoPlayingItem()
view->scrollTo( view->currentIndex() ); 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 ) void StandardPLPanel::setCurrentRootId( int _new )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment