From ef99712682b1f35c6247d24685173e1d9d276922 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 13 Aug 2013 16:47:32 +0000 Subject: do not emit useless listChanged() signal git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3593 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/playlistcontainer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/qmmpui/playlistcontainer.cpp') diff --git a/src/qmmpui/playlistcontainer.cpp b/src/qmmpui/playlistcontainer.cpp index 6f0297061..ecd8fbdff 100644 --- a/src/qmmpui/playlistcontainer.cpp +++ b/src/qmmpui/playlistcontainer.cpp @@ -197,7 +197,7 @@ void PlayListContainer::removeTracks(QList tracks) removeTrack(t); } -void PlayListContainer::move(QList indexes, int from, int to) +bool PlayListContainer::move(QList indexes, int from, int to) { PlayListGroup *group = 0; @@ -212,15 +212,16 @@ void PlayListContainer::move(QList indexes, int from, int to) } if(!group) - return; + return false; foreach (int i, indexes) { if(i <= group->firstIndex || i > group->lastIndex) - return; + return false; } if (from > to) + { foreach(int i, indexes) { if (i + to - from < 0) @@ -232,7 +233,9 @@ void PlayListContainer::move(QList indexes, int from, int to) i + to - from - group->firstIndex - 1); } } + } else + { for (int i = indexes.count() - 1; i >= 0; i--) { if (indexes[i] + to - from >= m_items.count()) @@ -244,6 +247,8 @@ void PlayListContainer::move(QList indexes, int from, int to) indexes[i] + to - from - group->firstIndex - 1); } } + } + return true; } void PlayListContainer::clear() -- cgit v1.2.3-13-gbd6f