mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-23 08:20:01 +01:00
Merge pull request #5053 from redyoshi49q/double_click_playlist
consolidated the options for double clicking a playlist
This commit is contained in:
commit
589324e85c
@ -51,17 +51,6 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
|
||||
0, MainWindow::PlaylistAddBehaviour_Play);
|
||||
ui_->doubleclick_playlist_addmode->setItemData(
|
||||
1, MainWindow::PlaylistAddBehaviour_Enqueue);
|
||||
ui_->doubleclick_playlist_addmode->setItemData(
|
||||
2, MainWindow::PlaylistAddBehaviour_PlayNext);
|
||||
ui_->doubleclick_playlist_addmode->setItemData(
|
||||
3, MainWindow::PlaylistAddBehaviour_Nothing);
|
||||
|
||||
ui_->doubleclick_playlist_playmode->setItemData(
|
||||
0, MainWindow::PlaylistPlayBehaviour_Never);
|
||||
ui_->doubleclick_playlist_playmode->setItemData(
|
||||
1, MainWindow::PlaylistPlayBehaviour_IfStopped);
|
||||
ui_->doubleclick_playlist_playmode->setItemData(
|
||||
2, MainWindow::PlaylistPlayBehaviour_Always);
|
||||
|
||||
ui_->menu_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
|
||||
ui_->menu_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
|
||||
@ -129,10 +118,6 @@ void BehaviourSettingsPage::Load() {
|
||||
ui_->doubleclick_playlist_addmode->findData(
|
||||
s.value("doubleclick_playlist_addmode",
|
||||
MainWindow::PlaylistAddBehaviour_Play).toInt()));
|
||||
ui_->doubleclick_playlist_playmode->setCurrentIndex(
|
||||
ui_->doubleclick_playlist_playmode->findData(
|
||||
s.value("doubleclick_playlist_playmode",
|
||||
MainWindow::PlaylistPlayBehaviour_Always).toInt()));
|
||||
ui_->menu_playmode->setCurrentIndex(ui_->menu_playmode->findData(
|
||||
s.value("menu_playmode", MainWindow::PlayBehaviour_IfStopped).toInt()));
|
||||
|
||||
@ -222,11 +207,6 @@ void BehaviourSettingsPage::Save() {
|
||||
ui_->doubleclick_playlist_addmode
|
||||
->itemData(ui_->doubleclick_playlist_addmode->currentIndex())
|
||||
.toInt());
|
||||
MainWindow::PlaylistPlayBehaviour doubleclick_playlist_playmode =
|
||||
MainWindow::PlaylistPlayBehaviour(
|
||||
ui_->doubleclick_playlist_playmode
|
||||
->itemData(ui_->doubleclick_playlist_playmode->currentIndex())
|
||||
.toInt());
|
||||
MainWindow::PlayBehaviour menu_playmode = MainWindow::PlayBehaviour(
|
||||
ui_->menu_playmode->itemData(ui_->menu_playmode->currentIndex()).toInt());
|
||||
|
||||
@ -252,7 +232,6 @@ void BehaviourSettingsPage::Save() {
|
||||
s.setValue("doubleclick_addmode", doubleclick_addmode);
|
||||
s.setValue("doubleclick_playmode", doubleclick_playmode);
|
||||
s.setValue("doubleclick_playlist_addmode", doubleclick_playlist_addmode);
|
||||
s.setValue("doubleclick_playlist_playmode", doubleclick_playlist_playmode);
|
||||
s.setValue("menu_playmode", menu_playmode);
|
||||
s.setValue("resume_playback_after_start",
|
||||
ui_->resume_after_start_->isChecked());
|
||||
|
@ -262,11 +262,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2CPL">
|
||||
<widget class="QGroupBox" name="groupBox_doubleclick_playlist">
|
||||
<property name="title">
|
||||
<string>Double clicking a song in the playlist will...</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_doubleclick_playlist">
|
||||
<layout class="QVBoxLayout" name="layout_doubleclick_playlist">
|
||||
<item>
|
||||
<widget class="QComboBox" name="doubleclick_playlist_addmode">
|
||||
<property name="currentIndex">
|
||||
@ -282,38 +282,6 @@
|
||||
<string>Add to the queue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Replace the queue</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do nothing</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="doubleclick_playlist_playmode">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never start playing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Play if there is nothing already playing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always start playing</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -993,9 +993,6 @@ void MainWindow::ReloadSettings() {
|
||||
doubleclick_playlist_addmode_ =
|
||||
PlaylistAddBehaviour(s.value("doubleclick_playlist_addmode",
|
||||
PlaylistAddBehaviour_Play).toInt());
|
||||
doubleclick_playlist_playmode_ =
|
||||
PlaylistPlayBehaviour(s.value("doubleclick_playlist_playmode",
|
||||
PlaylistPlayBehaviour_IfStopped).toInt());
|
||||
menu_playmode_ =
|
||||
PlayBehaviour(s.value("menu_playmode", PlayBehaviour_IfStopped).toInt());
|
||||
}
|
||||
@ -1246,52 +1243,22 @@ void MainWindow::PlaylistDoubleClick(const QModelIndex& index) {
|
||||
|
||||
QModelIndexList dummyIndexList;
|
||||
|
||||
// the following block considers each possible combination of options
|
||||
// for double clicking on playlist entries
|
||||
switch (doubleclick_playlist_addmode_) {
|
||||
case PlaylistAddBehaviour_Play:
|
||||
switch (doubleclick_playlist_playmode_) {
|
||||
case PlaylistPlayBehaviour_IfStopped:
|
||||
if (app_->player()->GetState() == Engine::Playing) {
|
||||
break; // don't play if already playing
|
||||
} // otherwise, behave the same as for "Always" (no break statement)
|
||||
|
||||
case PlaylistPlayBehaviour_Always:
|
||||
app_->playlist_manager()->SetActiveToCurrent();
|
||||
app_->player()->PlayAt(row, Engine::Manual, true);
|
||||
break;
|
||||
|
||||
case PlaylistPlayBehaviour_Never:
|
||||
// deliberately do nothing here
|
||||
break;
|
||||
}
|
||||
app_->playlist_manager()->SetActiveToCurrent();
|
||||
app_->player()->PlayAt(row, Engine::Manual, true);
|
||||
break;
|
||||
|
||||
case PlaylistAddBehaviour_PlayNext:
|
||||
app_->playlist_manager()->current()->queue()->Clear();
|
||||
// continue as if enqueueing (no break statement)
|
||||
case PlaylistAddBehaviour_Enqueue:
|
||||
dummyIndexList.append(index);
|
||||
app_->playlist_manager()->current()->queue()->ToggleTracks(
|
||||
dummyIndexList);
|
||||
switch (doubleclick_playlist_playmode_) {
|
||||
case PlaylistPlayBehaviour_Always:
|
||||
case PlaylistPlayBehaviour_IfStopped:
|
||||
if (app_->player()->GetState() != Engine::Playing) {
|
||||
app_->player()->PlayAt(
|
||||
app_->playlist_manager()->current()->queue()->TakeNext(),
|
||||
Engine::Manual, true);
|
||||
}
|
||||
break;
|
||||
case PlaylistPlayBehaviour_Never:
|
||||
// deliberately do nothing here
|
||||
break;
|
||||
if (app_->player()->GetState() != Engine::Playing) {
|
||||
app_->player()->PlayAt(
|
||||
app_->playlist_manager()->current()->queue()->TakeNext(),
|
||||
Engine::Manual, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case PlaylistAddBehaviour_Nothing:
|
||||
// deliberately do nothing here
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,15 +121,6 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
||||
enum PlaylistAddBehaviour {
|
||||
PlaylistAddBehaviour_Play = 1,
|
||||
PlaylistAddBehaviour_Enqueue = 2,
|
||||
PlaylistAddBehaviour_PlayNext = 3,
|
||||
PlaylistAddBehaviour_Nothing = 4
|
||||
};
|
||||
|
||||
// Don't change the values
|
||||
enum PlaylistPlayBehaviour {
|
||||
PlaylistPlayBehaviour_Never = 1,
|
||||
PlaylistPlayBehaviour_IfStopped = 2,
|
||||
PlaylistPlayBehaviour_Always = 3,
|
||||
};
|
||||
|
||||
void SetHiddenInTray(bool hidden);
|
||||
@ -379,7 +370,6 @@ signals:
|
||||
AddBehaviour doubleclick_addmode_;
|
||||
PlayBehaviour doubleclick_playmode_;
|
||||
PlaylistAddBehaviour doubleclick_playlist_addmode_;
|
||||
PlaylistPlayBehaviour doubleclick_playlist_playmode_;
|
||||
PlayBehaviour menu_playmode_;
|
||||
|
||||
BackgroundStreams* background_streams_;
|
||||
|
Loading…
Reference in New Issue
Block a user