diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-12-23 21:13:34 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-12-23 21:13:34 +0000 |
| commit | fedd13511bbf91914a0250b43c440f43e6d1e8c5 (patch) | |
| tree | 03cca77aab98ce8c8c2b261f345655d64ae8e172 /src/qmmpui/playlistmodel.cpp | |
| parent | ac7a7dffc31afe8a20a51db4ab7749bf4fdea67c (diff) | |
| download | qmmp-fedd13511bbf91914a0250b43c440f43e6d1e8c5.tar.gz qmmp-fedd13511bbf91914a0250b43c440f43e6d1e8c5.tar.bz2 qmmp-fedd13511bbf91914a0250b43c440f43e6d1e8c5.zip | |
full mpris support; new options: "repeat track", "show protocol"
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@698 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/playlistmodel.cpp')
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 812ae51b2..2f00568f9 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -72,6 +72,7 @@ PlayListModel::PlayListModel(QObject *parent) : QObject(parent) , m_selection() { qsrand(time(0)); + m_shuffle = 0; m_total_length = 0; m_current = 0; m_block_update_signals = false; @@ -240,6 +241,34 @@ void PlayListModel::removeUnselected() removeSelection(true); } +void PlayListModel::removeAt (int i) +{ + if ((i < count()) && (i >= 0)) + { + PlayListItem* f = m_items.takeAt(i); + m_total_length -= f->length(); + if (m_total_length < 0) + m_total_length = qMin(0, m_total_length); + + if (f->flag() == PlayListItem::FREE) + { + delete f; + f = NULL; + } + else if (f->flag() == PlayListItem::EDITING) + f->setFlag(PlayListItem::SCHEDULED_FOR_DELETION); + + if (m_current >= i && m_current != 0) + m_current--; + + if (!m_items.isEmpty()) + m_currentItem = m_items.at(m_current); + + m_play_state->prepare(); + emit listChanged(); + } +} + void PlayListModel::removeSelection(bool inverted) { int i = 0; @@ -826,7 +855,9 @@ void PlayListModel::prepareForShufflePlaying(bool val) else m_play_state = new NormalPlayState(this); - emit shuffleChanged(val); + m_shuffle = val; + + emit shuffleChanged(val); } void PlayListModel::prepareForRepeatablePlaying(bool val) @@ -904,7 +935,7 @@ bool PlayListModel::isRepeatableList() const bool PlayListModel::isShuffle() const { - return FALSE; //TODO fix this + return m_shuffle; } bool PlayListModel::isFileLoaderRunning() const |
