parent
75394d0e8a
commit
f40b8ab892
@ -51,10 +51,6 @@ const int PlaylistView::kGlowIntensitySteps = 24;
|
|||||||
const int PlaylistView::kAutoscrollGraceTimeout = 60; // seconds
|
const int PlaylistView::kAutoscrollGraceTimeout = 60; // seconds
|
||||||
const int PlaylistView::kDropIndicatorWidth = 2;
|
const int PlaylistView::kDropIndicatorWidth = 2;
|
||||||
const int PlaylistView::kDropIndicatorGradientWidth = 5;
|
const int PlaylistView::kDropIndicatorGradientWidth = 5;
|
||||||
// Opacity value used by all background images but the default clementine one
|
|
||||||
// (because it is already opaque and load through the mainwindow.css file)
|
|
||||||
const qreal PlaylistView::kBackgroundOpacity = 0.4;
|
|
||||||
|
|
||||||
const char* PlaylistView::kSettingBackgroundImageType = "playlistview_background_type";
|
const char* PlaylistView::kSettingBackgroundImageType = "playlistview_background_type";
|
||||||
const char* PlaylistView::kSettingBackgroundImageFilename = "playlistview_background_image_file";
|
const char* PlaylistView::kSettingBackgroundImageFilename = "playlistview_background_image_file";
|
||||||
|
|
||||||
@ -1020,6 +1016,7 @@ void PlaylistView::ReloadSettings() {
|
|||||||
}
|
}
|
||||||
QString background_image_filename = s.value(kSettingBackgroundImageFilename).toString();
|
QString background_image_filename = s.value(kSettingBackgroundImageFilename).toString();
|
||||||
int blur_radius = s.value("blur_radius").toInt();
|
int blur_radius = s.value("blur_radius").toInt();
|
||||||
|
int opacity_level = s.value("opacity_level").toInt();
|
||||||
// Check if background properties have changed.
|
// Check if background properties have changed.
|
||||||
// We change properties only if they have actually changed, to avoid to call
|
// We change properties only if they have actually changed, to avoid to call
|
||||||
// set_background_image when it is not needed, as this will cause the fading
|
// set_background_image when it is not needed, as this will cause the fading
|
||||||
@ -1027,11 +1024,13 @@ void PlaylistView::ReloadSettings() {
|
|||||||
// "force_background_redraw".
|
// "force_background_redraw".
|
||||||
if (background_image_filename != background_image_filename_ ||
|
if (background_image_filename != background_image_filename_ ||
|
||||||
background_type != background_image_type_ ||
|
background_type != background_image_type_ ||
|
||||||
blur_radius_ != blur_radius) {
|
blur_radius_ != blur_radius ||
|
||||||
|
opacity_level_ != opacity_level) {
|
||||||
// Store background properties
|
// Store background properties
|
||||||
background_image_type_ = background_type;
|
background_image_type_ = background_type;
|
||||||
background_image_filename_ = background_image_filename;
|
background_image_filename_ = background_image_filename;
|
||||||
blur_radius_ = blur_radius;
|
blur_radius_ = blur_radius;
|
||||||
|
opacity_level_ = opacity_level;
|
||||||
if (background_image_type_ == Custom) {
|
if (background_image_type_ == Custom) {
|
||||||
set_background_image(QImage(background_image_filename));
|
set_background_image(QImage(background_image_filename));
|
||||||
} else if (background_image_type_ == AlbumCover) {
|
} else if (background_image_type_ == AlbumCover) {
|
||||||
@ -1198,7 +1197,7 @@ void PlaylistView::set_background_image(const QImage& image) {
|
|||||||
// Apply opacity filter
|
// Apply opacity filter
|
||||||
uchar* bits = background_image_.bits();
|
uchar* bits = background_image_.bits();
|
||||||
for (int i = 0; i < background_image_.height() * background_image_.bytesPerLine(); i+=4) {
|
for (int i = 0; i < background_image_.height() * background_image_.bytesPerLine(); i+=4) {
|
||||||
bits[i+3] = kBackgroundOpacity * 255;
|
bits[i+3] = (opacity_level_ / 100.0) * 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blur_radius_ != 0) {
|
if (blur_radius_ != 0) {
|
||||||
|
@ -173,7 +173,6 @@ class PlaylistView : public QTreeView {
|
|||||||
static const int kAutoscrollGraceTimeout;
|
static const int kAutoscrollGraceTimeout;
|
||||||
static const int kDropIndicatorWidth;
|
static const int kDropIndicatorWidth;
|
||||||
static const int kDropIndicatorGradientWidth;
|
static const int kDropIndicatorGradientWidth;
|
||||||
static const qreal kBackgroundOpacity;
|
|
||||||
|
|
||||||
QList<int> GetEditableColumns();
|
QList<int> GetEditableColumns();
|
||||||
QModelIndex NextEditableIndex(const QModelIndex& current);
|
QModelIndex NextEditableIndex(const QModelIndex& current);
|
||||||
@ -196,6 +195,7 @@ class PlaylistView : public QTreeView {
|
|||||||
// set_background_image_type instead of modifying background_image_ directly
|
// set_background_image_type instead of modifying background_image_ directly
|
||||||
QImage background_image_;
|
QImage background_image_;
|
||||||
int blur_radius_;
|
int blur_radius_;
|
||||||
|
int opacity_level_;
|
||||||
// Used if background image is a filemane
|
// Used if background image is a filemane
|
||||||
QString background_image_filename_;
|
QString background_image_filename_;
|
||||||
QImage current_song_cover_art_;
|
QImage current_song_cover_art_;
|
||||||
|
@ -57,6 +57,7 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog* dialog)
|
|||||||
connect(ui_->select_background_color, SIGNAL(pressed()), SLOT(SelectBackgroundColor()));
|
connect(ui_->select_background_color, SIGNAL(pressed()), SLOT(SelectBackgroundColor()));
|
||||||
connect(ui_->use_a_custom_color_set, SIGNAL(toggled(bool)), SLOT(UseCustomColorSetOptionChanged(bool)));
|
connect(ui_->use_a_custom_color_set, SIGNAL(toggled(bool)), SLOT(UseCustomColorSetOptionChanged(bool)));
|
||||||
connect(ui_->blur_slider, SIGNAL(valueChanged(int)), SLOT(BlurLevelChanged(int)));
|
connect(ui_->blur_slider, SIGNAL(valueChanged(int)), SLOT(BlurLevelChanged(int)));
|
||||||
|
connect(ui_->opacity_slider, SIGNAL(valueChanged(int)), SLOT(OpacityLevelChanged(int)));
|
||||||
|
|
||||||
connect(ui_->select_background_image_filename_button, SIGNAL(pressed()), SLOT(SelectBackgroundImage()));
|
connect(ui_->select_background_image_filename_button, SIGNAL(pressed()), SLOT(SelectBackgroundImage()));
|
||||||
connect(ui_->use_custom_background_image, SIGNAL(toggled(bool)),
|
connect(ui_->use_custom_background_image, SIGNAL(toggled(bool)),
|
||||||
@ -127,6 +128,10 @@ void AppearanceSettingsPage::Load() {
|
|||||||
DisableBlurSlider(true);
|
DisableBlurSlider(true);
|
||||||
}
|
}
|
||||||
ui_->background_image_filename->setText(playlist_view_background_image_filename_);
|
ui_->background_image_filename->setText(playlist_view_background_image_filename_);
|
||||||
|
/* There has to be a way to just simulate the change... */
|
||||||
|
ui_->opacity_slider->setValue(s.value("opacity_level").toInt());
|
||||||
|
OpacityLevelChanged(s.value("opacity_level").toInt());
|
||||||
|
|
||||||
|
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
@ -171,6 +176,7 @@ void AppearanceSettingsPage::Save() {
|
|||||||
s.setValue(PlaylistView::kSettingBackgroundImageType,
|
s.setValue(PlaylistView::kSettingBackgroundImageType,
|
||||||
playlist_view_background_image_type_);
|
playlist_view_background_image_type_);
|
||||||
s.setValue("blur_radius", ui_->blur_slider->value());
|
s.setValue("blur_radius", ui_->blur_slider->value());
|
||||||
|
s.setValue("opacity_level", ui_->opacity_slider->value());
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
// Moodbar settings
|
// Moodbar settings
|
||||||
@ -252,6 +258,11 @@ void AppearanceSettingsPage::BlurLevelChanged(int value) {
|
|||||||
ui_->background_blur_radius_label->setText(QString("%1px").arg(value));
|
ui_->background_blur_radius_label->setText(QString("%1px").arg(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppearanceSettingsPage::OpacityLevelChanged(int percent) {
|
||||||
|
background_opacity_level_ = percent;
|
||||||
|
ui_->background_opacity_label->setText(QString("%1\%").arg(percent));
|
||||||
|
}
|
||||||
|
|
||||||
void AppearanceSettingsPage::InitMoodbarPreviews() {
|
void AppearanceSettingsPage::InitMoodbarPreviews() {
|
||||||
#ifdef HAVE_MOODBAR
|
#ifdef HAVE_MOODBAR
|
||||||
if (initialised_moodbar_previews_)
|
if (initialised_moodbar_previews_)
|
||||||
|
@ -43,6 +43,7 @@ private slots:
|
|||||||
void UseCustomColorSetOptionChanged(bool);
|
void UseCustomColorSetOptionChanged(bool);
|
||||||
void SelectBackgroundImage();
|
void SelectBackgroundImage();
|
||||||
void BlurLevelChanged(int);
|
void BlurLevelChanged(int);
|
||||||
|
void OpacityLevelChanged(int);
|
||||||
void DisableBlurSlider(bool);
|
void DisableBlurSlider(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -65,6 +66,7 @@ private:
|
|||||||
PlaylistView::BackgroundImageType playlist_view_background_image_type_;
|
PlaylistView::BackgroundImageType playlist_view_background_image_type_;
|
||||||
QString playlist_view_background_image_filename_;
|
QString playlist_view_background_image_filename_;
|
||||||
int background_blur_radius_;
|
int background_blur_radius_;
|
||||||
|
int background_opacity_level_;
|
||||||
|
|
||||||
bool initialised_moodbar_previews_;
|
bool initialised_moodbar_previews_;
|
||||||
};
|
};
|
||||||
|
@ -201,6 +201,37 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="select_opacity_level_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Opacity level:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="background_opacity_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>40%</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="opacity_slider">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user