mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 12:28:31 +01:00
Emit MPRIS notification when we add or remove a playlist.
Fixes issue 3962.
This commit is contained in:
parent
6e3a456046
commit
2647fe4bbc
@ -104,6 +104,7 @@ Mpris2::Mpris2(Application* app, Mpris1* mpris1, QObject* parent)
|
|||||||
connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()), SLOT(PlaylistManagerInitialized()));
|
connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()), SLOT(PlaylistManagerInitialized()));
|
||||||
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(CurrentSongChanged(Song)));
|
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(CurrentSongChanged(Song)));
|
||||||
connect(app_->playlist_manager(), SIGNAL(PlaylistChanged(Playlist*)), SLOT(PlaylistChanged(Playlist*)));
|
connect(app_->playlist_manager(), SIGNAL(PlaylistChanged(Playlist*)), SLOT(PlaylistChanged(Playlist*)));
|
||||||
|
connect(app_->playlist_manager(), SIGNAL(CurrentChanged(Playlist*)), SLOT(PlaylistCollectionChanged(Playlist*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// when PlaylistManager gets it ready, we connect PlaylistSequence with this
|
// when PlaylistManager gets it ready, we connect PlaylistSequence with this
|
||||||
@ -136,12 +137,16 @@ void Mpris2::RepeatModeChanged() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::EmitNotification(const QString& name, const QVariant& val) {
|
void Mpris2::EmitNotification(const QString& name, const QVariant& val) {
|
||||||
|
EmitNotification(name, val, "org.mpris.MediaPlayer2.Player");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mpris2::EmitNotification(const QString& name, const QVariant& val, const QString& mprisEntity) {
|
||||||
QDBusMessage msg = QDBusMessage::createSignal(
|
QDBusMessage msg = QDBusMessage::createSignal(
|
||||||
kMprisObjectPath, kFreedesktopPath, "PropertiesChanged");
|
kMprisObjectPath, kFreedesktopPath, "PropertiesChanged");
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(name, val);
|
map.insert(name, val);
|
||||||
QVariantList args = QVariantList()
|
QVariantList args = QVariantList()
|
||||||
<< "org.mpris.MediaPlayer2.Player"
|
<< mprisEntity
|
||||||
<< map
|
<< map
|
||||||
<< QStringList();
|
<< QStringList();
|
||||||
msg.setArguments(args);
|
msg.setArguments(args);
|
||||||
@ -576,4 +581,10 @@ void Mpris2::PlaylistChanged(Playlist* playlist) {
|
|||||||
emit PlaylistChanged(mpris_playlist);
|
emit PlaylistChanged(mpris_playlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mpris2::PlaylistCollectionChanged(Playlist* playlist){
|
||||||
|
|
||||||
|
qLog(Debug) << "Playlist collection changed (" << playlist->id() << ")";
|
||||||
|
EmitNotification("PlaylistCount", "", "org.mpris.MediaPlayer2.Playlists");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mpris
|
} // namespace mpris
|
||||||
|
@ -202,10 +202,12 @@ private slots:
|
|||||||
void ShuffleModeChanged();
|
void ShuffleModeChanged();
|
||||||
void RepeatModeChanged();
|
void RepeatModeChanged();
|
||||||
void PlaylistChanged(Playlist* playlist);
|
void PlaylistChanged(Playlist* playlist);
|
||||||
|
void PlaylistCollectionChanged(Playlist* playlist);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EmitNotification(const QString& name);
|
void EmitNotification(const QString& name);
|
||||||
void EmitNotification(const QString& name, const QVariant& val);
|
void EmitNotification(const QString& name, const QVariant& val);
|
||||||
|
void EmitNotification(const QString& name, const QVariant& val, const QString& mprisEntity);
|
||||||
|
|
||||||
QString PlaybackStatus(Engine::State state) const;
|
QString PlaybackStatus(Engine::State state) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user