Renumber tracks correctly starting from the top one even when the user selects them "backwards" (starting from the bottom).

This commit is contained in:
David Sansome 2010-04-27 17:15:11 +00:00
parent 30daf4aca2
commit 3f360d254f
1 changed files with 3 additions and 0 deletions

View File

@ -800,6 +800,9 @@ void MainWindow::RenumberTracks() {
QModelIndexList indexes=ui_.playlist->selectionModel()->selection().indexes();
int track=1;
// Get the index list in order
qStableSort(indexes);
// if first selected song has a track number set, start from that offset
if (indexes.size()) {
Song first_song=playlist_->item_at(indexes[0].row())->Metadata();