Compare commits

..

11 Commits

Author SHA1 Message Date
Jonas Kvinge
e2f5486987 Release 1.0.17 2023-03-29 18:54:51 +02:00
Jonas Kvinge
b0d390aaf1 Update Changelog 2023-03-29 18:49:35 +02:00
Jonas Kvinge
bae1b42394 OSDPretty: Respect device pixel ratio 2023-03-29 18:23:06 +02:00
Jonas Kvinge
a2533edd57 PlayingWidget: Make previous pixmap respect device pixel ratio 2023-03-29 00:24:38 +02:00
Jonas Kvinge
7b88c198fe SongSourceDelegate: Fix compile with Qt 5 2023-03-29 00:14:21 +02:00
Jonas Kvinge
c49cb0c119 ImageUtils: Formatting 2023-03-29 00:09:40 +02:00
Jonas Kvinge
03aabeb848 AlbumCoverManager: Respect device pixel ratio 2023-03-29 00:06:56 +02:00
Jonas Kvinge
1d3a837f7a SongSourceDelegate: Respect device pixel ratio 2023-03-29 00:04:34 +02:00
Jonas Kvinge
92adc18b8f ContextAlbum: Make size hint respect device pixel ratio 2023-03-28 18:21:19 +02:00
Fletcher Dostie
e4697c8ff1 Render context art at correct size 2023-03-28 17:54:56 +02:00
Jonas Kvinge
b741f1a580 Turn on git revision 2023-03-28 01:48:09 +02:00
10 changed files with 38 additions and 22 deletions

View File

@@ -2,6 +2,13 @@ Strawberry Music Player
=======================
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):
Bugfixes:

View File

@@ -1,6 +1,6 @@
set(STRAWBERRY_VERSION_MAJOR 1)
set(STRAWBERRY_VERSION_MINOR 0)
set(STRAWBERRY_VERSION_PATCH 16)
set(STRAWBERRY_VERSION_PATCH 17)
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
set(INCLUDE_GIT_REVISION OFF)

View File

@@ -91,7 +91,7 @@ void ContextAlbum::Init(ContextView *context_view, AlbumCoverChoiceController *a
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;
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);
}

View File

@@ -112,7 +112,7 @@ AlbumCoverManager::AlbumCoverManager(Application *app, CollectionBackend *collec
cover_exporter_(new AlbumCoverExporter(this)),
artist_icon_(IconLoader::Load("folder-sound")),
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_)),
context_menu_(new QMenu(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_.pad_output_image_ = true;
cover_loader_options_.desired_height_ = 120;
cover_loader_options_.desired_height_ = 120 * devicePixelRatio();
cover_loader_options_.create_thumbnail_ = false;
EnableCoversButtons();

View File

@@ -343,7 +343,8 @@ void OSDPretty::paintEvent(QPaintEvent*) {
void OSDPretty::SetMessage(const QString &summary, const QString &message, const QImage &image) {
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->show();
}

View File

@@ -471,17 +471,21 @@ QString SongSourceDelegate::displayText(const QVariant &value, const QLocale&) c
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;
QString cache_key = QString("%1-%2x%3").arg(Song::TextForSource(source)).arg(size.width()).arg(size.height());
if (QPixmapCache::find(cache_key, &pixmap)) {
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(pixmap_cache_key, &pixmap)) {
return pixmap;
}
QIcon icon(Song::IconForSource(source));
pixmap = icon.pixmap(size.height());
QPixmapCache::insert(cache_key, pixmap);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
pixmap = icon.pixmap(size, device_pixel_ratio);
#else
pixmap = icon.pixmap(size);
#endif
QPixmapCache::insert(pixmap_cache_key, pixmap);
return pixmap;
@@ -495,16 +499,11 @@ void SongSourceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
QStyleOptionViewItem option_copy(option);
initStyleOption(&option_copy, idx);
const Song::Source source = static_cast<Song::Source>(idx.data().toInt());
QPixmap pixmap = LookupPixmap(source, option_copy.decorationSize);
QWidget *parent_widget = qobject_cast<QWidget*>(parent());
qreal device_pixel_ratio = parent_widget->devicePixelRatio();
const QPixmap pixmap = LookupPixmap(idx.data().value<Song::Source>(), option_copy.decorationSize, qobject_cast<QWidget*>(parent())->devicePixelRatioF());
// 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());
painter->drawPixmap(draw_rect, pixmap);
}

View File

@@ -201,7 +201,7 @@ class SongSourceDelegate : public PlaylistDelegateBase {
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override;
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 {

View File

@@ -165,6 +165,8 @@ QImage ImageUtils::ScaleAndPad(const QImage &image, const bool scale, const bool
image_scaled = image_padded;
}
image_scaled.setDevicePixelRatio(device_pixel_ratio);
return image_scaled;
}

View File

@@ -41,7 +41,7 @@ class ImageUtils {
static QByteArray SaveImageToJpegData(const QImage &image = QImage());
static QByteArray FileToJpegData(const QString &filename);
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 GenerateNoCoverImage(const QSize size = QSize());

View File

@@ -303,9 +303,16 @@ void PlayingWidget::SetImage(const QImage &image) {
if (enabled_ && visible_ && active_) {
// Cache the current pixmap so we can fade between them
QSize psize(size());
if (size().height() <= 0) psize.setHeight(total_height_);
QSize psize;
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_.setDevicePixelRatio(devicePixelRatioF());
pixmap_previous_track_.fill(palette().window().color());
pixmap_previous_track_opacity_ = 1.0;
QPainter p(&pixmap_previous_track_);