mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01: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:
parent
f3eb8fa30a
commit
6ec8f127c0
@ -110,7 +110,7 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
QModelIndex idx = index( 0, 0 );
|
||||
if( rowCount() )
|
||||
if ( rowCount() )
|
||||
{
|
||||
if ( m_shuffled )
|
||||
{
|
||||
@ -123,12 +123,7 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
||||
idx = currentIndex();
|
||||
|
||||
// random mode is disabled
|
||||
if ( m_repeatMode == PlaylistInterface::RepeatOne )
|
||||
{
|
||||
// repeat one track
|
||||
idx = index( idx.row(), 0 );
|
||||
}
|
||||
else
|
||||
if ( m_repeatMode != PlaylistInterface::RepeatOne )
|
||||
{
|
||||
// keep progressing through the playlist normally
|
||||
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)
|
||||
if ( idx.isValid() ) do
|
||||
while ( idx.isValid() )
|
||||
{
|
||||
TrackModelItem* item = itemFromIndex( mapToSource( idx ) );
|
||||
if ( item && item->query()->playable() )
|
||||
@ -165,7 +160,6 @@ TrackProxyModel::siblingItem( int itemsAway, bool readOnly )
|
||||
|
||||
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0 );
|
||||
}
|
||||
while ( idx.isValid() );
|
||||
|
||||
if ( !readOnly )
|
||||
setCurrentIndex( QModelIndex() );
|
||||
|
@ -334,11 +334,14 @@ TreeProxyModel::siblingItem( int itemsAway, bool readOnly )
|
||||
return Tomahawk::result_ptr();
|
||||
|
||||
if ( m_shuffled )
|
||||
{
|
||||
idx = index( qrand() % rowCount( idx.parent() ), 0, idx.parent() );
|
||||
else if ( m_repeatMode == PlaylistInterface::RepeatOne )
|
||||
idx = index( idx.row(), 0, idx.parent() );
|
||||
}
|
||||
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 )
|
||||
{
|
||||
@ -355,11 +358,8 @@ TreeProxyModel::siblingItem( int itemsAway, bool readOnly )
|
||||
}
|
||||
|
||||
// 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 ) );
|
||||
if ( item && !item->result().isNull() && item->result()->isOnline() )
|
||||
{
|
||||
@ -368,8 +368,9 @@ TreeProxyModel::siblingItem( int itemsAway, bool readOnly )
|
||||
setCurrentIndex( idx );
|
||||
return item->result();
|
||||
}
|
||||
|
||||
idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0, idx.parent() );
|
||||
}
|
||||
while ( idx.isValid() );
|
||||
|
||||
if ( !readOnly )
|
||||
setCurrentIndex( QModelIndex() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user