mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-31 06:02:27 +02:00
Cleanup
This commit is contained in:
parent
f3ba4beffc
commit
3b0292d9d9
@ -135,7 +135,7 @@ AudioEngine::pause()
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::stop( bool sendNotification )
|
||||
AudioEngine::stop()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
@ -147,20 +147,19 @@ AudioEngine::stop( bool sendNotification )
|
||||
setCurrentTrack( Tomahawk::result_ptr() );
|
||||
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;
|
||||
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
|
||||
|
||||
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::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 );
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
AudioEngine::onTrackAboutToFinish()
|
||||
{
|
||||
@ -381,16 +391,9 @@ AudioEngine::loadNextTrack()
|
||||
loadTrack( result );
|
||||
else
|
||||
{
|
||||
stop( false );
|
||||
if ( m_playlist && m_playlist->retryMode() == Tomahawk::PlaylistInterface::Retry )
|
||||
{
|
||||
m_waitingOnNewTrack = true;
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
|
||||
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 ) );
|
||||
}
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,14 +411,10 @@ AudioEngine::playItem( Tomahawk::PlaylistInterface* playlist, const Tomahawk::re
|
||||
|
||||
if ( !result.isNull() )
|
||||
loadTrack( result );
|
||||
else if ( m_playlist->retryMode() == PlaylistInterface::Retry )
|
||||
else if ( m_playlist && m_playlist->retryMode() == PlaylistInterface::Retry )
|
||||
{
|
||||
m_waitingOnNewTrack = true;
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
|
||||
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 ) );
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,12 +60,12 @@ public:
|
||||
Tomahawk::PlaylistInterface* playlist() const { return m_playlist; }
|
||||
|
||||
Tomahawk::result_ptr currentTrack() const { return m_currentTrack; }
|
||||
|
||||
|
||||
public slots:
|
||||
void playPause();
|
||||
void play();
|
||||
void pause();
|
||||
void stop( bool sendNotification = true );
|
||||
void stop();
|
||||
|
||||
void previous();
|
||||
void next();
|
||||
@ -117,6 +117,7 @@ private slots:
|
||||
private:
|
||||
bool isHttpResult( const QString& ) const;
|
||||
bool isLocalResult( const QString& ) const;
|
||||
void sendWaitingNotification() const;
|
||||
|
||||
bool m_isPlayingHttp;
|
||||
QSharedPointer<QIODevice> m_input;
|
||||
|
Loading…
x
Reference in New Issue
Block a user