1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-14 10:24:19 +01:00

Add stop after each song repeat mode

This commit is contained in:
kiselev-dv 2015-05-12 14:05:46 +05:00
parent 2cbd13ebba
commit 864d4162d3
5 changed files with 20 additions and 0 deletions

View File

@ -495,6 +495,9 @@ void OutgoingDataCreator::SendRepeatMode(PlaylistSequence::RepeatMode mode) {
case PlaylistSequence::Repeat_Playlist:
msg.mutable_repeat()->set_repeat_mode(pb::remote::Repeat_Playlist);
break;
case PlaylistSequence::Repeat_OneByOne:
msg.mutable_repeat()->set_repeat_mode(pb::remote::Repeat_OneByOne);
break;
}
SendDataToClients(&msg);

View File

@ -1681,6 +1681,11 @@ void Playlist::ClearStreamMetadata() {
}
bool Playlist::stop_after_current() const {
PlaylistSequence::RepeatMode repeat_mode = playlist_sequence_->repeat_mode();
if(repeat_mode == PlaylistSequence::Repeat_OneByOne) {
return true;
}
return stop_after_.isValid() && current_item_index_.isValid() &&
stop_after_.row() == current_item_index_.row();
}

View File

@ -52,6 +52,7 @@ PlaylistSequence::PlaylistSequence(QWidget* parent, SettingsProvider* settings)
repeat_group->addAction(ui_->action_repeat_track);
repeat_group->addAction(ui_->action_repeat_album);
repeat_group->addAction(ui_->action_repeat_playlist);
repeat_group->addAction(ui_->action_repeat_onebyone);
repeat_menu_->addActions(repeat_group->actions());
ui_->repeat->setMenu(repeat_menu_);
@ -118,6 +119,7 @@ void PlaylistSequence::RepeatActionTriggered(QAction* action) {
if (action == ui_->action_repeat_track) mode = Repeat_Track;
if (action == ui_->action_repeat_album) mode = Repeat_Album;
if (action == ui_->action_repeat_playlist) mode = Repeat_Playlist;
if (action == ui_->action_repeat_onebyone) mode = Repeat_OneByOne;
SetRepeatMode(mode);
}
@ -147,6 +149,9 @@ void PlaylistSequence::SetRepeatMode(RepeatMode mode) {
case Repeat_Playlist:
ui_->action_repeat_playlist->setChecked(true);
break;
case Repeat_OneByOne:
ui_->action_repeat_onebyone->setChecked(true);
break;
}
if (mode != repeat_mode_) {
@ -237,6 +242,9 @@ void PlaylistSequence::CycleRepeatMode() {
mode = Repeat_Playlist;
break;
case Repeat_Playlist:
mode = Repeat_OneByOne;
break;
case Repeat_OneByOne:
break;
}

View File

@ -40,6 +40,7 @@ class PlaylistSequence : public QWidget {
Repeat_Track = 1,
Repeat_Album = 2,
Repeat_Playlist = 3,
Repeat_OneByOne = 4
};
enum ShuffleMode {
Shuffle_Off = 0,

View File

@ -314,6 +314,9 @@ void OSD::RepeatModeChanged(PlaylistSequence::RepeatMode mode) {
case PlaylistSequence::Repeat_Playlist:
current_mode = tr("Repeat playlist");
break;
case PlaylistSequence::Repeat_OneByOne:
current_mode = tr("Tracks one by one");
break;
}
ShowMessage(QCoreApplication::applicationName(), current_mode);
}