Add 'Enable playlist background image' to preferences.

Fixes issue #365
This commit is contained in:
Tyler Rhodes 2011-06-08 14:48:43 +00:00
parent 3843e450af
commit 827d37e64b
9 changed files with 102 additions and 63 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

View File

@ -8,12 +8,16 @@ darwin QMenu {
#playlist { #playlist {
background-color: %palette-base; background-color: %palette-base;
alternate-background-color: %palette-alternate-base;
}
#playlist[background_enabled = "true"] {
background-image: url(:logo.png); background-image: url(:logo.png);
background-attachment: fixed; background-attachment: fixed;
background-position: bottom right; background-position: bottom right;
background-repeat: none; background-repeat: none;
background-clip: content; background-clip: content;
alternate-background-color: %palette-alternate-base;
} }
QToolButton { QToolButton {

View File

@ -840,6 +840,7 @@ void PlaylistView::ReloadSettings() {
QSettings s; QSettings s;
s.beginGroup(Playlist::kSettingsGroup); s.beginGroup(Playlist::kSettingsGroup);
glow_enabled_ = s.value("glow_effect", true).toBool(); glow_enabled_ = s.value("glow_effect", true).toBool();
background_enabled_ = s.value("bg_enabled", true).toBool();
header_->SetStretchEnabled(s.value("stretch", true).toBool()); header_->SetStretchEnabled(s.value("stretch", true).toBool());
if (currently_glowing_ && glow_enabled_ && isVisible()) if (currently_glowing_ && glow_enabled_ && isVisible())
@ -847,6 +848,8 @@ void PlaylistView::ReloadSettings() {
if (!glow_enabled_) if (!glow_enabled_)
StopGlowing(); StopGlowing();
setProperty("background_enabled", background_enabled_);
if (setting_initial_header_layout_) { if (setting_initial_header_layout_) {
header_->SetColumnWidth(Playlist::Column_Length, 0.06); header_->SetColumnWidth(Playlist::Column_Length, 0.06);
header_->SetColumnWidth(Playlist::Column_Track, 0.05); header_->SetColumnWidth(Playlist::Column_Track, 0.05);
@ -866,6 +869,8 @@ void PlaylistView::SaveSettings() {
s.setValue("glow_effect", glow_enabled_); s.setValue("glow_effect", glow_enabled_);
s.setValue("stretch", header_->is_stretch_enabled()); s.setValue("stretch", header_->is_stretch_enabled());
s.setValue("column_alignments", QVariant::fromValue(playlist_->column_alignments())); s.setValue("column_alignments", QVariant::fromValue(playlist_->column_alignments()));
s.setValue("bg_enabled", background_enabled_);
} }
void PlaylistView::StretchChanged(bool stretch) { void PlaylistView::StretchChanged(bool stretch) {

View File

@ -55,7 +55,10 @@ private:
class PlaylistView : public QTreeView { class PlaylistView : public QTreeView {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool background_enabled
READ background_enabled
WRITE set_background_enabled
NOTIFY BackgroundPropertyChanged)
public: public:
PlaylistView(QWidget* parent = 0); PlaylistView(QWidget* parent = 0);
@ -68,6 +71,7 @@ class PlaylistView : public QTreeView {
void SetReadOnlySettings(bool read_only) { read_only_settings_ = read_only; } void SetReadOnlySettings(bool read_only) { read_only_settings_ = read_only; }
Playlist* playlist() const { return playlist_; } Playlist* playlist() const { return playlist_; }
bool background_enabled() const { return background_enabled_; }
// QTreeView // QTreeView
void drawTree(QPainter* painter, const QRegion& region) const; void drawTree(QPainter* painter, const QRegion& region) const;
@ -90,6 +94,7 @@ class PlaylistView : public QTreeView {
void RightClicked(const QPoint& global_pos, const QModelIndex& index); void RightClicked(const QPoint& global_pos, const QModelIndex& index);
void SeekTrack(int gap); void SeekTrack(int gap);
void FocusOnFilterSignal(QKeyEvent *event); void FocusOnFilterSignal(QKeyEvent *event);
void BackgroundPropertyChanged();
protected: protected:
void contextMenuEvent(QContextMenuEvent* e); void contextMenuEvent(QContextMenuEvent* e);
@ -129,6 +134,8 @@ class PlaylistView : public QTreeView {
void UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option, void UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option,
const QModelIndex& index); const QModelIndex& index);
inline void set_background_enabled(bool bg) { background_enabled_ = bg; emit BackgroundPropertyChanged(); }
private: private:
static const int kGlowIntensitySteps; static const int kGlowIntensitySteps;
static const int kAutoscrollGraceTimeout; static const int kAutoscrollGraceTimeout;
@ -140,13 +147,15 @@ class PlaylistView : public QTreeView {
QModelIndex PrevEditableIndex(const QModelIndex& current); QModelIndex PrevEditableIndex(const QModelIndex& current);
void RepositionDynamicControls(); void RepositionDynamicControls();
PlaylistProxyStyle* style_; PlaylistProxyStyle* style_;
Playlist* playlist_; Playlist* playlist_;
PlaylistHeader* header_; PlaylistHeader* header_;
bool setting_initial_header_layout_; bool setting_initial_header_layout_;
bool read_only_settings_; bool read_only_settings_;
bool background_enabled_;
bool glow_enabled_; bool glow_enabled_;
bool currently_glowing_; bool currently_glowing_;
QBasicTimer glow_timer_; QBasicTimer glow_timer_;

View File

@ -436,6 +436,7 @@ MainWindow::MainWindow(
connect(ui_->playlist->view(), SIGNAL(PlayPause()), player_, SLOT(PlayPause())); connect(ui_->playlist->view(), SIGNAL(PlayPause()), player_, SLOT(PlayPause()));
connect(ui_->playlist->view(), SIGNAL(RightClicked(QPoint,QModelIndex)), SLOT(PlaylistRightClick(QPoint,QModelIndex))); connect(ui_->playlist->view(), SIGNAL(RightClicked(QPoint,QModelIndex)), SLOT(PlaylistRightClick(QPoint,QModelIndex)));
connect(ui_->playlist->view(), SIGNAL(SeekTrack(int)), ui_->track_slider, SLOT(Seek(int))); connect(ui_->playlist->view(), SIGNAL(SeekTrack(int)), ui_->track_slider, SLOT(Seek(int)));
connect(ui_->playlist->view(), SIGNAL(BackgroundPropertyChanged()), SLOT(RefreshStyleSheet()));
connect(ui_->track_slider, SIGNAL(ValueChanged(int)), player_, SLOT(SeekTo(int))); connect(ui_->track_slider, SIGNAL(ValueChanged(int)), player_, SLOT(SeekTo(int)));
@ -716,6 +717,9 @@ MainWindow::MainWindow(
// Reload pretty OSD to avoid issues with fonts // Reload pretty OSD to avoid issues with fonts
osd_->ReloadPrettyOSDSettings(); osd_->ReloadPrettyOSDSettings();
// Reload playlist settings, for BG and glowing
ui_->playlist->view()->ReloadSettings();
#ifndef Q_OS_DARWIN #ifndef Q_OS_DARWIN
StartupBehaviour behaviour = StartupBehaviour behaviour =
StartupBehaviour(settings_.value("startupbehaviour", Startup_Remember).toInt()); StartupBehaviour(settings_.value("startupbehaviour", Startup_Remember).toInt());
@ -798,6 +802,7 @@ void MainWindow::ReloadSettings() {
s.value("doubleclick_playmode", PlayBehaviour_IfStopped).toInt()); s.value("doubleclick_playmode", PlayBehaviour_IfStopped).toInt());
menu_playmode_ = PlayBehaviour( menu_playmode_ = PlayBehaviour(
s.value("menu_playmode", PlayBehaviour_IfStopped).toInt()); s.value("menu_playmode", PlayBehaviour_IfStopped).toInt());
} }
void MainWindow::ReloadAllSettings() { void MainWindow::ReloadAllSettings() {
@ -820,6 +825,9 @@ void MainWindow::ReloadAllSettings() {
#endif #endif
} }
void MainWindow::RefreshStyleSheet() {
setStyleSheet(styleSheet());
}
void MainWindow::MediaStopped() { void MainWindow::MediaStopped() {
setWindowTitle(QCoreApplication::applicationName()); setWindowTitle(QCoreApplication::applicationName());

View File

@ -136,7 +136,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
private slots: private slots:
void FilePathChanged(const QString& path); void FilePathChanged(const QString& path);
void MediaStopped(); void MediaStopped();
void MediaPaused(); void MediaPaused();
void MediaPlaying(); void MediaPlaying();
@ -203,6 +203,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void ShowLibraryConfig(); void ShowLibraryConfig();
void ReloadSettings(); void ReloadSettings();
void ReloadAllSettings(); void ReloadAllSettings();
void RefreshStyleSheet();
void SetHiddenInTray() { SetHiddenInTray(true); } void SetHiddenInTray() { SetHiddenInTray(true); }
void AddFile(); void AddFile();

View File

@ -366,6 +366,7 @@ void SettingsDialog::accept() {
s.beginGroup(Playlist::kSettingsGroup); s.beginGroup(Playlist::kSettingsGroup);
s.setValue("glow_effect", ui_->current_glow->isChecked()); s.setValue("glow_effect", ui_->current_glow->isChecked());
s.setValue("greyoutdeleted", ui_->b_grey_out_deleted_->isChecked()); s.setValue("greyoutdeleted", ui_->b_grey_out_deleted_->isChecked());
s.setValue("bg_enabled", ui_->b_enable_background_img_->isChecked());
s.endGroup(); s.endGroup();
s.beginGroup(Engine::Base::kSettingsGroup); s.beginGroup(Engine::Base::kSettingsGroup);
@ -556,6 +557,7 @@ void SettingsDialog::showEvent(QShowEvent*) {
s.beginGroup(Playlist::kSettingsGroup); s.beginGroup(Playlist::kSettingsGroup);
ui_->current_glow->setChecked(s.value("glow_effect", true).toBool()); ui_->current_glow->setChecked(s.value("glow_effect", true).toBool());
ui_->b_grey_out_deleted_->setChecked(s.value("greyoutdeleted", false).toBool()); ui_->b_grey_out_deleted_->setChecked(s.value("greyoutdeleted", false).toBool());
ui_->b_enable_background_img_->setChecked(s.value("bg_enabled", true).toBool());
s.endGroup(); s.endGroup();
s.beginGroup(Engine::Base::kSettingsGroup); s.beginGroup(Engine::Base::kSettingsGroup);

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>742</width> <width>827</width>
<height>638</height> <height>768</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -125,7 +125,7 @@
<item> <item>
<widget class="QStackedWidget" name="stacked_widget"> <widget class="QStackedWidget" name="stacked_widget">
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="playback_page"> <widget class="QWidget" name="playback_page">
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout_10">
@ -424,6 +424,41 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="b_enable_background_img_">
<property name="text">
<string>Enable playlist background image</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Language</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QComboBox" name="language">
<item>
<property name="text">
<string>Use the system default</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>You will need to restart Clementine if you change the language.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="startup_group_"> <widget class="QGroupBox" name="startup_group_">
<property name="title"> <property name="title">
@ -480,6 +515,37 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="title">
<string>Using the menu to add a song will...</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
<item>
<widget class="QComboBox" name="menu_playmode">
<property name="currentIndex">
<number>0</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>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_7"> <widget class="QGroupBox" name="groupBox_7">
<property name="title"> <property name="title">
@ -538,62 +604,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="title">
<string>Using the menu to add a song will...</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
<item>
<widget class="QComboBox" name="menu_playmode">
<property name="currentIndex">
<number>0</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>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Language</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QComboBox" name="language">
<item>
<property name="text">
<string>Use the system default</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>You will need to restart Clementine if you change the language.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">