1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Skip to next track if we have a QNR and it emits a failed signal

This commit is contained in:
Leo Franchi 2011-11-02 22:48:23 -04:00
parent 124706afab
commit 9418fd0fb8
3 changed files with 16 additions and 0 deletions

View File

@ -424,6 +424,9 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
tLog() << "Starting new song:" << m_currentTrack->url();
emit loading( m_currentTrack );
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
connect( qnr_io, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( ioStreamError( QNetworkReply::NetworkError ) ) );
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
{
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
@ -573,6 +576,16 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
}
}
void
AudioEngine::ioStreamError( QNetworkReply::NetworkError error )
{
if ( error != QNetworkReply::NoError )
{
if ( canGoNext() )
loadNextTrack();
}
}
void
AudioEngine::playlistNextTrackReady()

View File

@ -21,6 +21,7 @@
#include <QObject>
#include <QTimer>
#include <QNetworkReply>
#include <phonon/MediaObject>
#include <phonon/AudioOutput>
@ -134,6 +135,7 @@ private slots:
void setCurrentTrack( const Tomahawk::result_ptr& result );
void ioStreamError( QNetworkReply::NetworkError );
private:
void setState( AudioState state );

View File

@ -371,6 +371,7 @@ RdioParser::pixmap() const
if ( !s_pixmap )
s_pixmap = new QPixmap( RESPATH "images/rdio.png" );
return *s_pixmap;
}