Recursively search CUSTOM folder for images (i.e. subdirectories) (#2251)
This commit is contained in:
parent
c9a8dafd01
commit
e0636db60d
1 changed files with 12 additions and 2 deletions
|
@ -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())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue