Recursively search CUSTOM folder for images (i.e. subdirectories) (#2251)

This commit is contained in:
Zach H 2016-12-08 05:00:44 -05:00 committed by ctrlaltca
parent c9a8dafd01
commit e0636db60d

View file

@ -19,6 +19,7 @@
#include <QSvgRenderer> #include <QSvgRenderer>
#include <QThread> #include <QThread>
#include <QUrl> #include <QUrl>
#include <QDirIterator>
// never cache more than 300 cards at once for a single deck // never cache more than 300 cards at once for a single deck
#define CACHED_CARD_PER_DECK_MAX 300 #define CACHED_CARD_PER_DECK_MAX 300
@ -167,9 +168,18 @@ bool PictureLoaderWorker::cardImageExistsOnDisk(QString & setName, QString & cor
QImage image; QImage image;
QImageReader imgReader; QImageReader imgReader;
imgReader.setDecideFormatFromContent(true); imgReader.setDecideFormatFromContent(true);
QList<QString> picsPaths = QList<QString>();
QDirIterator it(customPicsPath, QDirIterator::Subdirectories);
//The list of paths to the folders in which to search for images // Recursively check all subdirectories of the CUSTOM folder
QList<QString> picsPaths = QList<QString>() << customPicsPath + correctedCardname; while (it.hasNext())
{
QString thisPath(it.next());
QFileInfo thisFileInfo(thisPath);
if (thisFileInfo.isFile() && thisFileInfo.baseName() == correctedCardname)
picsPaths << thisPath; // Card found in the CUSTOM directory, somewhere
}
if(!setName.isEmpty()) if(!setName.isEmpty())
{ {