Fix inline editing of multiple tracks from the playlist. Fixes issue #869

This commit is contained in:
David Sansome 2010-11-28 14:47:35 +00:00
parent e3760a5bc5
commit 96a45bb0ca
2 changed files with 8 additions and 9 deletions

View File

@ -310,8 +310,6 @@ void Playlist::SongSaveComplete() {
ModelFutureWatcher<void>* watcher = new ModelFutureWatcher<void>(index, this);
watcher->setFuture(future);
connect(watcher, SIGNAL(finished()), SLOT(ItemReloadComplete()));
emit EditingFinished(index);
}
}
@ -321,6 +319,7 @@ void Playlist::ItemReloadComplete() {
const QPersistentModelIndex& index = watcher->index();
if (index.isValid()) {
emit dataChanged(index, index);
emit EditingFinished(index);
}
}

View File

@ -1029,10 +1029,10 @@ void MainWindow::InsertRadioItems(const PlaylistItemList& items) {
}
void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex& index) {
playlist_menu_index_ = index;
QModelIndex source_index = playlists_->current()->proxy()->mapToSource(index);
playlist_menu_index_ = source_index;
// Is this song currently playing?
if (playlists_->current()->current_index() == source_index.row() && player_->GetState() == Engine::Playing) {
playlist_play_pause_->setText(tr("Pause"));
@ -1141,8 +1141,7 @@ void MainWindow::PlaylistPlay() {
}
void MainWindow::PlaylistStopAfter() {
playlists_->current()->StopAfter(
playlists_->current()->proxy()->mapToSource(playlist_menu_index_).row());
playlists_->current()->StopAfter(playlist_menu_index_.row());
}
void MainWindow::EditTracks() {
@ -1208,7 +1207,7 @@ void MainWindow::SongSaveComplete() {
ModelFutureWatcher<bool>* watcher = static_cast<ModelFutureWatcher<bool>*>(sender());
watcher->deleteLater();
if (watcher->index().isValid()) {
playlists_->current()->item_at(watcher->index().row())->Reload();
playlists_->current()->ReloadItems(QList<int>() << watcher->index().row());
}
}
@ -1216,7 +1215,8 @@ void MainWindow::SelectionSetValue() {
Playlist::Column column = (Playlist::Column)playlist_menu_index_.column();
QVariant column_value = playlists_->current()->data(playlist_menu_index_);
QModelIndexList indexes=ui_->playlist->view()->selectionModel()->selection().indexes();
QModelIndexList indexes =
ui_->playlist->view()->selectionModel()->selection().indexes();
foreach (const QModelIndex& index, indexes) {
if (index.column() != 0)
continue;
@ -1224,7 +1224,7 @@ void MainWindow::SelectionSetValue() {
int row = playlists_->current()->proxy()->mapToSource(index).row();
Song song = playlists_->current()->item_at(row)->Metadata();
if(Playlist::set_column_value(song, column, column_value)) {
if (Playlist::set_column_value(song, column, column_value)) {
QFuture<bool> future = song.BackgroundSave();
ModelFutureWatcher<bool>* watcher = new ModelFutureWatcher<bool>(index, this);
watcher->setFuture(future);