Merge pull request #280 from pliu037/remove-.full-req
Support images without .full suffix
This commit is contained in:
commit
b32aeb2211
2 changed files with 17 additions and 17 deletions
|
@ -76,8 +76,8 @@ void SetList::sortByKey()
|
|||
qSort(begin(), end(), CompareFunctor());
|
||||
}
|
||||
|
||||
PictureToLoad::PictureToLoad(CardInfo *_card, bool _stripped, bool _hq)
|
||||
: card(_card), stripped(_stripped), setIndex(0), hq(_hq)
|
||||
PictureToLoad::PictureToLoad(CardInfo *_card, bool _hq)
|
||||
: card(_card), setIndex(0), hq(_hq)
|
||||
{
|
||||
if (card) {
|
||||
sortedSets = card->getSets();
|
||||
|
@ -135,14 +135,14 @@ void PictureLoader::processLoadQueue()
|
|||
mutex.unlock();
|
||||
|
||||
//The list of paths to the folders in which to search for images
|
||||
QList<QString> picsPaths = QList<QString>() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName() + ".full";
|
||||
QList<QString> picsPaths = QList<QString>() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName();
|
||||
|
||||
|
||||
QString setName=ptl.getSetName();
|
||||
if(!setName.isEmpty())
|
||||
{
|
||||
picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full"
|
||||
<< _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full";
|
||||
picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName()
|
||||
<< _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName();
|
||||
}
|
||||
|
||||
QImage image;
|
||||
|
@ -153,6 +153,12 @@ void PictureLoader::processLoadQueue()
|
|||
//Iterates through the list of paths, searching for images with the desired name with any QImageReader-supported extension
|
||||
for (int i = 0; i < picsPaths.length() && !found; i ++) {
|
||||
imgReader.setFileName(picsPaths.at(i));
|
||||
if (imgReader.read(&image)) {
|
||||
emit imageLoaded(ptl.getCard(), image);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
imgReader.setFileName(picsPaths.at(i) + ".full");
|
||||
if (imgReader.read(&image)) {
|
||||
emit imageLoaded(ptl.getCard(), image);
|
||||
found = true;
|
||||
|
@ -274,11 +280,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
|
|||
return;
|
||||
}
|
||||
|
||||
QString suffix;
|
||||
if (!cardBeingDownloaded.getStripped())
|
||||
suffix = ".full";
|
||||
|
||||
QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension);
|
||||
QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + extension);
|
||||
if (!newPic.open(QIODevice::WriteOnly))
|
||||
return;
|
||||
newPic.write(picData);
|
||||
|
@ -306,11 +308,11 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
|
|||
startNextPicDownload();
|
||||
}
|
||||
|
||||
void PictureLoader::loadImage(CardInfo *card, bool stripped)
|
||||
void PictureLoader::loadImage(CardInfo *card)
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
loadQueue.append(PictureToLoad(card, stripped));
|
||||
loadQueue.append(PictureToLoad(card));
|
||||
emit startLoadQueue();
|
||||
}
|
||||
|
||||
|
@ -936,7 +938,7 @@ void CardDatabase::cacheCardPixmaps(const QStringList &cardNames)
|
|||
|
||||
void CardDatabase::loadImage(CardInfo *card)
|
||||
{
|
||||
pictureLoader->loadImage(card, false);
|
||||
pictureLoader->loadImage(card);
|
||||
}
|
||||
|
||||
void CardDatabase::imageLoaded(CardInfo *card, QImage image)
|
||||
|
|
|
@ -47,14 +47,12 @@ public:
|
|||
class PictureToLoad {
|
||||
private:
|
||||
CardInfo *card;
|
||||
bool stripped;
|
||||
SetList sortedSets;
|
||||
int setIndex;
|
||||
bool hq;
|
||||
public:
|
||||
PictureToLoad(CardInfo *_card = 0, bool _stripped = false, bool _hq = true);
|
||||
PictureToLoad(CardInfo *_card = 0, bool _hq = true);
|
||||
CardInfo *getCard() const { return card; }
|
||||
bool getStripped() const { return stripped; }
|
||||
QString getSetName() const;
|
||||
bool nextSet();
|
||||
bool getHq() const { return hq; }
|
||||
|
@ -79,7 +77,7 @@ public:
|
|||
void setPicsPath(const QString &path);
|
||||
void setPicDownload(bool _picDownload);
|
||||
void setPicDownloadHq(bool _picDownloadHq);
|
||||
void loadImage(CardInfo *card, bool stripped);
|
||||
void loadImage(CardInfo *card);
|
||||
private slots:
|
||||
void picDownloadFinished(QNetworkReply *reply);
|
||||
public slots:
|
||||
|
|
Loading…
Reference in a new issue