1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00
This commit is contained in:
Jeff Mitchell
2011-06-24 12:57:42 -04:00
parent f3ba4beffc
commit 3b0292d9d9
2 changed files with 29 additions and 29 deletions

View File

@@ -135,7 +135,7 @@ AudioEngine::pause()
void void
AudioEngine::stop( bool sendNotification ) AudioEngine::stop()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@@ -147,20 +147,19 @@ AudioEngine::stop( bool sendNotification )
setCurrentTrack( Tomahawk::result_ptr() ); setCurrentTrack( Tomahawk::result_ptr() );
emit stopped(); emit stopped();
if ( sendNotification ) Tomahawk::InfoSystem::InfoMap map;
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
if ( m_waitingOnNewTrack )
sendWaitingNotification();
else if ( TomahawkSettings::instance()->verboseNotifications() )
{ {
Tomahawk::InfoSystem::InfoMap map; Tomahawk::InfoSystem::InfoCriteriaHash stopInfo;
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant(); stopInfo["message"] = QString( "Tomahawk is stopped." );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo );
if ( TomahawkSettings::instance()->verboseNotifications() )
{
Tomahawk::InfoSystem::InfoCriteriaHash stopInfo;
stopInfo["message"] = QString( "Tomahawk is stopped." );
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo );
}
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
} }
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
} }
@@ -238,6 +237,17 @@ AudioEngine::mute()
} }
void
AudioEngine::sendWaitingNotification() const
{
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( retryInfo ) );
}
void void
AudioEngine::onTrackAboutToFinish() AudioEngine::onTrackAboutToFinish()
{ {
@@ -381,16 +391,9 @@ AudioEngine::loadNextTrack()
loadTrack( result ); loadTrack( result );
else else
{ {
stop( false );
if ( m_playlist && m_playlist->retryMode() == Tomahawk::PlaylistInterface::Retry ) if ( m_playlist && m_playlist->retryMode() == Tomahawk::PlaylistInterface::Retry )
{
m_waitingOnNewTrack = true; m_waitingOnNewTrack = true;
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo; stop();
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track..." );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( retryInfo ) );
}
} }
} }
@@ -408,14 +411,10 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
if ( !result.isNull() ) if ( !result.isNull() )
loadTrack( result ); loadTrack( result );
else if ( m_playlist->retryMode() == PlaylistInterface::Retry ) else if ( m_playlist && m_playlist->retryMode() == PlaylistInterface::Retry )
{ {
m_waitingOnNewTrack = true; m_waitingOnNewTrack = true;
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo; stop();
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track..." );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( retryInfo ) );
} }
} }

View File

@@ -60,12 +60,12 @@ public:
Tomahawk::PlaylistInterface* playlist() const { return m_playlist; } Tomahawk::PlaylistInterface* playlist() const { return m_playlist; }
Tomahawk::result_ptr currentTrack() const { return m_currentTrack; } Tomahawk::result_ptr currentTrack() const { return m_currentTrack; }
public slots: public slots:
void playPause(); void playPause();
void play(); void play();
void pause(); void pause();
void stop( bool sendNotification = true ); void stop();
void previous(); void previous();
void next(); void next();
@@ -117,6 +117,7 @@ private slots:
private: private:
bool isHttpResult( const QString& ) const; bool isHttpResult( const QString& ) const;
bool isLocalResult( const QString& ) const; bool isLocalResult( const QString& ) const;
void sendWaitingNotification() const;
bool m_isPlayingHttp; bool m_isPlayingHttp;
QSharedPointer<QIODevice> m_input; QSharedPointer<QIODevice> m_input;