Add setting for configuring the color for the currently playing song
Fixes #676
This commit is contained in:
@@ -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<QColor>();
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@@ -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_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>612</width>
|
||||
<height>1071</height>
|
||||
<height>1166</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -612,6 +612,47 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="playlist_playing_song_color">
|
||||
<property name="title">
|
||||
<string>Playlist playing song color</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_playlist_playing_song_color">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="playlist_playing_song_color_system">
|
||||
<property name="text">
|
||||
<string>System highlight color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="playlist_playing_song_color_custom">
|
||||
<property name="text">
|
||||
<string>Custom color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_playlist_playing_song_color_custom">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_select_playlist_playing_song_color">
|
||||
<property name="text">
|
||||
<string>Select playlist playing song color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="select_playlist_playing_song_color">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer_bottom">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user