Skip to content

Commit

Permalink
Fix cover download.
Browse files Browse the repository at this point in the history
Ensure that the cache directory for covers
exists.

Also, properly reload the artist image in artist
list when a cover is associated to an artist.

Rewrite the text position on cover with a direct
calculation of the Y position, the anchors solution
with alternating undefined values seems not to work
properly, when a cover is associated to an artist
for instance.
  • Loading branch information
dcaliste committed Dec 7, 2023
1 parent 73359fa commit 869a3b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions qml/pages/CoverArtList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ BackgroundItem
Connections {
target: coversearch
onImageChanged: {
if ((artist===dartist && album==dalbum) || (album===dartist && album==dalbum)) {
if ((artist===dartist && album==dalbum)
|| (album===dartist && album==dalbum)
|| (album===dartist && !dalbum)) {
console.log("Updated: " + artist + " - " + album)
reload()
}
Expand Down Expand Up @@ -113,9 +115,9 @@ BackgroundItem

Label {
id: vtext
anchors.verticalCenter: coverImg.status!=Image.Error && textvisible? undefined : parent.verticalCenter
anchors.bottom: coverImg.status!=Image.Error && textvisible? parent.bottom : undefined
anchors.bottomMargin: coverImg.status!=Image.Error && textvisible? Theme.paddingSmall : undefined
y: coverImg.status!=Image.Error && textvisible
? parent.height - height - Theme.paddingSmall
: (parent.height - height) / 2
anchors.left: parent.left
anchors.leftMargin: Theme.paddingMedium
width: parent.width - Theme.paddingMedium*2
Expand Down
4 changes: 4 additions & 0 deletions src/coversearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

//#include <QDeclarativeView>
#include <QDebug>
#include <QDir>
#include <QString>
#include <QStringList>
#include <QJsonDocument>
Expand Down Expand Up @@ -39,6 +40,9 @@ CoverSearch::CoverSearchPrivate::CoverSearchPrivate(CoverSearch * parent) : q(pa
//q->pepe = new WebThread();
//connect (q->pepe, SIGNAL(imgLoaded(QString,int)), parent, SLOT(paintImg(QString,int)) );

// Ensure that download destination exists.
QDir d;
d.mkpath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
}

CoverSearch::CoverSearchPrivate::~CoverSearchPrivate()
Expand Down

0 comments on commit 869a3b6

Please sign in to comment.