aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui/mediaplayer.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-07-15 14:39:35 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-07-15 14:39:35 +0000
commitdb0834220d3c3e11c77d24de356cdd975343442d (patch)
tree483750c572af6d8c74852f9be37adb0c1c606c02 /src/qmmpui/mediaplayer.cpp
parentd69b825c74552cbaa7027297782e3c2bd89901a7 (diff)
downloadqmmp-db0834220d3c3e11c77d24de356cdd975343442d.tar.gz
qmmp-db0834220d3c3e11c77d24de356cdd975343442d.tar.bz2
qmmp-db0834220d3c3e11c77d24de356cdd975343442d.zip
fixed cue support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1037 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/mediaplayer.cpp')
-rw-r--r--src/qmmpui/mediaplayer.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/qmmpui/mediaplayer.cpp b/src/qmmpui/mediaplayer.cpp
index 3f7545091..42a0cf6b8 100644
--- a/src/qmmpui/mediaplayer.cpp
+++ b/src/qmmpui/mediaplayer.cpp
@@ -64,7 +64,7 @@ void MediaPlayer::initialize(SoundCore *core, PlayListModel *model)
m_model = model;
m_repeat = FALSE;
connect(m_core, SIGNAL(finished()), SLOT(next()));
- connect(m_core, SIGNAL(aboutToFinish()), SLOT(sendNext()));
+ //connect(m_model, SIGNAL(listChanged()), SLOT(updateNextUrl()));
}
PlayListModel *MediaPlayer::playListModel()
@@ -79,9 +79,8 @@ bool MediaPlayer::isRepeatable() const
void MediaPlayer::play()
{
- qDebug("+1");
+ disconnect(m_model, SIGNAL(listChanged()), this, SLOT(updateNextUrl()));
m_model->doCurrentVisibleRequest();
- qDebug("+2");
if (m_core->state() == Qmmp::Paused)
{
m_core->pause();
@@ -90,15 +89,13 @@ void MediaPlayer::play()
if (m_model->count() == 0)
return;
- qDebug("+3");
+
QString s = m_model->currentItem()->url();
if (s.isEmpty())
return;
- qDebug("+4");
- //m_core->setNext (m_model->nextItem()->url());
+
if (!m_core->play(s))
{
- qDebug("+5");
//find out the reason why playback failed
switch ((int) m_core->state())
{
@@ -134,17 +131,9 @@ void MediaPlayer::play()
}
else
{
- qDebug("1");
m_skips = 0;
- qDebug("2");
- if(m_model->nextItem())
- {
- qDebug("3");
- m_core->setNext (m_model->nextItem()->url());
- qDebug("MediaPlayer: current item: %s",qPrintable(m_core->url()));
- qDebug("MediaPlayer: next item: %s",qPrintable(m_core->nextUrl()));
- qDebug("4");
- }
+ updateNextUrl();
+ connect(m_model, SIGNAL(listChanged()), this, SLOT(updateNextUrl()));
}
}
@@ -155,6 +144,7 @@ void MediaPlayer::stop()
void MediaPlayer::next()
{
+ disconnect(m_model, SIGNAL(listChanged()), this, SLOT(updateNextUrl()));
if (!m_model->isEmptyQueue())
{
m_model->setCurrentToQueued();
@@ -164,7 +154,7 @@ void MediaPlayer::next()
stop();
return;
}
- //m_playlist->update();
+
if (m_core->state() != Qmmp::Stopped)
{
if (m_core->state() == Qmmp::Paused)
@@ -175,22 +165,19 @@ void MediaPlayer::next()
void MediaPlayer::previous()
{
+ disconnect(m_model, SIGNAL(listChanged()), this, SLOT(updateNextUrl()));
if (!m_model->previous())
{
stop();
- //display->hideTimeDisplay();
return;
}
- //m_playlist->update();
if (m_core->state() != Qmmp::Stopped)
{
if (m_core->state() == Qmmp::Paused)
stop();
play();
}
- /*else
- display->hideTimeDisplay();*/
}
void MediaPlayer::setRepeatable(bool r)
@@ -207,11 +194,13 @@ void MediaPlayer::setRepeatable(bool r)
}
m_repeat = r;
emit repeatableChanged(r);
+ updateNextUrl();
}
-void MediaPlayer::sendNext()
+void MediaPlayer::updateNextUrl()
{
- /*if(m_model->nextItem())
- qDebug("MediaPlayer: next item: %s",qPrintable(m_model->nextItem()->url()));*/
+ if(m_model->nextItem() && !isRepeatable())
+ m_core->setNextUrl(m_model->nextItem()->url());
+ else
+ m_core->clearNextUrl();
}
-