1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

Add the Seeked signal in MPRIS.

This commit is contained in:
Alejandro Wainzinger 2011-08-17 03:17:31 -07:00
parent 6b1d919518
commit 1d222064fb
4 changed files with 20 additions and 0 deletions

View File

@ -245,6 +245,7 @@ AudioEngine::seek( qint64 ms )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << ms;
m_mediaObject->seek( ms );
emit seeked( ms );
}
}

View File

@ -109,6 +109,8 @@ signals:
void paused();
void resumed();
void seeked( qint64 ms );
void stateChanged( AudioState newState, AudioState oldState );
void volumeChanged( int volume /* in percent */ );

View File

@ -44,16 +44,20 @@ MprisPlugin::MprisPlugin()
{
qDebug() << Q_FUNC_INFO;
// init
m_playbackStatus = "Stopped";
// Types of pushInfo we care about
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
// DBus connection
new MprisPluginRootAdaptor( this );
new MprisPluginPlayerAdaptor( this );
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/org/mpris/MediaPlayer2", this);
dbus.registerService("org.mpris.MediaPlayer2.tomahawk");
// Listen to volume changes
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ),
SLOT( onVolumeChanged( int ) ) );
@ -548,6 +552,18 @@ MprisPlugin::onTrackCountChanged( unsigned int tracks )
}
void
MprisPlugin::onSeeked( qint64 ms )
{
QDBusMessage signal = QDBusMessage::createSignal(
"/org/mpris/MediaPlayer2",
"org.mpris.MediaPlayer2.Player",
"Seeked");
qlonglong us = ms*1000;
signal << us;
QDBusConnection::sessionBus().send(signal);
}
void
MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{

View File

@ -149,6 +149,7 @@ private slots:
void onVolumeChanged( int volume );
void onPlaylistChanged( Tomahawk::PlaylistInterface* playlist);
void onTrackCountChanged( unsigned int tracks );
void onSeeked( qint64 ms );
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( QString target );