Summary: | songs are removed from the playlist when dynamic playlist upcoming tracks count is reduced | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | richlv |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | knt |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Slackware | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
richlv
2006-08-15 14:46:52 UTC
why not? existing songs in the playlist are not removed when a dynamic playlist is loaded, currently even new songs are added if existing upcoming tracks are more than configured (this i would like to see changed, but that is a different issue). now, if a user has a dynamic playlist, but would like to reduce the amount at which new songs are added, reducing this parameter in options seems a logical choice. i would expect amarok to stop adding new tracks until upcoming tracks are less than the parameter (which it currently does not ;) ), but removal of already existing sonfs seems very counterintuitive. that is, i am reducing the count for upcoming songs to be _added_, which should not affect already existing tracks. SVN commit 604569 by seb: * Don't remove tracks from the playlist when reducing the upcoming count of the current dynamic mode * Only append tracks to the playlist if the playlist track count is greater than dynamic mode upcoming count BUG: 132447 BUG: 124440 M +13 -29 playlist.cpp --- trunk/extragear/multimedia/amarok/src/playlist.cpp #604568:604569 @@ -617,8 +617,6 @@ void Playlist::adjustDynamicUpcoming( bool saveUndo ) { - int x = 0; - /** * If m_currentTrack exists, we iterate until we find it * Else, we iterate until we find an item which is enabled @@ -636,36 +634,16 @@ if( m_currentTrack ) ++it; - + int x = 0; for ( ; *it && x < dynamicMode()->upcomingCount() ; ++it, ++x ); if ( x < dynamicMode()->upcomingCount() ) { addDynamicModeTracks( dynamicMode()->upcomingCount() - x ); } - else - { - if( isLocked() ) return; - //assemble a list of what needs removing - //calling removeItem() iteratively is more efficient if they are in _reverse_ order, hence the prepend() - QPtrList<QListViewItem> list; - for ( ; *it ; ++it ) { - list.append( it.current() ); - } - - if( list.isEmpty() ) return; - if( saveUndo ) - saveUndoState(); - - //remove the items - for( QListViewItem *item = list.last(); item; item = list.prev() ) - { - removeItem( static_cast<PlaylistItem*>( item ) ); - delete item; - } - //NOTE no need to emit childCountChanged(), removeItem() does that for us - } + if( saveUndo ) + saveUndoState(); } /** @@ -1212,13 +1190,15 @@ MyIterator it( this, MyIterator::Visible ); if( !item ) item = currentTrack(); - for( int x=0 ; *it; ++it, x++ ) + int x = 0; + for( ; *it; ++it, x++ ) { if( *it == item ) { for ( PlaylistItem *first = firstChild(); dynamicMode()->cycleTracks() && x >= dynamicMode()->previousCount() && first; - first = firstChild(), x-- ) { + first = firstChild(), x-- ) + { removeItem( first ); //first visible item delete first; } @@ -1226,9 +1206,13 @@ } } - //Just starting to play from stopped, don't append something needlessely - bool dontAppend = EngineController::instance()->engine()->state() == Engine::Empty; + const int upcomingTracks = childCount() - x; + // Just starting to play from stopped, don't append something needlessely + // or, we have more than enough items in the queue. + bool dontAppend = ( EngineController::instance()->engine()->state() == Engine::Empty ) || + upcomingTracks >= dynamicMode()->upcomingCount(); + //keep upcomingTracks requirement, this seems to break StopAfterCurrent if( !dontAppend && m_stopAfterTrack != m_currentTrack ) { fix confirmed in revision 604744 *** Bug 140449 has been marked as a duplicate of this bug. *** |