Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2f5486987 | ||
|
|
b0d390aaf1 | ||
|
|
bae1b42394 | ||
|
|
a2533edd57 | ||
|
|
7b88c198fe | ||
|
|
c49cb0c119 | ||
|
|
03aabeb848 | ||
|
|
1d3a837f7a | ||
|
|
92adc18b8f | ||
|
|
e4697c8ff1 | ||
|
|
b741f1a580 |
@@ -2,6 +2,13 @@ Strawberry Music Player
|
|||||||
=======================
|
=======================
|
||||||
ChangeLog
|
ChangeLog
|
||||||
|
|
||||||
|
Version 1.0.17 (2023.03.29):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed over-sized context album cover with device pixel ratio higher than 1.0 (#1166).
|
||||||
|
* Fixed playing widget fading from a blurry previous cover with device pixel ratio higher than 1.0.
|
||||||
|
* Made playlist source icon, album cover manager and OSD pretty cover respect device pixel ratio.
|
||||||
|
|
||||||
Version 1.0.16 (2023.03.27):
|
Version 1.0.16 (2023.03.27):
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
set(STRAWBERRY_VERSION_MAJOR 1)
|
set(STRAWBERRY_VERSION_MAJOR 1)
|
||||||
set(STRAWBERRY_VERSION_MINOR 0)
|
set(STRAWBERRY_VERSION_MINOR 0)
|
||||||
set(STRAWBERRY_VERSION_PATCH 16)
|
set(STRAWBERRY_VERSION_PATCH 17)
|
||||||
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
||||||
|
|
||||||
set(INCLUDE_GIT_REVISION OFF)
|
set(INCLUDE_GIT_REVISION OFF)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void ContextAlbum::Init(ContextView *context_view, AlbumCoverChoiceController *a
|
|||||||
|
|
||||||
QSize ContextAlbum::sizeHint() const {
|
QSize ContextAlbum::sizeHint() const {
|
||||||
|
|
||||||
return QSize(pixmap_current_.width(), pixmap_current_.height());
|
return QSize(pixmap_current_.width() / devicePixelRatioF(), pixmap_current_.height() / devicePixelRatioF());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ void ContextAlbum::DrawImage(QPainter *p, const QPixmap &pixmap, const qreal opa
|
|||||||
if (qFuzzyCompare(opacity, static_cast<qreal>(0.0))) return;
|
if (qFuzzyCompare(opacity, static_cast<qreal>(0.0))) return;
|
||||||
|
|
||||||
p->setOpacity(opacity);
|
p->setOpacity(opacity);
|
||||||
p->drawPixmap(0, 0, pixmap.width(), pixmap.height(), pixmap);
|
p->drawPixmap(0, 0, pixmap.width() / pixmap.devicePixelRatioF(), pixmap.height() / pixmap.devicePixelRatioF(), pixmap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ AlbumCoverManager::AlbumCoverManager(Application *app, CollectionBackend *collec
|
|||||||
cover_exporter_(new AlbumCoverExporter(this)),
|
cover_exporter_(new AlbumCoverExporter(this)),
|
||||||
artist_icon_(IconLoader::Load("folder-sound")),
|
artist_icon_(IconLoader::Load("folder-sound")),
|
||||||
all_artists_icon_(IconLoader::Load("library-music")),
|
all_artists_icon_(IconLoader::Load("library-music")),
|
||||||
image_nocover_thumbnail_(ImageUtils::GenerateNoCoverImage(QSize(120, 120))),
|
image_nocover_thumbnail_(ImageUtils::GenerateNoCoverImage(QSize(120 * devicePixelRatio(), 120 * devicePixelRatio()))),
|
||||||
icon_nocover_item_(QPixmap::fromImage(image_nocover_thumbnail_)),
|
icon_nocover_item_(QPixmap::fromImage(image_nocover_thumbnail_)),
|
||||||
context_menu_(new QMenu(this)),
|
context_menu_(new QMenu(this)),
|
||||||
progress_bar_(new QProgressBar(this)),
|
progress_bar_(new QProgressBar(this)),
|
||||||
@@ -152,7 +152,7 @@ AlbumCoverManager::AlbumCoverManager(Application *app, CollectionBackend *collec
|
|||||||
|
|
||||||
cover_loader_options_.scale_output_image_ = true;
|
cover_loader_options_.scale_output_image_ = true;
|
||||||
cover_loader_options_.pad_output_image_ = true;
|
cover_loader_options_.pad_output_image_ = true;
|
||||||
cover_loader_options_.desired_height_ = 120;
|
cover_loader_options_.desired_height_ = 120 * devicePixelRatio();
|
||||||
cover_loader_options_.create_thumbnail_ = false;
|
cover_loader_options_.create_thumbnail_ = false;
|
||||||
|
|
||||||
EnableCoversButtons();
|
EnableCoversButtons();
|
||||||
|
|||||||
@@ -343,7 +343,8 @@ void OSDPretty::paintEvent(QPaintEvent*) {
|
|||||||
void OSDPretty::SetMessage(const QString &summary, const QString &message, const QImage &image) {
|
void OSDPretty::SetMessage(const QString &summary, const QString &message, const QImage &image) {
|
||||||
|
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
QImage scaled_image = image.scaled(kMaxIconSize, kMaxIconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
QImage scaled_image = image.scaled(kMaxIconSize * devicePixelRatioF(), kMaxIconSize * devicePixelRatioF(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
scaled_image.setDevicePixelRatio(devicePixelRatioF());
|
||||||
ui_->icon->setPixmap(QPixmap::fromImage(scaled_image));
|
ui_->icon->setPixmap(QPixmap::fromImage(scaled_image));
|
||||||
ui_->icon->show();
|
ui_->icon->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,17 +471,21 @@ QString SongSourceDelegate::displayText(const QVariant &value, const QLocale&) c
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap SongSourceDelegate::LookupPixmap(const Song::Source source, const QSize size) const {
|
QPixmap SongSourceDelegate::LookupPixmap(const Song::Source source, const QSize size, const qreal device_pixel_ratio) const {
|
||||||
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
QString cache_key = QString("%1-%2x%3").arg(Song::TextForSource(source)).arg(size.width()).arg(size.height());
|
const QString pixmap_cache_key = QString("%1-%2x%3-%4").arg(Song::TextForSource(source)).arg(size.width()).arg(size.height()).arg(device_pixel_ratio);
|
||||||
if (QPixmapCache::find(cache_key, &pixmap)) {
|
if (QPixmapCache::find(pixmap_cache_key, &pixmap)) {
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon icon(Song::IconForSource(source));
|
QIcon icon(Song::IconForSource(source));
|
||||||
pixmap = icon.pixmap(size.height());
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
QPixmapCache::insert(cache_key, pixmap);
|
pixmap = icon.pixmap(size, device_pixel_ratio);
|
||||||
|
#else
|
||||||
|
pixmap = icon.pixmap(size);
|
||||||
|
#endif
|
||||||
|
QPixmapCache::insert(pixmap_cache_key, pixmap);
|
||||||
|
|
||||||
return pixmap;
|
return pixmap;
|
||||||
|
|
||||||
@@ -495,16 +499,11 @@ void SongSourceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
|||||||
QStyleOptionViewItem option_copy(option);
|
QStyleOptionViewItem option_copy(option);
|
||||||
initStyleOption(&option_copy, idx);
|
initStyleOption(&option_copy, idx);
|
||||||
|
|
||||||
const Song::Source source = static_cast<Song::Source>(idx.data().toInt());
|
const QPixmap pixmap = LookupPixmap(idx.data().value<Song::Source>(), option_copy.decorationSize, qobject_cast<QWidget*>(parent())->devicePixelRatioF());
|
||||||
QPixmap pixmap = LookupPixmap(source, option_copy.decorationSize);
|
|
||||||
|
|
||||||
QWidget *parent_widget = qobject_cast<QWidget*>(parent());
|
|
||||||
qreal device_pixel_ratio = parent_widget->devicePixelRatio();
|
|
||||||
|
|
||||||
// Draw the pixmap in the middle of the rectangle
|
// Draw the pixmap in the middle of the rectangle
|
||||||
QRect draw_rect(QPoint(0, 0), option_copy.decorationSize / device_pixel_ratio);
|
QRect draw_rect(QPoint(0, 0), option_copy.decorationSize);
|
||||||
draw_rect.moveCenter(option_copy.rect.center());
|
draw_rect.moveCenter(option_copy.rect.center());
|
||||||
|
|
||||||
painter->drawPixmap(draw_rect, pixmap);
|
painter->drawPixmap(draw_rect, pixmap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class SongSourceDelegate : public PlaylistDelegateBase {
|
|||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap LookupPixmap(const Song::Source source, const QSize size) const;
|
QPixmap LookupPixmap(const Song::Source source, const QSize size, const qreal device_pixel_ratio) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RatingItemDelegate : public PlaylistDelegateBase {
|
class RatingItemDelegate : public PlaylistDelegateBase {
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ QImage ImageUtils::ScaleAndPad(const QImage &image, const bool scale, const bool
|
|||||||
image_scaled = image_padded;
|
image_scaled = image_padded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image_scaled.setDevicePixelRatio(device_pixel_ratio);
|
||||||
|
|
||||||
return image_scaled;
|
return image_scaled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class ImageUtils {
|
|||||||
static QByteArray SaveImageToJpegData(const QImage &image = QImage());
|
static QByteArray SaveImageToJpegData(const QImage &image = QImage());
|
||||||
static QByteArray FileToJpegData(const QString &filename);
|
static QByteArray FileToJpegData(const QString &filename);
|
||||||
static QPixmap TryLoadPixmap(const QUrl &automatic, const QUrl &manual, const QUrl &url = QUrl());
|
static QPixmap TryLoadPixmap(const QUrl &automatic, const QUrl &manual, const QUrl &url = QUrl());
|
||||||
static QImage ScaleAndPad(const QImage &image, const bool scale, const bool pad, const int desired_height, const qreal device_pixel_ratio = 1.0f);
|
static QImage ScaleAndPad(const QImage &image, const bool scale, const bool pad, const int desired_height, const qreal device_pixel_ratio = 1.0F);
|
||||||
static QImage CreateThumbnail(const QImage &image, const bool pad, const QSize size);
|
static QImage CreateThumbnail(const QImage &image, const bool pad, const QSize size);
|
||||||
static QImage GenerateNoCoverImage(const QSize size = QSize());
|
static QImage GenerateNoCoverImage(const QSize size = QSize());
|
||||||
|
|
||||||
|
|||||||
@@ -303,9 +303,16 @@ void PlayingWidget::SetImage(const QImage &image) {
|
|||||||
|
|
||||||
if (enabled_ && visible_ && active_) {
|
if (enabled_ && visible_ && active_) {
|
||||||
// Cache the current pixmap so we can fade between them
|
// Cache the current pixmap so we can fade between them
|
||||||
QSize psize(size());
|
QSize psize;
|
||||||
if (size().height() <= 0) psize.setHeight(total_height_);
|
psize.setWidth(size().width() * devicePixelRatioF());
|
||||||
|
if (size().height() > 0) {
|
||||||
|
psize.setHeight(size().height() * devicePixelRatioF());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
psize.setHeight(total_height_ * devicePixelRatioF());
|
||||||
|
}
|
||||||
pixmap_previous_track_ = QPixmap(psize);
|
pixmap_previous_track_ = QPixmap(psize);
|
||||||
|
pixmap_previous_track_.setDevicePixelRatio(devicePixelRatioF());
|
||||||
pixmap_previous_track_.fill(palette().window().color());
|
pixmap_previous_track_.fill(palette().window().color());
|
||||||
pixmap_previous_track_opacity_ = 1.0;
|
pixmap_previous_track_opacity_ = 1.0;
|
||||||
QPainter p(&pixmap_previous_track_);
|
QPainter p(&pixmap_previous_track_);
|
||||||
|
|||||||
Reference in New Issue
Block a user