The insert and remove signal for a playlist was not correct.
This commit is contained in:
parent
e8f9d856b6
commit
4fe293b6d0
@ -66,12 +66,12 @@ IncomingDataParser::IncomingDataParser(Application* app)
|
|||||||
connect(this, SIGNAL(SetShuffleMode(PlaylistSequence::ShuffleMode)),
|
connect(this, SIGNAL(SetShuffleMode(PlaylistSequence::ShuffleMode)),
|
||||||
app_->playlist_manager()->sequence(),
|
app_->playlist_manager()->sequence(),
|
||||||
SLOT(SetShuffleMode(PlaylistSequence::ShuffleMode)));
|
SLOT(SetShuffleMode(PlaylistSequence::ShuffleMode)));
|
||||||
connect(this, SIGNAL(InsertUrls(const QList<QUrl>&, int, bool, bool)),
|
connect(this, SIGNAL(InsertUrls(int, const QList<QUrl>&, int, bool, bool)),
|
||||||
app_->playlist_manager()->active(),
|
app_->playlist_manager(),
|
||||||
SLOT(InsertUrls(const QList<QUrl>&, int, bool, bool)));
|
SLOT(InsertUrls(int, const QList<QUrl>&, int, bool, bool)));
|
||||||
connect(this, SIGNAL(RemoveSongs(const QList<int>&)),
|
connect(this, SIGNAL(RemoveSongs(int, const QList<int>&)),
|
||||||
app_->playlist_manager()->active(),
|
app_->playlist_manager(),
|
||||||
SLOT(RemoveItemsWithoutUndo(const QList<int>&)));
|
SLOT(RemoveItemsWithoutUndo(int, const QList<int>&)));
|
||||||
connect(this, SIGNAL(Open(int)),
|
connect(this, SIGNAL(Open(int)),
|
||||||
app_->playlist_manager(), SLOT(Open(int)));
|
app_->playlist_manager(), SLOT(Open(int)));
|
||||||
connect(this, SIGNAL(Close(int)),
|
connect(this, SIGNAL(Close(int)),
|
||||||
@ -217,11 +217,6 @@ void IncomingDataParser::SetShuffleMode(const pb::remote::Shuffle& shuffle) {
|
|||||||
void IncomingDataParser::InsertUrls(const pb::remote::Message& msg) {
|
void IncomingDataParser::InsertUrls(const pb::remote::Message& msg) {
|
||||||
const pb::remote::RequestInsertUrls& request = msg.request_insert_urls();
|
const pb::remote::RequestInsertUrls& request = msg.request_insert_urls();
|
||||||
|
|
||||||
// Check if we need to change the playlist
|
|
||||||
if (request.playlist_id() != app_->playlist_manager()->active_id()) {
|
|
||||||
emit SetActivePlaylist(request.playlist_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract urls
|
// Extract urls
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
for (auto it = request.urls().begin(); it != request.urls().end(); ++it) {
|
for (auto it = request.urls().begin(); it != request.urls().end(); ++it) {
|
||||||
@ -229,23 +224,19 @@ void IncomingDataParser::InsertUrls(const pb::remote::Message& msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert the urls
|
// Insert the urls
|
||||||
emit InsertUrls(urls, request.position(), request.play_now(), request.enqueue());
|
emit InsertUrls(request.playlist_id(), urls, request.position(),
|
||||||
|
request.play_now(), request.enqueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncomingDataParser::RemoveSongs(const pb::remote::Message& msg) {
|
void IncomingDataParser::RemoveSongs(const pb::remote::Message& msg) {
|
||||||
const pb::remote::RequestRemoveSongs& request = msg.request_remove_songs();
|
const pb::remote::RequestRemoveSongs& request = msg.request_remove_songs();
|
||||||
|
|
||||||
// Check if we need to change the playlist
|
|
||||||
if (request.playlist_id() != app_->playlist_manager()->active_id()) {
|
|
||||||
emit SetActivePlaylist(request.playlist_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract urls
|
// Extract urls
|
||||||
QList<int> songs;
|
QList<int> songs;
|
||||||
std::copy(request.songs().begin(), request.songs().end(), songs.begin());
|
std::copy(request.songs().begin(), request.songs().end(), songs.begin());
|
||||||
|
|
||||||
// Insert the urls
|
// Insert the urls
|
||||||
emit RemoveSongs(songs);
|
emit RemoveSongs(request.playlist_id(), songs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncomingDataParser::ClientConnect(const pb::remote::Message& msg) {
|
void IncomingDataParser::ClientConnect(const pb::remote::Message& msg) {
|
||||||
|
@ -42,8 +42,8 @@ signals:
|
|||||||
void ShuffleCurrent();
|
void ShuffleCurrent();
|
||||||
void SetRepeatMode(PlaylistSequence::RepeatMode mode);
|
void SetRepeatMode(PlaylistSequence::RepeatMode mode);
|
||||||
void SetShuffleMode(PlaylistSequence::ShuffleMode mode);
|
void SetShuffleMode(PlaylistSequence::ShuffleMode mode);
|
||||||
void InsertUrls(const QList<QUrl>& urls, int pos, bool play_now, bool enqueue);
|
void InsertUrls(int id, const QList<QUrl>& urls, int pos, bool play_now, bool enqueue);
|
||||||
void RemoveSongs(const QList<int>& indices);
|
void RemoveSongs(int id, const QList<int>& indices);
|
||||||
void SeekTo(int seconds);
|
void SeekTo(int seconds);
|
||||||
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
||||||
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
||||||
|
@ -462,6 +462,19 @@ void PlaylistManager::SongChangeRequestProcessed(const QUrl& url, bool valid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlaylistManager::InsertUrls(int id, const QList<QUrl> &urls, int pos,
|
||||||
|
bool play_now, bool enqueue) {
|
||||||
|
Q_ASSERT(playlists_.contains(id));
|
||||||
|
|
||||||
|
playlists_[id].p->InsertUrls(urls, pos, play_now, enqueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlaylistManager::RemoveItemsWithoutUndo(int id, const QList<int> &indices) {
|
||||||
|
Q_ASSERT(playlists_.contains(id));
|
||||||
|
|
||||||
|
playlists_[id].p->RemoveItemsWithoutUndo(indices);
|
||||||
|
}
|
||||||
|
|
||||||
void PlaylistManager::InvalidateDeletedSongs() {
|
void PlaylistManager::InvalidateDeletedSongs() {
|
||||||
foreach(Playlist* playlist, GetAllPlaylists()) {
|
foreach(Playlist* playlist, GetAllPlaylists()) {
|
||||||
playlist->InvalidateDeletedSongs();
|
playlist->InvalidateDeletedSongs();
|
||||||
|
@ -211,6 +211,10 @@ public slots:
|
|||||||
|
|
||||||
void SongChangeRequestProcessed(const QUrl& url, bool valid);
|
void SongChangeRequestProcessed(const QUrl& url, bool valid);
|
||||||
|
|
||||||
|
void InsertUrls(int id, const QList<QUrl>& urls, int pos = -1, bool play_now = false, bool enqueue = false);
|
||||||
|
// Removes items with given indices from the playlist. This operation is not undoable.
|
||||||
|
void RemoveItemsWithoutUndo(int id, const QList<int>& indices);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetActivePlaying();
|
void SetActivePlaying();
|
||||||
void SetActivePaused();
|
void SetActivePaused();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user