mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Add the Seeked signal in MPRIS.
This commit is contained in:
@@ -245,6 +245,7 @@ AudioEngine::seek( qint64 ms )
|
|||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << ms;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << ms;
|
||||||
m_mediaObject->seek( ms );
|
m_mediaObject->seek( ms );
|
||||||
|
emit seeked( ms );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,6 +109,8 @@ signals:
|
|||||||
void paused();
|
void paused();
|
||||||
void resumed();
|
void resumed();
|
||||||
|
|
||||||
|
void seeked( qint64 ms );
|
||||||
|
|
||||||
void stateChanged( AudioState newState, AudioState oldState );
|
void stateChanged( AudioState newState, AudioState oldState );
|
||||||
void volumeChanged( int volume /* in percent */ );
|
void volumeChanged( int volume /* in percent */ );
|
||||||
|
|
||||||
|
@@ -44,16 +44,20 @@ MprisPlugin::MprisPlugin()
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
// init
|
||||||
m_playbackStatus = "Stopped";
|
m_playbackStatus = "Stopped";
|
||||||
|
|
||||||
|
// Types of pushInfo we care about
|
||||||
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
|
m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;
|
||||||
|
|
||||||
|
// DBus connection
|
||||||
new MprisPluginRootAdaptor( this );
|
new MprisPluginRootAdaptor( this );
|
||||||
new MprisPluginPlayerAdaptor( this );
|
new MprisPluginPlayerAdaptor( this );
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||||
dbus.registerObject("/org/mpris/MediaPlayer2", this);
|
dbus.registerObject("/org/mpris/MediaPlayer2", this);
|
||||||
dbus.registerService("org.mpris.MediaPlayer2.tomahawk");
|
dbus.registerService("org.mpris.MediaPlayer2.tomahawk");
|
||||||
|
|
||||||
|
// Listen to volume changes
|
||||||
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ),
|
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ),
|
||||||
SLOT( onVolumeChanged( 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
|
void
|
||||||
MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
MprisPlugin::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
|
||||||
{
|
{
|
||||||
|
@@ -149,6 +149,7 @@ private slots:
|
|||||||
void onVolumeChanged( int volume );
|
void onVolumeChanged( int volume );
|
||||||
void onPlaylistChanged( Tomahawk::PlaylistInterface* playlist);
|
void onPlaylistChanged( Tomahawk::PlaylistInterface* playlist);
|
||||||
void onTrackCountChanged( unsigned int tracks );
|
void onTrackCountChanged( unsigned int tracks );
|
||||||
|
void onSeeked( qint64 ms );
|
||||||
|
|
||||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
void infoSystemFinished( QString target );
|
void infoSystemFinished( QString target );
|
||||||
|
Reference in New Issue
Block a user