Added option to disable playlist clear button

Fixes #339
This commit is contained in:
Jonas Kvinge 2020-01-04 06:38:25 +01:00
parent eec767406b
commit 2215f300bf
5 changed files with 25 additions and 0 deletions

View File

@ -949,6 +949,7 @@ void MainWindow::ReloadAllSettings() {
osd_->ReloadSettings();
collection_view_->ReloadSettings();
ui_->playlist->view()->ReloadSettings();
app_->playlist_manager()->playlist_container()->ReloadSettings();
app_->album_cover_loader()->ReloadSettings();
album_cover_choice_controller_->ReloadSettings();
if (cover_manager_.get()) cover_manager_->ReloadSettings();

View File

@ -118,6 +118,8 @@ PlaylistContainer::PlaylistContainer(QWidget *parent)
connect(ui_->playlist, SIGNAL(FocusOnFilterSignal(QKeyEvent*)), SLOT(FocusOnFilter(QKeyEvent*)));
ui_->filter->installEventFilter(this);
ReloadSettings();
}
PlaylistContainer::~PlaylistContainer() { delete ui_; }
@ -225,6 +227,18 @@ void PlaylistContainer::SetViewModel(Playlist *playlist) {
}
void PlaylistContainer::ReloadSettings() {
bool playlist_clear = settings_.value("playlist_clear", true).toBool();
if (playlist_clear) {
ui_->clear->show();
}
else {
ui_->clear->hide();
}
}
void PlaylistContainer::ActivePlaying() {
UpdateActiveIcon(QIcon(":/pictures/tiny-play.png"));
}

View File

@ -56,6 +56,7 @@ class PlaylistContainer : public QWidget {
void SetActions(QAction *new_playlist, QAction *load_playlist, QAction *save_playlist, QAction *clear_playlist, QAction *next_playlist, QAction *previous_playlist);
void SetManager(PlaylistManager *manager);
void ReloadSettings();
PlaylistView *view() const;

View File

@ -66,6 +66,7 @@ void PlaylistSettingsPage::Load() {
ui_->checkbox_greyout_songs_startup->setChecked(s.value("greyout_songs_startup", true).toBool());
ui_->checkbox_greyout_songs_play->setChecked(s.value("greyout_songs_play", true).toBool());
ui_->checkbox_select_track->setChecked(s.value("select_track", false).toBool());
ui_->checkbox_playlist_clear->setChecked(s.value("playlist_clear", true).toBool());
Playlist::Path path = Playlist::Path(s.value(Playlist::kPathType, Playlist::Path_Automatic).toInt());
switch (path) {
@ -114,6 +115,7 @@ void PlaylistSettingsPage::Save() {
s.setValue("greyout_songs_startup", ui_->checkbox_greyout_songs_startup->isChecked());
s.setValue("greyout_songs_play", ui_->checkbox_greyout_songs_play->isChecked());
s.setValue("select_track", ui_->checkbox_select_track->isChecked());
s.setValue("playlist_clear", ui_->checkbox_playlist_clear->isChecked());
s.setValue(Playlist::kPathType, static_cast<int>(path));
s.setValue("editmetadatainline", ui_->checkbox_editmetadatainline->isChecked());
s.setValue(Playlist::kWriteMetadata, ui_->checkbox_writemetadata->isChecked());

View File

@ -56,6 +56,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkbox_playlist_clear">
<property name="text">
<string>Enable playlist clear button</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupbox_paths">
<property name="title">