[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Amarok] Cleanup use of containers.
From: John Atkinson <john () fauxnetic ! co ! uk>
Date: 2009-09-30 20:51:42
Message-ID: 200909302051.n8UKpg8D026458 () Wurst ! kollide ! net
[Download RAW message or body]
commit eab3b1ff107259a9e1e5ea029c5f1423034d6ad9
Author: John Atkinson <john@fauxnetic.co.uk>
AuthorDate: Wed Sep 30 20:19:43 2009 +0100
Commit: Teo Mrnjavac <teo@getamarok.com>
CommitDate: Wed Sep 30 22:18:33 2009 +0200
Cleanup use of containers.
diff --git a/src/playlist/PlaylistController.cpp \
b/src/playlist/PlaylistController.cpp index 648d05b..1cf5c95 100644
--- a/src/playlist/PlaylistController.cpp
+++ b/src/playlist/PlaylistController.cpp
@@ -293,38 +293,32 @@ Playlist::Controller::removeDeadAndDuplicates()
{
DEBUG_BLOCK
- Meta::TrackList uniqueTracks = m_topmostModel->tracks().toSet().toList();
- QSet<int> rowsToRemove;
+ QSet<Meta::TrackPtr> uniqueTracks = m_topmostModel->tracks().toSet();
+ QList<int> rowsToRemove;
foreach( Meta::TrackPtr unique, uniqueTracks )
{
+ QList<int> trackRows = m_topmostModel->allRowsForTrack( unique ).toList();
+
if( unique->playableUrl().isLocalFile() && !QFile::exists( \
unique->playableUrl().path() ) ) {
// Track is Dead
// TODO: Check remote files as well
- rowsToRemove.unite( m_topmostModel->allRowsForTrack( unique ) );
+ rowsToRemove << trackRows;
}
- else
+ else if( trackRows.size() > 1 )
{
- QSet<int> trackRows = m_topmostModel->allRowsForTrack( unique );
-
- if( trackRows.size() > 1 )
- {
- // Track is Duplicated
- // Remove all rows except the first
- for( QSet<int>::const_iterator it = ++trackRows.constBegin(); it != \
trackRows.constEnd(); ++it )
- rowsToRemove.insert( *it );
- }
+ // Track is Duplicated
+ // Remove all rows except the first
+ for( QList<int>::const_iterator it = ++trackRows.constBegin(); it != \
trackRows.constEnd(); ++it ) + rowsToRemove.push_back( *it );
}
}
if( !rowsToRemove.empty() )
{
- // removeRows() requires a QList reference.
- QList<int> removalRowList = rowsToRemove.toList();
-
m_undoStack->beginMacro( "Remove dead and duplicate entries" ); // TODO: \
Internationalize?
- removeRows( removalRowList );
+ removeRows( rowsToRemove );
m_undoStack->endMacro();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic