mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Fix notification logic and possible crash
This commit is contained in:
@@ -139,7 +139,7 @@ AudioEngine::pause()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::stop()
|
AudioEngine::stop( bool sendNotification )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
@@ -151,6 +151,8 @@ AudioEngine::stop()
|
|||||||
|
|
||||||
setCurrentTrack( Tomahawk::result_ptr() );
|
setCurrentTrack( Tomahawk::result_ptr() );
|
||||||
emit stopped();
|
emit stopped();
|
||||||
|
|
||||||
|
if ( sendNotification )
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||||
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant() );
|
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant() );
|
||||||
}
|
}
|
||||||
@@ -369,7 +371,7 @@ AudioEngine::loadNextTrack()
|
|||||||
loadTrack( result );
|
loadTrack( result );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stop();
|
stop( false );
|
||||||
if ( m_playlist && m_playlist->retryMode() == Tomahawk::PlaylistInterface::Retry )
|
if ( m_playlist && m_playlist->retryMode() == Tomahawk::PlaylistInterface::Retry )
|
||||||
{
|
{
|
||||||
if ( !wasRetrying )
|
if ( !wasRetrying )
|
||||||
@@ -398,7 +400,9 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
|||||||
setPlaylist( playlist );
|
setPlaylist( playlist );
|
||||||
m_currentTrackPlaylist = playlist;
|
m_currentTrackPlaylist = playlist;
|
||||||
|
|
||||||
if ( result.isNull() && m_playlist->retryMode() == PlaylistInterface::Retry )
|
if ( !result.isNull() )
|
||||||
|
loadTrack( result );
|
||||||
|
else if ( m_playlist->retryMode() == PlaylistInterface::Retry )
|
||||||
{
|
{
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
|
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
|
||||||
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will keep trying..." );
|
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will keep trying..." );
|
||||||
@@ -408,8 +412,6 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
|||||||
m_retryTimer.setInterval( playlist->retryInterval() );
|
m_retryTimer.setInterval( playlist->retryInterval() );
|
||||||
m_retryTimer.start();
|
m_retryTimer.start();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
loadTrack( result );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ public slots:
|
|||||||
void playPause();
|
void playPause();
|
||||||
void play();
|
void play();
|
||||||
void pause();
|
void pause();
|
||||||
void stop();
|
void stop( bool sendNotification = true );
|
||||||
|
|
||||||
void previous();
|
void previous();
|
||||||
void next();
|
void next();
|
||||||
|
Reference in New Issue
Block a user