diff --git a/src/libtomahawk/audio/audioengine.cpp b/src/libtomahawk/audio/audioengine.cpp index 5d4be8afc..f19f662f0 100644 --- a/src/libtomahawk/audio/audioengine.cpp +++ b/src/libtomahawk/audio/audioengine.cpp @@ -590,10 +590,10 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState ) if ( newState == Phonon::ErrorState ) { + stop(); + tLog() << "Phonon Error:" << m_mediaObject->errorString() << m_mediaObject->errorType(); emit error( UnknownError ); - - stop(); return; } if ( newState == Phonon::PlayingState ) diff --git a/src/tomahawkwindow.cpp b/src/tomahawkwindow.cpp index 0a2c262b7..8c6d0c9fe 100644 --- a/src/tomahawkwindow.cpp +++ b/src/tomahawkwindow.cpp @@ -1,7 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Christian Muehlhaeuser - * Copyright 2010-2011, Leo Franchi + * Copyright 2010-2012, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,6 +58,8 @@ #include "tomahawksettings.h" #include "sourcelist.h" #include "jobview/JobStatusView.h" +#include "jobview/JobStatusModel.h" +#include "jobview/ErrorStatusMessage.h" #include "tomahawktrayicon.h" #include "scanmanager.h" #include "tomahawkapp.h" @@ -80,6 +82,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent ) , m_searchWidget( 0 ) , m_audioControls( new AudioControls( this ) ) , m_trayIcon( new TomahawkTrayIcon( this ) ) + , m_audioRetryCounter( 0 ) { setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); @@ -568,11 +571,17 @@ TomahawkWindow::onXSPFError( XSPFLoader::XSPFErrorCode error ) void TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ ) { + QString msg; #ifdef Q_WS_X11 - QMessageBox::warning( this, tr( "Playback Error" ), tr( "Sorry, there is a problem accessing your audio device. Make sure you have a suitable Phonon backend and required plugins installed." ), QMessageBox::Ok ); + msg = tr( "Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped. Make sure you have a suitable Phonon backend and required plugins installed." ); #else - QMessageBox::warning( this, tr( "Playback Error" ), tr( "Sorry, there is a problem accessing your audio device." ), QMessageBox::Ok ); + msg = tr( "Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped." ); #endif + JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) ); + + if ( m_audioRetryCounter < 3 ) + AudioEngine::instance()->play(); + m_audioRetryCounter++; } @@ -652,6 +661,7 @@ TomahawkWindow::playlistCreateDialogFinished( int ret ) void TomahawkWindow::audioStarted() { + m_audioRetryCounter = 0; ui->actionPlay->setText( tr( "Pause" ) ); } diff --git a/src/tomahawkwindow.h b/src/tomahawkwindow.h index b1cc66646..cc261453c 100644 --- a/src/tomahawkwindow.h +++ b/src/tomahawkwindow.h @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2012, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -141,6 +142,7 @@ private: Tomahawk::result_ptr m_currentTrack; QString m_windowTitle; + int m_audioRetryCounter; }; #endif // TOMAHAWKWINDOW_H