Commit 10b41d66 authored by Kevin Whitaker's avatar Kevin Whitaker

Hook up notify slots for some elements of mpris.

parent 32af19f9
......@@ -28,6 +28,7 @@ MiniMediaPlayer::MiniMediaPlayer(QObject *parent) : QObject(parent)
connect(m_player,SIGNAL(stateChanged(QMediaPlayer::State)),this,SLOT(mediaStateChanged(QMediaPlayer::State)));
connect(m_player,SIGNAL(durationChanged(qint64)),this,SLOT(durationChanged(qint64)));
connect(m_player,SIGNAL(positionChanged(qint64)),this,SLOT(positionChanged(qint64)));
connect(m_player,&QMediaPlayer::volumeChanged,this,&MiniMediaPlayer::mediaVolumeChanged);
}
......
......@@ -56,6 +56,7 @@ signals:
void playlistChanged(QStringList trackTitles);
void trackDurationChanged(qint64 length);
void trackPositionChanged(qint64 position);
void mediaVolumeChanged(int volume);
private slots:
void mediaStatusChanged(QMediaPlayer::MediaStatus status);
......
......@@ -56,6 +56,28 @@ QStringList MPRISInterface::SupportedUriSchemes()
MPRISPlayerInterface::MPRISPlayerInterface(MiniMediaPlayer *player,QObject* parent) : QDBusAbstractAdaptor(parent),player(player)
{
//Connected Changed values from media player.
}
void MPRISPlayerInterface::mediaPositionChanged(qint64 position)
{
emit positionChanged(Position());
}
void MPRISPlayerInterface::mediaStateChanged(QMediaPlayer::State state)
{
emit playbackStatusChanged(PlaybackStatus());
}
void MPRISPlayerInterface::mediaVolumeChanged(int volume)
{
emit volumeChanged(Volume());
}
void MPRISPlayerInterface::mediaPlaylistChanged(QStringList playlist)
{
emit metadataChanged(Metadata());
}
bool MPRISPlayerInterface::CanControl()
......
......@@ -54,11 +54,11 @@ class MPRISPlayerInterface : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface","org.mpris.MediaPlayer2.Player")
Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus)
Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus NOTIFY playbackStatusChanged)
Q_PROPERTY(double Rate READ Rate WRITE setRate)
Q_PROPERTY(QMap<QString,QDBusVariant>Metadata READ Metadata)
Q_PROPERTY(double Volume READ Volume WRITE setVolume)
Q_PROPERTY(qlonglong Position READ Position)
Q_PROPERTY(QMap<QString,QDBusVariant>Metadata READ Metadata NOTIFY metadataChanged)
Q_PROPERTY(double Volume READ Volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(qlonglong Position READ Position NOTIFY positionChanged)
Q_PROPERTY(double MinimumRate READ MinimumRate)
Q_PROPERTY(double MaximumRate READ MaximumRate)
Q_PROPERTY(bool CanGoNext READ CanGoNext)
......@@ -95,7 +95,16 @@ public slots:
Q_NOREPLY void SetPosition(QDBusObjectPath trackId,qlonglong position) {};
Q_NOREPLY void OpenUri(QString uri);
signals:
void Seeked(qlonglong position);
void Seeked(qlonglong position); //Not used
void playbackStatusChanged(QString status);
void metadataChanged(QMap<QString,QDBusVariant> metadata);
void volumeChanged(double volume);
void positionChanged(qlonglong position);
private slots:
void mediaStateChanged(QMediaPlayer::State state);
void mediaPositionChanged(qint64 position);
void mediaVolumeChanged(int volume);
void mediaPlaylistChanged(QStringList playlist);
private:
MiniMediaPlayer *player;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment