diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-03-11 21:12:34 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2010-03-11 21:12:34 +0000 |
| commit | 29c73615f48a72b13e1ebeb8871fb7129715d21f (patch) | |
| tree | 7852ade033fca90a99b347d52b220eec0bfbc21d /src/qmmpui/playlistmodel.cpp | |
| parent | 11b7655bb103974d3a855d64dc0b6ec1b0df4ba1 (diff) | |
| download | qmmp-29c73615f48a72b13e1ebeb8871fb7129715d21f.tar.gz qmmp-29c73615f48a72b13e1ebeb8871fb7129715d21f.tar.bz2 qmmp-29c73615f48a72b13e1ebeb8871fb7129715d21f.zip | |
added 'remove duplicates' action
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1621 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/playlistmodel.cpp')
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 007eee910..53ba242c8 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright(C) 2006-2009 by Ilya Kotov * + * Copyright(C) 2006-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -414,7 +414,7 @@ FileLoader * PlayListModel::createFileLoader() FileLoader* f_loader = new FileLoader(this); // f_loader->setStackSize(20 * 1024 * 1024); m_running_loaders << f_loader; - connect(f_loader,SIGNAL(newPlayListItem(PlayListItem*)), SLOT(add(PlayListItem*)),Qt::QueuedConnection); + connect(f_loader,SIGNAL(newPlayListItem(PlayListItem*)),SLOT(add(PlayListItem*)),Qt::QueuedConnection); connect(f_loader,SIGNAL(finished()),this,SLOT(preparePlayState())); connect(f_loader,SIGNAL(finished()),f_loader,SLOT(deleteLater())); return f_loader; @@ -920,3 +920,15 @@ void PlayListModel::removeInvalidItems() removeItem(item); } } + +void PlayListModel::removeDuplicates() +{ + for(int i = 0; i < m_items.size(); ++i) + { + for(int j = i + 1; j < m_items.size(); ++j) + { + if(m_items.at(i)->url() == m_items.at(j)->url()) + removeItem(m_items.at(j)); + } + } +} |
