mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 03:27:40 +01:00
Fix GetPlaylist and update network remote
This commit is contained in:
parent
5e6821dead
commit
e9f14d9f8a
@ -133,8 +133,8 @@ void NetworkRemote::AcceptConnection() {
|
||||
outgoing_data_creator_.get(), SLOT(ActiveChanged(Playlist*)));
|
||||
connect(app_->playlist_manager(), SIGNAL(PlaylistChanged(Playlist*)),
|
||||
outgoing_data_creator_.get(), SLOT(PlaylistChanged(Playlist*)));
|
||||
connect(app_->playlist_manager(), SIGNAL(PlaylistAdded(int,QString)),
|
||||
outgoing_data_creator_.get(), SLOT(PlaylistAdded(int,QString)));
|
||||
connect(app_->playlist_manager(), SIGNAL(PlaylistAdded(int,QString,bool)),
|
||||
outgoing_data_creator_.get(), SLOT(PlaylistAdded(int,QString,bool)));
|
||||
connect(app_->playlist_manager(), SIGNAL(PlaylistRenamed(int,QString)),
|
||||
outgoing_data_creator_.get(), SLOT(PlaylistRenamed(int,QString)));
|
||||
connect(app_->playlist_manager(), SIGNAL(PlaylistClosed(int)),
|
||||
|
@ -166,7 +166,7 @@ void OutgoingDataCreator::ActiveChanged(Playlist* playlist) {
|
||||
SendDataToClients(&msg);
|
||||
}
|
||||
|
||||
void OutgoingDataCreator::PlaylistAdded(int id, const QString& name) {
|
||||
void OutgoingDataCreator::PlaylistAdded(int id, const QString& name, bool favorite) {
|
||||
SendAllActivePlaylists();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public slots:
|
||||
void SendPlaylistSongs(int id);
|
||||
void PlaylistChanged(Playlist*);
|
||||
void VolumeChanged(int volume);
|
||||
void PlaylistAdded(int id, const QString& name);
|
||||
void PlaylistAdded(int id, const QString& name, bool favorite);
|
||||
void PlaylistDeleted(int id);
|
||||
void PlaylistClosed(int id);
|
||||
void PlaylistRenamed(int id, const QString& new_name);
|
||||
|
@ -48,6 +48,10 @@ PlaylistBackend::PlaylistBackend(Application* app, QObject* parent)
|
||||
{
|
||||
}
|
||||
|
||||
PlaylistBackend::PlaylistList PlaylistBackend::GetAllPlaylists() {
|
||||
return GetPlaylists(GetPlaylists_All);
|
||||
}
|
||||
|
||||
PlaylistBackend::PlaylistList PlaylistBackend::GetAllOpenPlaylists() {
|
||||
return GetPlaylists(GetPlaylists_OpenInUi);
|
||||
}
|
||||
@ -62,16 +66,18 @@ PlaylistBackend::PlaylistList PlaylistBackend::GetPlaylists(GetPlaylistsFlags fl
|
||||
|
||||
PlaylistList ret;
|
||||
|
||||
QString condition;
|
||||
QStringList condition_list;
|
||||
if (flags & GetPlaylists_OpenInUi) {
|
||||
condition += "WHERE ui_order != -1";
|
||||
}
|
||||
if (flags == GetPlaylists_All) {
|
||||
condition += " AND ";
|
||||
condition_list << "ui_order != -1";
|
||||
}
|
||||
if (flags & GetPlaylists_Favorite) {
|
||||
condition += "WHERE is_favorite != 0";
|
||||
condition_list << "is_favorite != 0";
|
||||
}
|
||||
QString condition;
|
||||
if (!condition_list.isEmpty()) {
|
||||
condition = " WHERE " + condition_list.join(" OR ");
|
||||
}
|
||||
|
||||
|
||||
QSqlQuery q("SELECT ROWID, name, last_played, dynamic_playlist_type,"
|
||||
" dynamic_playlist_data, dynamic_playlist_backend,"
|
||||
|
@ -61,6 +61,7 @@ class PlaylistBackend : public QObject {
|
||||
|
||||
static const int kSongTableJoins;
|
||||
|
||||
PlaylistList GetAllPlaylists();
|
||||
PlaylistList GetAllOpenPlaylists();
|
||||
PlaylistList GetAllFavoritePlaylists();
|
||||
PlaylistBackend::Playlist GetPlaylist(int id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user