aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui/playstate.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-09-15 18:29:45 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-09-15 18:29:45 +0000
commite2bc4908a3397ded862d9e8494544131e4448158 (patch)
treea72cb3ed23c4df927739df3a57a387b80c12ffed /src/qmmpui/playstate.cpp
parent4b02064e9f260443c38ba6e145d64715b9031e27 (diff)
downloadqmmp-e2bc4908a3397ded862d9e8494544131e4448158.tar.gz
qmmp-e2bc4908a3397ded862d9e8494544131e4448158.tar.bz2
qmmp-e2bc4908a3397ded862d9e8494544131e4448158.zip
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
Diffstat (limited to 'src/qmmpui/playstate.cpp')
-rw-r--r--src/qmmpui/playstate.cpp41
1 files changed, 38 insertions, 3 deletions
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;
+}
+