When loading covers, if we fail to find one of the standard names

(cover.jpg/png, AlbumArt.jpg/png, folder.jpg/png), then use the first image found.
This commit is contained in:
craig
2012-03-20 22:28:23 +00:00
parent 199ec0805c
commit 7e9a8e10fe
2 changed files with 12 additions and 0 deletions

View File

@@ -33,6 +33,9 @@
9. Allocate more space for tab if required - up to a max of 50% extra. This
fixes "HTTP Server" config page title under Ubuntu with Qt-only build.
10. Install icon for Qt-only build.
11. When loading covers, if we fail to find one of the standard names
(cover.jpg/png, AlbumArt.jpg/png, folder.jpg/png), then use the first image
found.
0.5.0
-----

View File

@@ -373,6 +373,15 @@ Covers::Image Covers::getImage(const Song &song, bool isSingleTracks)
}
}
}
QStringList files=QDir(dirName).entryList(QStringList() << QLatin1String("*.jpg") << QLatin1String("*.png"), QDir::Files|QDir::Readable);
foreach (const QString &fileName, files) {
QImage img(fileName);
if (!img.isNull()) {
return Image(img, fileName);
}
}
}
QString artist=encodeName(song.albumArtist());