mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
* Fixed freezing when filtering out the current item in a tree-view and trying to advance to the next track.
This commit is contained in:
@@ -110,7 +110,7 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
QModelIndex idx = index( 0, 0 );
|
QModelIndex idx = index( 0, 0 );
|
||||||
if( rowCount() )
|
if ( rowCount() )
|
||||||
{
|
{
|
||||||
if ( m_shuffled )
|
if ( m_shuffled )
|
||||||
{
|
{
|
||||||
@@ -123,12 +123,7 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
idx = currentIndex();
|
idx = currentIndex();
|
||||||
|
|
||||||
// random mode is disabled
|
// random mode is disabled
|
||||||
if ( m_repeatMode == PlaylistInterface::RepeatOne )
|
if ( m_repeatMode != PlaylistInterface::RepeatOne )
|
||||||
{
|
|
||||||
// repeat one track
|
|
||||||
idx = index( idx.row(), 0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// keep progressing through the playlist normally
|
// keep progressing through the playlist normally
|
||||||
idx = index( idx.row() + itemsAway, 0 );
|
idx = index( idx.row() + itemsAway, 0 );
|
||||||
@@ -152,7 +147,7 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the next available PlaylistItem (with results)
|
// Try to find the next available PlaylistItem (with results)
|
||||||
if ( idx.isValid() ) do
|
while ( idx.isValid() )
|
||||||
{
|
{
|
||||||
TrackModelItem* item = itemFromIndex( mapToSource( idx ) );
|
TrackModelItem* item = itemFromIndex( mapToSource( idx ) );
|
||||||
if ( item && item->query()->playable() )
|
if ( item && item->query()->playable() )
|
||||||
@@ -165,7 +160,6 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
|
|
||||||
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0 );
|
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0 );
|
||||||
}
|
}
|
||||||
while ( idx.isValid() );
|
|
||||||
|
|
||||||
if ( !readOnly )
|
if ( !readOnly )
|
||||||
setCurrentIndex( QModelIndex() );
|
setCurrentIndex( QModelIndex() );
|
||||||
|
@@ -334,11 +334,14 @@ TreeProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
return Tomahawk::result_ptr();
|
return Tomahawk::result_ptr();
|
||||||
|
|
||||||
if ( m_shuffled )
|
if ( m_shuffled )
|
||||||
|
{
|
||||||
idx = index( qrand() % rowCount( idx.parent() ), 0, idx.parent() );
|
idx = index( qrand() % rowCount( idx.parent() ), 0, idx.parent() );
|
||||||
else if ( m_repeatMode == PlaylistInterface::RepeatOne )
|
}
|
||||||
idx = index( idx.row(), 0, idx.parent() );
|
|
||||||
else
|
else
|
||||||
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0, idx.parent() );
|
{
|
||||||
|
if ( m_repeatMode != PlaylistInterface::RepeatOne )
|
||||||
|
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0, idx.parent() );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !idx.isValid() && m_repeatMode == PlaylistInterface::RepeatAll )
|
if ( !idx.isValid() && m_repeatMode == PlaylistInterface::RepeatAll )
|
||||||
{
|
{
|
||||||
@@ -355,11 +358,8 @@ TreeProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the next available PlaylistItem (with results)
|
// Try to find the next available PlaylistItem (with results)
|
||||||
if ( idx.isValid() ) do
|
while ( idx.isValid() )
|
||||||
{
|
{
|
||||||
if ( !idx.isValid() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
TreeModelItem* item = itemFromIndex( mapToSource( idx ) );
|
TreeModelItem* item = itemFromIndex( mapToSource( idx ) );
|
||||||
if ( item && !item->result().isNull() && item->result()->isOnline() )
|
if ( item && !item->result().isNull() && item->result()->isOnline() )
|
||||||
{
|
{
|
||||||
@@ -368,8 +368,9 @@ TreeProxyModel::siblingItem( int itemsAway, bool readOnly )
|
|||||||
setCurrentIndex( idx );
|
setCurrentIndex( idx );
|
||||||
return item->result();
|
return item->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0, idx.parent() );
|
||||||
}
|
}
|
||||||
while ( idx.isValid() );
|
|
||||||
|
|
||||||
if ( !readOnly )
|
if ( !readOnly )
|
||||||
setCurrentIndex( QModelIndex() );
|
setCurrentIndex( QModelIndex() );
|
||||||
|
Reference in New Issue
Block a user