Commit f958718d authored by Matthias Kretz's avatar Matthias Kretz

handle ErrorState

svn path=/trunk/KDE/kdemultimedia/juk/; revision=682135
parent e95a0ee7
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <config.h> #include <config.h>
#include <kdebug.h> #include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h> #include <klocale.h>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kselectaction.h> #include <kselectaction.h>
...@@ -261,6 +262,7 @@ void PlayerManager::play(const FileHandle &file) ...@@ -261,6 +262,7 @@ void PlayerManager::play(const FileHandle &file)
m_audioPath->insertEffect(fader2); m_audioPath->insertEffect(fader2);
m_media = new Phonon::MediaObject(this); m_media = new Phonon::MediaObject(this);
connect(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(slotStateChanged(Phonon::State)));
connect(m_media, SIGNAL(aboutToFinsh()), SLOT(slotNeedNextUrl())); connect(m_media, SIGNAL(aboutToFinsh()), SLOT(slotNeedNextUrl()));
m_media->addAudioPath(m_audioPath); m_media->addAudioPath(m_audioPath);
m_media->setTickInterval(200); m_media->setTickInterval(200);
...@@ -510,6 +512,25 @@ void PlayerManager::slotTick(qint64 msec) ...@@ -510,6 +512,25 @@ void PlayerManager::slotTick(qint64 msec)
m_noSeek = false; m_noSeek = false;
} }
void PlayerManager::slotStateChanged(Phonon::State newstate)
{
if(newstate == Phonon::ErrorState)
{
switch(m_media->errorType())
{
case Phonon::NormalError:
forward();
KMessageBox::information(0, m_media->errorString());
break;
case Phonon::FatalError:
// stop playback
stop();
KMessageBox::sorry(0, m_media->errorString());
break;
}
}
}
/* /*
void PlayerManager::slotUpdateTime(int position) void PlayerManager::slotUpdateTime(int position)
{ {
...@@ -552,6 +573,7 @@ void PlayerManager::setup() ...@@ -552,6 +573,7 @@ void PlayerManager::setup()
m_audioPath->addOutput(m_output); m_audioPath->addOutput(m_output);
m_media = new Phonon::MediaObject(this); m_media = new Phonon::MediaObject(this);
connect(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(slotStateChanged(Phonon::State)));
connect(m_media, SIGNAL(aboutToFinish()), SLOT(slotNeedNextUrl())); connect(m_media, SIGNAL(aboutToFinish()), SLOT(slotNeedNextUrl()));
m_media->addAudioPath(m_audioPath); m_media->addAudioPath(m_audioPath);
m_media->setTickInterval(200); m_media->setTickInterval(200);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <QPixmap> #include <QPixmap>
#include <QObject> #include <QObject>
#include "filehandle.h" #include "filehandle.h"
#include <Phonon/Global>
class KSelectAction; class KSelectAction;
class SliderAction; class SliderAction;
...@@ -105,6 +106,7 @@ private slots: ...@@ -105,6 +106,7 @@ private slots:
void slotFinished(); void slotFinished();
void slotLength(qint64); void slotLength(qint64);
void slotTick(qint64); void slotTick(qint64);
void slotStateChanged(Phonon::State);
//void slotUpdateTime(int position); //void slotUpdateTime(int position);
private: private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment