1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-14 01:54:07 +02:00

Add resumed, stopped, paused info.

This commit is contained in:
Alejandro Wainzinger
2011-05-07 13:26:21 -07:00
parent 8cc0277cca
commit f4b4a021ee
3 changed files with 29 additions and 6 deletions

View File

@@ -91,6 +91,13 @@ AudioEngine::play()
{
m_mediaObject->play();
emit resumed();
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
trackInfo["title"] = m_currentTrack->track();
trackInfo["artist"] = m_currentTrack->artist()->name();
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowResumed,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo ) );
}
else
loadNextTrack();
@@ -104,6 +111,8 @@ AudioEngine::pause()
m_mediaObject->pause();
emit paused();
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowPaused, QVariant() );
}
@@ -117,6 +126,8 @@ AudioEngine::stop()
setCurrentTrack( Tomahawk::result_ptr() );
emit stopped();
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant() );
}

View File

@@ -42,7 +42,7 @@ AdiumPlugin::AdiumPlugin()
: InfoPlugin()
{
qDebug() << Q_FUNC_INFO;
m_supportedPushTypes << InfoNowPlaying;
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
}
AdiumPlugin::~AdiumPlugin()
@@ -68,15 +68,24 @@ void
AdiumPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input )
{
qDebug() << Q_FUNC_INFO;
switch ( type )
{
case InfoNowPlaying:
audioStarted( input );
break;
audioStarted( input );
break;
case InfoNowPaused:
audioPaused();
break;
case InfoNowResumed:
audioResumed( input );
break;
case InfoNowStopped:
audioStopped();
break;
default:
return;
return;
}
}

View File

@@ -95,8 +95,11 @@ enum InfoType { // as items are saved in cache, mark them here to not change the
InfoSubmitScrobble = 47,
InfoNowPlaying = 48,
InfoNowPaused = 49,
InfoNowResumed = 50,
InfoNowStopped = 51,
InfoNoInfo = 49
InfoNoInfo = 52
};
typedef QMap< InfoType, QVariant > InfoMap;