1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Moved playback error-retry handling into AudioEngine itself.

This commit is contained in:
Christian Muehlhaeuser
2015-04-18 08:43:30 +02:00
parent 8c7036b0da
commit de8dcce45e
2 changed files with 4 additions and 11 deletions

View File

@@ -118,7 +118,6 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
, ui( new Ui::TomahawkWindow ) , ui( new Ui::TomahawkWindow )
, m_searchWidget( 0 ) , m_searchWidget( 0 )
, m_trayIcon( 0 ) , m_trayIcon( 0 )
, m_audioRetryCounter( 0 )
{ {
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
@@ -1257,23 +1256,20 @@ TomahawkWindow::onXSPFError( XSPFLoader::XSPFErrorCode error )
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) );
} }
void void
TomahawkWindow::onJSPFError() { TomahawkWindow::onJSPFError()
{
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Failed to load JSPF playlist"), 15 ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Failed to load JSPF playlist"), 15 ) );
} }
void void
TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ ) TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
{ {
QString msg = tr( "Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped." ); QString msg = tr( "Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped." );
tLog() << msg; tLog() << msg;
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) );
if ( m_audioRetryCounter < 3 )
AudioEngine::instance()->play();
m_audioRetryCounter++;
} }
@@ -1347,8 +1343,6 @@ TomahawkWindow::createPlaylist()
void void
TomahawkWindow::audioStarted() TomahawkWindow::audioStarted()
{ {
m_audioRetryCounter = 0;
ActionCollection::instance()->getAction( "playPause" )->setIcon( ImageRegistry::instance()->icon( RESPATH "images/pause.svg" ) ); ActionCollection::instance()->getAction( "playPause" )->setIcon( ImageRegistry::instance()->icon( RESPATH "images/pause.svg" ) );
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Pause" ) ); ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Pause" ) );
ActionCollection::instance()->getAction( "stop" )->setEnabled( true ); ActionCollection::instance()->getAction( "stop" )->setEnabled( true );

View File

@@ -209,7 +209,6 @@ private:
Tomahawk::result_ptr m_currentTrack; Tomahawk::result_ptr m_currentTrack;
QString m_windowTitle; QString m_windowTitle;
int m_audioRetryCounter;
}; };
#endif // TOMAHAWKWINDOW_H #endif // TOMAHAWKWINDOW_H