mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
add resolved tracks as we get them when previewing, and stop previewing if we're running
This commit is contained in:
@@ -191,6 +191,14 @@ DynamicModel::filteringTrackResolved( bool successful )
|
|||||||
Query* q = qobject_cast< Query* >( sender() );
|
Query* q = qobject_cast< Query* >( sender() );
|
||||||
Q_ASSERT( q );
|
Q_ASSERT( q );
|
||||||
|
|
||||||
|
// if meantime the user began the station, abort
|
||||||
|
if( m_onDemandRunning ) {
|
||||||
|
m_toResolveList.clear();
|
||||||
|
m_resolvedList.clear();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
query_ptr realptr;
|
query_ptr realptr;
|
||||||
foreach( const query_ptr& qptr, m_toResolveList ) {
|
foreach( const query_ptr& qptr, m_toResolveList ) {
|
||||||
if( qptr.data() == q ) {
|
if( qptr.data() == q ) {
|
||||||
@@ -203,21 +211,22 @@ DynamicModel::filteringTrackResolved( bool successful )
|
|||||||
|
|
||||||
m_toResolveList.removeAll( realptr );
|
m_toResolveList.removeAll( realptr );
|
||||||
|
|
||||||
if( successful )
|
if( successful ) {
|
||||||
m_resolvedList << realptr;
|
m_resolvedList << realptr;
|
||||||
|
|
||||||
if( m_toResolveList.isEmpty() || m_resolvedList.size() == m_limitResolvedTo ) { // done, add to playlist
|
// append and update internal lastResolvedRow
|
||||||
if( m_limitResolvedTo < m_resolvedList.count() ) // limit to how many we were asked for
|
addToPlaylist( QList< query_ptr >() << realptr, false );
|
||||||
m_resolvedList = m_resolvedList.mid( 0, m_limitResolvedTo );
|
|
||||||
|
|
||||||
addToPlaylist( m_resolvedList, true );
|
|
||||||
m_toResolveList.clear();
|
|
||||||
m_resolvedList.clear();
|
|
||||||
|
|
||||||
if( m_playlist->mode() == OnDemand ) {
|
if( m_playlist->mode() == OnDemand ) {
|
||||||
m_lastResolvedRow = rowCount( QModelIndex() );
|
m_lastResolvedRow = rowCount( QModelIndex() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_toResolveList.isEmpty() || m_resolvedList.size() == m_limitResolvedTo ) { // done
|
||||||
|
m_toResolveList.clear();
|
||||||
|
m_resolvedList.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( m_toResolveList.isEmpty() && rowCount( QModelIndex() ) == 0 ) // we failed
|
if( m_toResolveList.isEmpty() && rowCount( QModelIndex() ) == 0 ) // we failed
|
||||||
emit trackGenerationFailure( tr( "Could not find a playable track.\n\nPlease change the filters or try again." ) );
|
emit trackGenerationFailure( tr( "Could not find a playable track.\n\nPlease change the filters or try again." ) );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user