Update to reflect api changes and small patch for alternate audio
[groove] / splayer.cpp
index a59899d..f6352c8 100644 (file)
@@ -1,4 +1,4 @@
-#include "splayer.h"
+#include "mpgplayer.h"
 #include <QFile>
 sPlayer::sPlayer(QObject *parent) :
     QObject(parent)
@@ -13,6 +13,8 @@ sPlayer::sPlayer(QObject *parent) :
     internal = parent;
     //buffer->open(QIODevice::ReadWrite);
     connect(media,SIGNAL(finished()),this,SLOT(markComplete()));
+    media->setTickInterval(200);
+    connect(media,SIGNAL(tick(qint64)),this,SLOT(updatePlayPosition(qint64)));
 }
 void sPlayer::setPlaylist(playlist *playList)
 {
@@ -34,6 +36,11 @@ void sPlayer::markComplete()
     else
         pl->setCurrentPlaying(-1);
 }
+void sPlayer::updatePlayPosition(qint64 time)
+{
+    //qDebug() << time << ":" << media->totalTime();
+}
+
 void sPlayer::pause()
 {
     if(media->state() == Phonon::PausedState)
@@ -56,6 +63,19 @@ sPlayer::~sPlayer()
     //reply->~QIODevice();
     media->~MediaNode();
 }
+void sPlayer::back()
+{
+    media->stop();
+    if(pl->existAt(pl->currentplaying()-1))
+    {
+        pl->setCurrentPlaying(pl->currentplaying()-1);
+        if(pl->bReady(pl->currentplaying()))
+            this->start(pl->currentplaying());
+    }
+    else
+        pl->setCurrentPlaying(-1);
+}
+
 void sPlayer::abortDownload()
 {
     //pd->hide();