diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 589cea186..14dce7026 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -455,7 +455,12 @@ QList PlaylistView::LoadBarPixmap(const QString &filename) { QPainter p(&image); p.setCompositionMode(QPainter::CompositionMode_SourceAtop); p.setOpacity(0.7); - p.fillRect(image.rect(), QApplication::palette().color(QPalette::Highlight)); + if (playlist_playing_song_color_.isValid()) { + p.fillRect(image.rect(), playlist_playing_song_color_); + } + else { + p.fillRect(image.rect(), QApplication::palette().color(QPalette::Highlight)); + } p.end(); // Animation steps @@ -509,8 +514,9 @@ void PlaylistView::drawRow(QPainter *painter, const QStyleOptionViewItem &option middle.setRight(middle.right() - currenttrack_bar_right_[0].width()); // Selection - if (selectionModel()->isSelected(idx)) + if (selectionModel()->isSelected(idx)) { painter->fillRect(opt.rect, opt.palette.color(QPalette::Highlight)); + } // Draw the bar painter->drawPixmap(opt.rect.topLeft(), currenttrack_bar_left_[step]); @@ -1162,6 +1168,11 @@ void PlaylistView::ReloadSettings() { bool background_image_keep_aspect_ratio = s.value(AppearanceSettingsPage::kBackgroundImageKeepAspectRatio, true).toBool(); int blur_radius = s.value(AppearanceSettingsPage::kBlurRadius, AppearanceSettingsPage::kDefaultBlurRadius).toInt(); int opacity_level = s.value(AppearanceSettingsPage::kOpacityLevel, AppearanceSettingsPage::kDefaultOpacityLevel).toInt(); + QColor playlist_playing_song_color = s.value(AppearanceSettingsPage::kPlaylistPlayingSongColor).value(); + if (playlist_playing_song_color != playlist_playing_song_color_) { + row_height_ = -1; + } + playlist_playing_song_color_ = playlist_playing_song_color; s.endGroup(); if (currently_glowing_ && glow_enabled_ && isVisible()) StartGlowing(); diff --git a/src/playlist/playlistview.h b/src/playlist/playlistview.h index fbc740228..d4c2f2ca1 100644 --- a/src/playlist/playlistview.h +++ b/src/playlist/playlistview.h @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -297,6 +298,8 @@ class PlaylistView : public QTreeView { DynamicPlaylistControls *dynamic_controls_; RatingItemDelegate *rating_delegate_; + QColor playlist_playing_song_color_; + }; #endif // PLAYLISTVIEW_H diff --git a/src/settings/appearancesettingspage.cpp b/src/settings/appearancesettingspage.cpp index 4803b41b1..2e801ad28 100644 --- a/src/settings/appearancesettingspage.cpp +++ b/src/settings/appearancesettingspage.cpp @@ -84,6 +84,8 @@ const char *AppearanceSettingsPage::kIconSizePlaylistButtons = "icon_size_playli const char *AppearanceSettingsPage::kIconSizeLeftPanelButtons = "icon_size_left_panel_buttons"; const char *AppearanceSettingsPage::kIconSizeConfigureButtons = "icon_size_configure_buttons"; +const char *AppearanceSettingsPage::kPlaylistPlayingSongColor = "playlist_playing_song_color"; + AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_AppearanceSettingsPage), @@ -130,6 +132,9 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog) QObject::connect(ui_->select_tabbar_color, &QPushButton::pressed, this, &AppearanceSettingsPage::TabBarSelectBGColor); QObject::connect(ui_->tabbar_system_color, &QRadioButton::toggled, this, &AppearanceSettingsPage::TabBarSystemColor); + QObject::connect(ui_->select_playlist_playing_song_color, &QPushButton::pressed, this, &AppearanceSettingsPage::PlaylistPlayingSongSelectColor); + QObject::connect(ui_->playlist_playing_song_color_system, &QRadioButton::toggled, this, &AppearanceSettingsPage::PlaylistPlayingSongColorSystem); + #if defined(Q_OS_MACOS) || defined(Q_OS_WIN) ui_->checkbox_system_icons->hide(); #endif @@ -220,6 +225,17 @@ void AppearanceSettingsPage::Load() { ui_->spinbox_icon_size_left_panel_buttons->setValue(s.value(kIconSizeLeftPanelButtons, 22).toInt()); ui_->spinbox_icon_size_configure_buttons->setValue(s.value(kIconSizeConfigureButtons, 16).toInt()); + current_playlist_playing_song_color_ = s.value(kPlaylistPlayingSongColor).value(); + if (current_playlist_playing_song_color_.isValid()) { + ui_->playlist_playing_song_color_custom->setChecked(true); + } + else { + ui_->playlist_playing_song_color_system->setChecked(true); + current_playlist_playing_song_color_ = StyleHelper::highlightColor(); + } + UpdateColorSelectorColor(ui_->select_playlist_playing_song_color, current_playlist_playing_song_color_); + PlaylistPlayingSongColorSystem(ui_->playlist_playing_song_color_system->isChecked()); + s.endGroup(); Init(ui_->layout_appearancesettingspage->parentWidget()); @@ -297,6 +313,13 @@ void AppearanceSettingsPage::Save() { s.setValue(kIconSizeLeftPanelButtons, ui_->spinbox_icon_size_left_panel_buttons->value()); s.setValue(kIconSizeConfigureButtons, ui_->spinbox_icon_size_configure_buttons->value()); + if (ui_->playlist_playing_song_color_system->isChecked()) { + s.setValue(kPlaylistPlayingSongColor, QColor()); + } + else { + s.setValue(kPlaylistPlayingSongColor, current_playlist_playing_song_color_); + } + s.endGroup(); } @@ -414,3 +437,29 @@ void AppearanceSettingsPage::TabBarSelectBGColor() { set_changed(); } + +void AppearanceSettingsPage::PlaylistPlayingSongColorSystem(bool checked) { + + if (checked) { + current_playlist_playing_song_color_ = StyleHelper::highlightColor(); + UpdateColorSelectorColor(ui_->select_playlist_playing_song_color, current_playlist_playing_song_color_); + } + ui_->layout_playlist_playing_song_color_custom->setEnabled(!checked); + ui_->select_playlist_playing_song_color->setEnabled(!checked); + + set_changed(); + +} + +void AppearanceSettingsPage::PlaylistPlayingSongSelectColor() { + + if (ui_->playlist_playing_song_color_system->isChecked()) return; + + QColor color_selected = QColorDialog::getColor(current_playlist_playing_song_color_); + if (!color_selected.isValid()) return; + current_playlist_playing_song_color_ = color_selected; + UpdateColorSelectorColor(ui_->select_playlist_playing_song_color, current_playlist_playing_song_color_); + + set_changed(); + +} diff --git a/src/settings/appearancesettingspage.h b/src/settings/appearancesettingspage.h index 5c1553ce7..0d3d1099d 100644 --- a/src/settings/appearancesettingspage.h +++ b/src/settings/appearancesettingspage.h @@ -77,6 +77,8 @@ class AppearanceSettingsPage : public SettingsPage { static const char *kIconSizeLeftPanelButtons; static const char *kIconSizeConfigureButtons; + static const char *kPlaylistPlayingSongColor; + enum BackgroundImageType { BackgroundImageType_Default, BackgroundImageType_None, @@ -106,6 +108,8 @@ class AppearanceSettingsPage : public SettingsPage { void OpacityLevelChanged(int); void TabBarSystemColor(bool checked); void TabBarSelectBGColor(); + void PlaylistPlayingSongColorSystem(bool checked); + void PlaylistPlayingSongSelectColor(); private: // Set the widget's background to new_color @@ -123,6 +127,7 @@ class AppearanceSettingsPage : public SettingsPage { QColor current_tabbar_bg_color_; BackgroundImageType background_image_type_; QString background_image_filename_; + QColor current_playlist_playing_song_color_; }; diff --git a/src/settings/appearancesettingspage.ui b/src/settings/appearancesettingspage.ui index 078a1144c..f90d6c2dd 100644 --- a/src/settings/appearancesettingspage.ui +++ b/src/settings/appearancesettingspage.ui @@ -7,7 +7,7 @@ 0 0 612 - 1071 + 1166 @@ -612,6 +612,47 @@ + + + + Playlist playing song color + + + + + + System highlight color + + + + + + + Custom color + + + + + + + + + Select playlist playing song color: + + + + + + + + + + + + + + +