aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-07-14 19:15:32 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-07-14 19:15:32 +0000
commit40ee4f96d507067c453c1a790857107ad0c83924 (patch)
treecaeed8eb76f2b5dee833e6401bd1d30ffdf03c94 /src/qmmpui
parent5c8df5c01f76d86a18b221cd11122abaa0da0478 (diff)
downloadqmmp-40ee4f96d507067c453c1a790857107ad0c83924.tar.gz
qmmp-40ee4f96d507067c453c1a790857107ad0c83924.tar.bz2
qmmp-40ee4f96d507067c453c1a790857107ad0c83924.zip
improved cue support (very unstable)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1033 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui')
-rw-r--r--src/qmmpui/mediaplayer.cpp27
-rw-r--r--src/qmmpui/mediaplayer.h3
-rw-r--r--src/qmmpui/playlistmodel.cpp10
-rw-r--r--src/qmmpui/playlistmodel.h2
-rw-r--r--src/qmmpui/playstate.h2
5 files changed, 42 insertions, 2 deletions
diff --git a/src/qmmpui/mediaplayer.cpp b/src/qmmpui/mediaplayer.cpp
index 0f6b7a79f..3f7545091 100644
--- a/src/qmmpui/mediaplayer.cpp
+++ b/src/qmmpui/mediaplayer.cpp
@@ -64,6 +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()));
}
PlayListModel *MediaPlayer::playListModel()
@@ -78,7 +79,9 @@ bool MediaPlayer::isRepeatable() const
void MediaPlayer::play()
{
+ qDebug("+1");
m_model->doCurrentVisibleRequest();
+ qDebug("+2");
if (m_core->state() == Qmmp::Paused)
{
m_core->pause();
@@ -87,12 +90,15 @@ 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())
{
@@ -127,7 +133,19 @@ 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");
+ }
+ }
}
void MediaPlayer::stop()
@@ -190,3 +208,10 @@ void MediaPlayer::setRepeatable(bool r)
m_repeat = r;
emit repeatableChanged(r);
}
+
+void MediaPlayer::sendNext()
+{
+ /*if(m_model->nextItem())
+ qDebug("MediaPlayer: next item: %s",qPrintable(m_model->nextItem()->url()));*/
+}
+
diff --git a/src/qmmpui/mediaplayer.h b/src/qmmpui/mediaplayer.h
index 7c03bf3a3..c4f5d5bdd 100644
--- a/src/qmmpui/mediaplayer.h
+++ b/src/qmmpui/mediaplayer.h
@@ -90,6 +90,9 @@ signals:
*/
void repeatableChanged(bool enabled);
+private slots:
+ void sendNext();
+
private:
PlayListModel *m_model;
SoundCore *m_core;
diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp
index 2e22cf479..eb2aeb705 100644
--- a/src/qmmpui/playlistmodel.cpp
+++ b/src/qmmpui/playlistmodel.cpp
@@ -128,6 +128,16 @@ PlayListItem* PlayListModel::currentItem()
return m_items.at(qMin(m_items.size() - 1, m_current));
}
+PlayListItem* PlayListModel::nextItem()
+{
+ qDebug("==== %d =====", m_current +1);
+ if(isShuffle() || m_items.isEmpty())
+ return 0;
+ if(m_current < m_items.size() - 1)
+ return m_items.at(m_current + 1);
+ return 0;
+}
+
PlayListItem* PlayListModel::item(int row) const
{
return (row < m_items.size() && row >= 0) ? m_items.at(row) : 0;
diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h
index 10a7293c0..b8a095a69 100644
--- a/src/qmmpui/playlistmodel.h
+++ b/src/qmmpui/playlistmodel.h
@@ -115,6 +115,8 @@ public:
* Returns the current item.
*/
PlayListItem* currentItem();
+
+ PlayListItem* nextItem();
/*!
* Returns the row of the \b item
*/
diff --git a/src/qmmpui/playstate.h b/src/qmmpui/playstate.h
index a61ea3d66..c03ac268e 100644
--- a/src/qmmpui/playstate.h
+++ b/src/qmmpui/playstate.h
@@ -46,7 +46,7 @@ public:
virtual void resetState()
{
;
- };
+ }
/*!
* Service method, can be used for state initializing.
*/