MPRIS' TracklistChanged event now contains the length of the playlist that has actually changed (Update issue #374)
the PlaylistChanged event now shows which playlist has changed
This commit is contained in:
parent
6bf3162449
commit
04bbf73cff
@ -74,11 +74,11 @@ Mpris1TrackList::Mpris1TrackList(Player* player, QObject* parent)
|
|||||||
new MprisTrackList(this);
|
new MprisTrackList(this);
|
||||||
QDBusConnection::sessionBus().registerObject("/TrackList", this);
|
QDBusConnection::sessionBus().registerObject("/TrackList", this);
|
||||||
|
|
||||||
connect(player->playlists(), SIGNAL(PlaylistChanged()), SLOT(PlaylistChanged()));
|
connect(player->playlists(), SIGNAL(PlaylistChanged(Playlist*)), SLOT(PlaylistChanged(Playlist*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris1TrackList::PlaylistChanged() {
|
void Mpris1TrackList::PlaylistChanged(Playlist* playlist) {
|
||||||
emit TrackListChange(GetLength());
|
emit TrackListChange(playlist->rowCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// we use the state from event and don't try to obtain it from Player
|
// we use the state from event and don't try to obtain it from Player
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
|
class Playlist;
|
||||||
|
|
||||||
struct DBusStatus { // From Amarok.
|
struct DBusStatus { // From Amarok.
|
||||||
int play; // Playing = 0, Paused = 1, Stopped = 2
|
int play; // Playing = 0, Paused = 1, Stopped = 2
|
||||||
@ -183,7 +184,7 @@ signals:
|
|||||||
void TrackListChange(int i);
|
void TrackListChange(int i);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void PlaylistChanged();
|
void PlaylistChanged(Playlist* playlist);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Player* player_;
|
Player* player_;
|
||||||
|
@ -74,7 +74,7 @@ Playlist* PlaylistManager::AddPlaylist(int id, const QString& name) {
|
|||||||
ret->set_sequence(sequence_);
|
ret->set_sequence(sequence_);
|
||||||
|
|
||||||
connect(ret, SIGNAL(CurrentSongChanged(Song)), SIGNAL(CurrentSongChanged(Song)));
|
connect(ret, SIGNAL(CurrentSongChanged(Song)), SIGNAL(CurrentSongChanged(Song)));
|
||||||
connect(ret, SIGNAL(PlaylistChanged()), SIGNAL(PlaylistChanged()));
|
connect(ret, SIGNAL(PlaylistChanged()), SLOT(OneOfPlaylistsChanged()));
|
||||||
connect(ret, SIGNAL(PlaylistChanged()), SLOT(UpdateSummaryText()));
|
connect(ret, SIGNAL(PlaylistChanged()), SLOT(UpdateSummaryText()));
|
||||||
connect(ret, SIGNAL(EditingFinished(QModelIndex)), SIGNAL(EditingFinished(QModelIndex)));
|
connect(ret, SIGNAL(EditingFinished(QModelIndex)), SIGNAL(EditingFinished(QModelIndex)));
|
||||||
connect(ret, SIGNAL(LoadTracksError(QString)), SIGNAL(Error(QString)));
|
connect(ret, SIGNAL(LoadTracksError(QString)), SIGNAL(Error(QString)));
|
||||||
@ -177,6 +177,10 @@ void PlaylistManager::Remove(int id) {
|
|||||||
emit PlaylistRemoved(id);
|
emit PlaylistRemoved(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlaylistManager::OneOfPlaylistsChanged() {
|
||||||
|
emit PlaylistChanged(qobject_cast<Playlist*>(sender()));
|
||||||
|
}
|
||||||
|
|
||||||
void PlaylistManager::SetCurrentPlaylist(int id) {
|
void PlaylistManager::SetCurrentPlaylist(int id) {
|
||||||
Q_ASSERT(playlists_.contains(id));
|
Q_ASSERT(playlists_.contains(id));
|
||||||
current_ = id;
|
current_ = id;
|
||||||
|
@ -102,11 +102,12 @@ signals:
|
|||||||
|
|
||||||
// Forwarded from individual playlists
|
// Forwarded from individual playlists
|
||||||
void CurrentSongChanged(const Song& song);
|
void CurrentSongChanged(const Song& song);
|
||||||
void PlaylistChanged();
|
void PlaylistChanged(Playlist* playlist);
|
||||||
void EditingFinished(const QModelIndex& index);
|
void EditingFinished(const QModelIndex& index);
|
||||||
void PlayRequested(const QModelIndex& index);
|
void PlayRequested(const QModelIndex& index);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void OneOfPlaylistsChanged();
|
||||||
void UpdateSummaryText();
|
void UpdateSummaryText();
|
||||||
void SongsDiscovered(const SongList& songs);
|
void SongsDiscovered(const SongList& songs);
|
||||||
void LoadFinished(bool success);
|
void LoadFinished(bool success);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user