Playlist* PlaylistManager::AddPlaylist(int id, const QString& name, const QString& special_type, const QString& ui_path, bool favorite) { Playlist* ret = new Playlist(playlist_backend_, app_->task_manager(), library_backend_, id, special_type, favorite); ret->set_sequence(sequence_); ret->set_ui_path(ui_path); connect(ret, SIGNAL(CurrentSongChanged(Song)), SIGNAL(CurrentSongChanged(Song))); connect(ret, SIGNAL(PlaylistChanged()), SLOT(OneOfPlaylistsChanged())); connect(ret, SIGNAL(PlaylistChanged()), SLOT(UpdateSummaryText())); connect(ret, SIGNAL(EditingFinished(QModelIndex)), SIGNAL(EditingFinished(QModelIndex))); connect(ret, SIGNAL(Error(QString)), SIGNAL(Error(QString))); connect(ret, SIGNAL(PlayRequested(QModelIndex)), SIGNAL(PlayRequested(QModelIndex))); connect(playlist_container_->view(), SIGNAL(ColumnAlignmentChanged(ColumnAlignmentMap)), ret, SLOT(SetColumnAlignment(ColumnAlignmentMap))); playlists_[id] = Data(ret, name); emit PlaylistAdded(id, name, favorite); if (current_ == -1) { SetCurrentPlaylist(id); } if (active_ == -1) { SetActivePlaylist(id); } return ret; }
void PlaylistListContainer::PlaylistPathChanged(int id, const QString& new_path) { // Update the path in the database app_->playlist_backend()->SetPlaylistUiPath(id, new_path); Playlist* playlist = app_->playlist_manager()->playlist(id); // Check the playlist exists (if it's not opened it's not in the manager) if (playlist) { playlist->set_ui_path(new_path); } }