aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qmmpui/playlistmodel.cpp11
-rw-r--r--src/qmmpui/playlistmodel.h3
2 files changed, 8 insertions, 6 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp
index 58cac7770..7cfe7fb09 100644
--- a/src/qmmpui/playlistmodel.cpp
+++ b/src/qmmpui/playlistmodel.cpp
@@ -147,8 +147,10 @@ PlayListItem* PlayListModel::currentItem()
PlayListItem* PlayListModel::nextItem()
{
- if(m_items.isEmpty() || !isEmptyQueue() || !m_play_state)
+ if(m_items.isEmpty() || !m_play_state)
return 0;
+ if(!isEmptyQueue())
+ return m_queued_songs.at(0);
int index = m_play_state->nextIndex();
if(index < 0 || (index + 1 > m_items.count()))
return 0;
@@ -621,9 +623,9 @@ void PlayListModel::addToQueue()
void PlayListModel::setQueued(PlayListItem* file)
{
if (isQueued(file))
- m_queued_songs.removeAt(m_queued_songs.indexOf(file));
+ m_queued_songs.removeAll(file);
else
- m_queued_songs.append(file);
+ m_queued_songs.enqueue(file);
emit listChanged();
}
@@ -634,8 +636,7 @@ bool PlayListModel::isQueued(PlayListItem* f) const
void PlayListModel::setCurrentToQueued()
{
- setCurrent(row(m_queued_songs.at(0)));
- m_queued_songs.pop_front();
+ setCurrent(row(m_queued_songs.dequeue()));
}
bool PlayListModel::isEmptyQueue() const
diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h
index 2f1dca2e4..d6eb3c4f4 100644
--- a/src/qmmpui/playlistmodel.h
+++ b/src/qmmpui/playlistmodel.h
@@ -24,6 +24,7 @@
#include <QString>
#include <QStringList>
#include <QMap>
+#include <QQueue>
#include <QPointer>
#include <QVector>
#include "playlistitem.h"
@@ -455,7 +456,7 @@ private:
/*!
* Songs in play queue.
*/
- QList<PlayListItem*> m_queued_songs;
+ QQueue <PlayListItem*> m_queued_songs;
/*!
* Is playlist repeatable?
*/