diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-07-01 15:49:27 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-07-01 15:49:27 +0000 |
| commit | d4bb0061a64b7af4eb66df503af362b97c566975 (patch) | |
| tree | f95b8ed90a45805e07ee26d24fb3ef7e45565067 /src/qmmpui/playlistmodel.cpp | |
| parent | 88f4334cc3a64bf602e4c16c92c1a230e53af986 (diff) | |
| download | qmmp-d4bb0061a64b7af4eb66df503af362b97c566975.tar.gz qmmp-d4bb0061a64b7af4eb66df503af362b97c566975.tar.bz2 qmmp-d4bb0061a64b7af4eb66df503af362b97c566975.zip | |
fixed queue update bug
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3529 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/playlistmodel.cpp')
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 0ff3b17c2..5d2004c4e 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -342,20 +342,21 @@ void PlayListModel::removeAt (int i) { if ((i < count()) && (i >= 0)) { - PlayListItem* f = m_items.takeAt(i); - if(m_stop_item == f) + PlayListItem* item = m_items.takeAt(i); + m_queued_songs.removeAll(item); + if(m_stop_item == item) m_stop_item = 0; - m_total_length -= f->length(); + m_total_length -= item->length(); if (m_total_length < 0) m_total_length = qMin(0, m_total_length); - if (f->flag() == PlayListItem::FREE) + if (item->flag() == PlayListItem::FREE) { - delete f; - f = NULL; + delete item; + item = NULL; } - else if (f->flag() == PlayListItem::EDITING) - f->setFlag(PlayListItem::SCHEDULED_FOR_DELETION); + else if (item->flag() == PlayListItem::EDITING) + item->setFlag(PlayListItem::SCHEDULED_FOR_DELETION); if (m_current >= i && m_current != 0) m_current--; @@ -385,20 +386,21 @@ void PlayListModel::removeSelection(bool inverted) { if (m_items.at(i)->isSelected() ^ inverted) { - PlayListItem* f = m_items.takeAt(i); - if(f == m_stop_item) + PlayListItem* item = m_items.takeAt(i); + m_queued_songs.removeAll(item); + if(item == m_stop_item) m_stop_item = 0; - m_total_length -= f->length(); + m_total_length -= item->length(); if (m_total_length < 0) m_total_length = 0; - if (f->flag() == PlayListItem::FREE) + if (item->flag() == PlayListItem::FREE) { - delete f; - f = NULL; + delete item; + item = NULL; } - else if (f->flag() == PlayListItem::EDITING) - f->setFlag(PlayListItem::SCHEDULED_FOR_DELETION); + else if (item->flag() == PlayListItem::EDITING) + item->setFlag(PlayListItem::SCHEDULED_FOR_DELETION); select_after_delete = i; @@ -579,12 +581,12 @@ void PlayListModel::addToQueue() emit listChanged(); } -void PlayListModel::setQueued(PlayListItem* file) +void PlayListModel::setQueued(PlayListItem* item) { - if (isQueued(file)) - m_queued_songs.removeAll(file); + if (isQueued(item)) + m_queued_songs.removeAll(item); else - m_queued_songs.enqueue(file); + m_queued_songs.enqueue(item); emit listChanged(); } |
