mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Make sure the playlist gets reshuffled when the user manually changes track. Fixes issue #137
This commit is contained in:
parent
ef9780b44e
commit
c0da64c6a2
@ -365,7 +365,7 @@ void MainWindow::QueueFiles(const QList<QUrl>& urls) {
|
||||
QModelIndex playlist_index = playlist_->InsertPaths(urls);
|
||||
|
||||
if (playlist_index.isValid() && player_->GetState() != Engine::Playing)
|
||||
player_->PlayAt(playlist_index.row());
|
||||
player_->PlayAt(playlist_index.row(), true);
|
||||
}
|
||||
|
||||
void MainWindow::ReportError(const QString& message) {
|
||||
@ -442,7 +442,7 @@ void MainWindow::PlayIndex(const QModelIndex& index) {
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
player_->PlayAt(index.row());
|
||||
player_->PlayAt(index.row(), true);
|
||||
}
|
||||
|
||||
void MainWindow::LibraryDoubleClick(const QModelIndex& index) {
|
||||
@ -451,7 +451,7 @@ void MainWindow::LibraryDoubleClick(const QModelIndex& index) {
|
||||
library_sort_model_->mapToSource(index)));
|
||||
|
||||
if (first_song.isValid() && player_->GetState() != Engine::Playing)
|
||||
player_->PlayAt(first_song.row());
|
||||
player_->PlayAt(first_song.row(), true);
|
||||
}
|
||||
|
||||
void MainWindow::VolumeWheelEvent(int delta) {
|
||||
@ -563,7 +563,7 @@ void MainWindow::InsertRadioItem(RadioItem* item) {
|
||||
QList<RadioItem*>() << item);
|
||||
|
||||
if (first_song.isValid() && player_->GetState() != Engine::Playing)
|
||||
player_->PlayAt(first_song.row());
|
||||
player_->PlayAt(first_song.row(), true);
|
||||
}
|
||||
|
||||
void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex& index) {
|
||||
@ -632,7 +632,7 @@ void MainWindow::PlaylistPlay() {
|
||||
if (playlist_->current_index() == playlist_menu_index_.row()) {
|
||||
player_->PlayPause();
|
||||
} else {
|
||||
player_->PlayAt(playlist_menu_index_.row());
|
||||
player_->PlayAt(playlist_menu_index_.row(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ void Player::NextItem() {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayAt(i);
|
||||
PlayAt(i, false);
|
||||
}
|
||||
|
||||
void Player::TrackEnded() {
|
||||
@ -173,7 +173,7 @@ void Player::PlayPause() {
|
||||
break;
|
||||
i = 0;
|
||||
}
|
||||
PlayAt(i);
|
||||
PlayAt(i, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -196,7 +196,7 @@ void Player::Previous() {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayAt(i);
|
||||
PlayAt(i, false);
|
||||
}
|
||||
|
||||
void Player::EngineStateChanged(Engine::State state) {
|
||||
@ -225,10 +225,12 @@ Engine::State Player::GetState() const {
|
||||
return engine_->state();
|
||||
}
|
||||
|
||||
void Player::PlayAt(int index) {
|
||||
void Player::PlayAt(int index, bool manual_change) {
|
||||
if (!init_engine_.isFinished())
|
||||
return;
|
||||
|
||||
if (manual_change)
|
||||
playlist_->set_current_index(-1); // to reshuffle
|
||||
playlist_->set_current_index(index);
|
||||
|
||||
PlaylistItem* item = playlist_->item_at(index);
|
||||
@ -507,7 +509,7 @@ void Player::SetRandom(bool enable) {
|
||||
}
|
||||
|
||||
void Player::PlayTrack(int index) {
|
||||
PlayAt(index);
|
||||
PlayAt(index, true);
|
||||
}
|
||||
|
||||
void Player::PlaylistChanged() {
|
||||
|
@ -80,7 +80,7 @@ class Player : public QObject {
|
||||
public slots:
|
||||
void ReloadSettings();
|
||||
|
||||
void PlayAt(int index);
|
||||
void PlayAt(int index, bool manual_change);
|
||||
void PlayPause();
|
||||
void NextItem();
|
||||
void Previous();
|
||||
|
Loading…
Reference in New Issue
Block a user