1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-22 07:54:18 +01:00

Add appearance option to hide playlist filter toolbar (#5942)

Gives the user the option of a cleaner looking interface if the
filter toolbar isn't used.
This commit is contained in:
vikramambrose 2018-01-03 17:24:56 +02:00 committed by John Maguire
parent d9b12a5599
commit 2e4a67b8da
5 changed files with 31 additions and 14 deletions

View File

@ -19,6 +19,7 @@
#include "playlistmanager.h"
#include "ui_playlistcontainer.h"
#include "core/logging.h"
#include "core/appearance.h"
#include "playlistparsers/playlistparser.h"
#include "ui/iconloader.h"
@ -71,6 +72,11 @@ PlaylistContainer::PlaylistContainer(QWidget* parent)
// Remove QFrame border
ui_->toolbar->setStyleSheet("QFrame { border: 0px; }");
QSettings settings;
settings.beginGroup(Appearance::kSettingsGroup);
bool hide_toolbar = settings.value("b_hide_filter_toolbar", false).toBool();
ui_->toolbar->setVisible(!hide_toolbar);
// Make it bold
QFont no_matches_font = no_matches_label_->font();
no_matches_font.setBold(true);
@ -452,3 +458,10 @@ bool PlaylistContainer::eventFilter(QObject* objectWatched, QEvent* event) {
}
return QWidget::eventFilter(objectWatched, event);
}
void PlaylistContainer::ReloadSettings() {
QSettings settings;
settings.beginGroup(Appearance::kSettingsGroup);
bool hide_toolbar = settings.value("b_hide_filter_toolbar", false).toBool();
ui_->toolbar->setVisible(!hide_toolbar);
}

View File

@ -61,6 +61,9 @@ signals:
// QWidget
void resizeEvent(QResizeEvent*);
public slots:
void ReloadSettings();
private slots:
void NewPlaylist();
void LoadPlaylist();

View File

@ -109,6 +109,7 @@ void AppearanceSettingsPage::Load() {
InitColorSelectorsColors();
ui_->b_use_sys_icons->setChecked(s.value("b_use_sys_icons", false).toBool());
ui_->b_hide_filter_toolbar->setChecked(s.value("b_hide_filter_toolbar",false).toBool());
s.endGroup();
// Playlist settings
@ -171,6 +172,7 @@ void AppearanceSettingsPage::Save() {
dialog()->appearance()->ResetToSystemDefaultTheme();
}
s.setValue("b_use_sys_icons", ui_->b_use_sys_icons->isChecked());
s.setValue("b_hide_filter_toolbar", ui_->b_hide_filter_toolbar->isChecked());
s.endGroup();
// Playlist settings

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>596</width>
<height>566</height>
<height>666</height>
</rect>
</property>
<property name="windowTitle">
@ -279,22 +279,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="b_hide_filter_toolbar">
<property name="text">
<string>Hide playlist filter toolbar</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>

View File

@ -1096,6 +1096,7 @@ void MainWindow::ReloadAllSettings() {
library_view_->ReloadSettings();
song_info_view_->ReloadSettings();
app_->player()->engine()->ReloadSettings();
ui_->playlist->ReloadSettings();
ui_->playlist->view()->ReloadSettings();
app_->internet_model()->ReloadSettings();
#ifdef HAVE_WIIMOTEDEV