From a36ca26410e88cd4e95050a6eeb8e146715013ce Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Sat, 7 Nov 2015 08:50:27 +0000 Subject: [PATCH] Clear context background if no image can be found - don't leave the previous artist showing! --- context/contextwidget.cpp | 26 ++++++++++++-------------- context/contextwidget.h | 5 +---- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/context/contextwidget.cpp b/context/contextwidget.cpp index 4108d2c3d..6a632fa33 100644 --- a/context/contextwidget.cpp +++ b/context/contextwidget.cpp @@ -257,9 +257,6 @@ ContextWidget::ContextWidget(QWidget *parent) , alwaysCollapsed(false) , backdropType(PlayQueueView::BI_Cover) , darkBackground(false) - , useFanArt(0!=constFanArtApiKey.latin1()) - , albumCoverBackdrop(false) - , oldIsAlbumCoverBackdrop(false) , fadeValue(1.0) , isWide(false) , stack(0) @@ -448,7 +445,7 @@ void ContextWidget::readConfig() break; case PlayQueueView::BI_Custom: if (origType!=backdropType || backdropOpacity!=origOpacity || backdropBlur!=origBlur || origCustomBackdropFile!=customBackdropFile) { - updateImage(QImage(customBackdropFile), false); + updateImage(QImage(customBackdropFile)); } break; } @@ -535,7 +532,7 @@ void ContextWidget::paintEvent(QPaintEvent *e) p.setOpacity(1.0-fadeValue); } #ifdef SCALE_CONTEXT_BGND - if (!oldIsAlbumCoverBackdrop && oldBackdrop.height()get(QUrl(url)); DBUG << url; connect(job, SIGNAL(finished()), this, SLOT(downloadResponse())); @@ -945,7 +944,6 @@ void ContextWidget::downloadResponse() } if (!img.isNull()) { - updateImage(img); bool saved=false; if (Settings::self()->storeBackdropsInMpdDir() && !currentSong.isVariousArtists() && @@ -982,14 +980,14 @@ void ContextWidget::downloadResponse() f.close(); } } - QWidget::update(); } + updateImage(img); } void ContextWidget::resizeBackdrop() { #ifdef SCALE_CONTEXT_BGND - if (!albumCoverBackdrop && !currentImage.isNull() &&( currentBackdrop.isNull() || (!currentBackdrop.isNull() && currentBackdrop.width()!=width()))) { + if (!currentImage.isNull() &&( currentBackdrop.isNull() || (!currentBackdrop.isNull() && currentBackdrop.width()!=width()))) { QSize sz(width(), width()*currentImage.height()/currentImage.width()); currentBackdrop = QPixmap::fromImage(currentImage.scaled(sz, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)); } diff --git a/context/contextwidget.h b/context/contextwidget.h index 54fb75779..3aac4fb78 100644 --- a/context/contextwidget.h +++ b/context/contextwidget.h @@ -110,7 +110,7 @@ public: void paintEvent(QPaintEvent *e); float fade() { return fadeValue; } void setFade(float value); - void updateImage(QImage img, bool created=false); + void updateImage(QImage img); void search(); Q_SIGNALS: @@ -145,9 +145,6 @@ private: int backdropBlur; QString customBackdropFile; bool darkBackground; - bool useFanArt; - bool albumCoverBackdrop; - bool oldIsAlbumCoverBackdrop; Song currentSong; #ifdef SCALE_CONTEXT_BGND QImage currentImage;