From e2bc4908a3397ded862d9e8494544131e4448158 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 15 Sep 2010 18:29:45 +0000 Subject: fixed problem with shuffle and crossfade git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1888 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/playstate.cpp | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src/qmmpui/playstate.cpp') diff --git a/src/qmmpui/playstate.cpp b/src/qmmpui/playstate.cpp index ad2bbf9fb..d730e6fda 100644 --- a/src/qmmpui/playstate.cpp +++ b/src/qmmpui/playstate.cpp @@ -31,7 +31,7 @@ bool ShufflePlayState::next() if (itm_count > 0) { - if (m_shuffled_current >= m_shuffled_indexes.count() -1 ) + if (m_shuffled_current >= m_shuffled_indexes.count() - 1) { if (!m_model->isRepeatableList()) return false; @@ -39,13 +39,31 @@ bool ShufflePlayState::next() prepare(); } - if (m_shuffled_current < m_shuffled_indexes.count() - 1)m_shuffled_current++; + if (m_shuffled_current < m_shuffled_indexes.count() - 1) + m_shuffled_current++; return m_model->setCurrent(m_shuffled_indexes.at(m_shuffled_current)); } return false; } +int ShufflePlayState::nextIndex() +{ + int itm_count = m_model->items().count(); + if(!itm_count) + return -1; + + + if (m_shuffled_current >= m_shuffled_indexes.count() - 1) + { + if (!m_model->isRepeatableList()) + return -1; + else + prepare(); + } + return m_shuffled_indexes.at(m_shuffled_current + 1); +} + bool ShufflePlayState::previous() { int itm_count = m_model->items().count(); @@ -63,7 +81,8 @@ bool ShufflePlayState::previous() } } - if (itm_count > 1) m_shuffled_current --; + if (itm_count > 1) + m_shuffled_current --; m_model->setCurrent(m_shuffled_indexes.at(m_shuffled_current)); return true; @@ -132,3 +151,19 @@ bool NormalPlayState::previous() return false; } +int NormalPlayState::nextIndex() +{ + int itm_count = m_model->items().count(); + if(!itm_count) + return -1; + + if (m_model->currentRow() == itm_count - 1) + { + if (m_model->isRepeatableList()) + return 0; + else + return -1; + } + return m_model->currentRow() + 1; +} + -- cgit v1.2.3-13-gbd6f