1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 11:04:01 +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(); m_mediaObject->play();
emit resumed(); 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 else
loadNextTrack(); loadNextTrack();
@@ -104,6 +111,8 @@ AudioEngine::pause()
m_mediaObject->pause(); m_mediaObject->pause();
emit paused(); emit paused();
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowPaused, QVariant() );
} }
@@ -117,6 +126,8 @@ AudioEngine::stop()
setCurrentTrack( Tomahawk::result_ptr() ); setCurrentTrack( Tomahawk::result_ptr() );
emit stopped(); emit stopped();
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant() );
} }

View File

@@ -42,7 +42,7 @@ AdiumPlugin::AdiumPlugin()
: InfoPlugin() : InfoPlugin()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
m_supportedPushTypes << InfoNowPlaying; m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
} }
AdiumPlugin::~AdiumPlugin() AdiumPlugin::~AdiumPlugin()
@@ -74,6 +74,15 @@ AdiumPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoTyp
case InfoNowPlaying: case InfoNowPlaying:
audioStarted( input ); audioStarted( input );
break; break;
case InfoNowPaused:
audioPaused();
break;
case InfoNowResumed:
audioResumed( input );
break;
case InfoNowStopped:
audioStopped();
break;
default: 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, InfoSubmitScrobble = 47,
InfoNowPlaying = 48, InfoNowPlaying = 48,
InfoNowPaused = 49,
InfoNowResumed = 50,
InfoNowStopped = 51,
InfoNoInfo = 49 InfoNoInfo = 52
}; };
typedef QMap< InfoType, QVariant > InfoMap; typedef QMap< InfoType, QVariant > InfoMap;