Merge pull request #4305 from TheUbuntuGuy/master

Fix stop after track.  Fixes #3572
This commit is contained in:
David Sansome 2014-04-26 13:10:23 +10:00
commit 231443f6d1
3 changed files with 9 additions and 13 deletions

View File

@ -190,15 +190,15 @@ void Player::NextItem(Engine::TrackChangeFlags change) {
bool Player::HandleStopAfter() {
if (app_->playlist_manager()->active()->stop_after_current()) {
app_->playlist_manager()->active()->StopAfter(-1);
// Find what the next track would've been, and mark that one as current
// so it plays next time the user presses Play.
const int next_row = app_->playlist_manager()->active()->next_row();
if (next_row != -1) {
app_->playlist_manager()->active()->set_current_row(next_row);
app_->playlist_manager()->active()->set_current_row(next_row, true);
}
app_->playlist_manager()->active()->StopAfter(-1);
Stop();
return true;
}

View File

@ -189,7 +189,6 @@ bool Playlist::column_is_editable(Playlist::Column column) {
bool Playlist::set_column_value(Song& song, Playlist::Column column,
const QVariant& value) {
if (!song.IsEditable()) return false;
switch (column) {
@ -546,9 +545,6 @@ int Playlist::PreviousVirtualIndex(int i, bool ignore_repeat_track) const {
}
int Playlist::next_row(bool ignore_repeat_track) const {
// Did we want to stop after this track?
if (stop_after_.isValid() && current_row() == stop_after_.row()) return -1;
// Any queued items take priority
if (!queue_->is_empty()) {
return queue_->PeekNext();
@ -611,7 +607,7 @@ int Playlist::dynamic_history_length() const {
: 0;
}
void Playlist::set_current_row(int i) {
void Playlist::set_current_row(int i, bool is_stopping) {
QModelIndex old_current_item_index = current_item_index_;
ClearStreamMetadata();
@ -630,7 +626,7 @@ void Playlist::set_current_row(int i) {
old_current_item_index.row(), ColumnCount - 1));
}
if (current_item_index_.isValid()) {
if (current_item_index_.isValid() && !is_stopping) {
InformOfCurrentSongChange();
}

View File

@ -290,7 +290,7 @@ class Playlist : public QAbstractListModel {
const QModelIndex& parent = QModelIndex());
public slots:
void set_current_row(int index);
void set_current_row(int index, bool is_stopping = false);
void Paused();
void Playing();
void Stopped();