aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-08-13 16:47:32 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-08-13 16:47:32 +0000
commitef99712682b1f35c6247d24685173e1d9d276922 (patch)
tree390158fc2c5f7c06c3aa49b08064cb8a8407dc1f
parent14ff3ad8079147ef188270eb10631c0c2962435d (diff)
downloadqmmp-ef99712682b1f35c6247d24685173e1d9d276922.tar.gz
qmmp-ef99712682b1f35c6247d24685173e1d9d276922.tar.bz2
qmmp-ef99712682b1f35c6247d24685173e1d9d276922.zip
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
-rw-r--r--src/qmmpui/playlistcontainer.cpp11
-rw-r--r--src/qmmpui/playlistcontainer.h2
-rw-r--r--src/qmmpui/playlistmodel.cpp9
3 files changed, 14 insertions, 8 deletions
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<PlayListTrack *> tracks)
removeTrack(t);
}
-void PlayListContainer::move(QList<int> indexes, int from, int to)
+bool PlayListContainer::move(QList<int> indexes, int from, int to)
{
PlayListGroup *group = 0;
@@ -212,15 +212,16 @@ void PlayListContainer::move(QList<int> 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<int> 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<int> indexes, int from, int to)
indexes[i] + to - from - group->firstIndex - 1);
}
}
+ }
+ return true;
}
void PlayListContainer::clear()
diff --git a/src/qmmpui/playlistcontainer.h b/src/qmmpui/playlistcontainer.h
index 159a64b6c..bd80364ef 100644
--- a/src/qmmpui/playlistcontainer.h
+++ b/src/qmmpui/playlistcontainer.h
@@ -55,7 +55,7 @@ public:
void removeTrack(PlayListTrack *track);
void removeTracks(QList<PlayListTrack *> tracks);
- void move(QList<int> indexes, int from, int to);
+ bool move(QList<int> indexes, int from, int to);
void clear();
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp
index ab97fae0c..bcb4b739e 100644
--- a/src/qmmpui/playlistmodel.cpp
+++ b/src/qmmpui/playlistmodel.cpp
@@ -495,7 +495,11 @@ void PlayListModel::moveItems(int from, int to)
topmostInSelection(from) == INVALID_INDEX)
return;
- m_container.move(selected_indexes, from, to);
+ if(m_container.move(selected_indexes, from, to))
+ {
+ m_current = m_container.indexOf(m_current_track);
+ emit listChanged();
+ }
/*if (from > to)
foreach(int i, selected_indexes)
@@ -515,9 +519,6 @@ void PlayListModel::moveItems(int from, int to)
else
m_items.move(selected_indexes[i],selected_indexes[i] + to - from);
}*/
-
- m_current = m_container.indexOf(m_current_track);
- emit listChanged();
}
int PlayListModel::topmostInSelection(int row)