mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 11:38:49 -07:00
[WIP] Card image loading: Fallback on 404 (#3367)
* 2479: Running clang-format Reformatting files to be in line with style guidelines. * 2479: Updates to remove set/url indices This change removes set and Url indices in favor of check for empty lists and removing items from them instead. * 2479: TransformUrl will now error on missing fields If transformUrl is called with a template, and the card/set is missing something required by that template, it will now return an empty string, instead of the template with an empty string substituted in. * 2479: clang-format updates * 2479: Fixing omission of ! from two properties * 2479: Adding prefix on debug messages Adding PictureLoader: to the front of each debug message from this file, so that it can be more easily filtered out by grep in the log of a running application. * 2479: Remove outdated comment * 2479: Remove unused method from intermediate work * 2479: Updating QDebug messages to be more consistent * 2479: clang-format updates * 2479: Remove repeated code, replace with call to nextUrl This removes some redundant code that is better replaced with a call to nextUrl, in case the code needed to populate the nextUrl changes significantly. * 2479: Adding more detailed comments * 2479: Refactor transformUrl Refactor transformUrl to do everything in a single loop instead of two almost identical loops. set information is populated if present, but is added with empty strings if absent.
This commit is contained in:
parent
e341337ce0
commit
ed01752cb4
2 changed files with 175 additions and 85 deletions
|
|
@ -18,7 +18,10 @@ private:
|
|||
|
||||
CardInfoPtr card;
|
||||
QList<CardSetPtr> sortedSets;
|
||||
int setIndex;
|
||||
QList<QString> urlTemplates;
|
||||
QList<QString> currentSetUrls;
|
||||
QString currentUrl;
|
||||
CardSetPtr currentSet;
|
||||
|
||||
public:
|
||||
PictureToLoad(CardInfoPtr _card = CardInfoPtr());
|
||||
|
|
@ -30,9 +33,19 @@ public:
|
|||
{
|
||||
card.clear();
|
||||
}
|
||||
CardSetPtr getCurrentSet() const;
|
||||
QString getCurrentUrl() const
|
||||
{
|
||||
return currentUrl;
|
||||
}
|
||||
CardSetPtr getCurrentSet() const
|
||||
{
|
||||
return currentSet;
|
||||
}
|
||||
QString getSetName() const;
|
||||
QString transformUrl(QString urlTemplate) const;
|
||||
bool nextSet();
|
||||
bool nextUrl();
|
||||
void populateSetUrls();
|
||||
};
|
||||
|
||||
class PictureLoaderWorker : public QObject
|
||||
|
|
@ -57,7 +70,6 @@ private:
|
|||
PictureToLoad cardBeingDownloaded;
|
||||
bool picDownload, downloadRunning, loadQueueRunning;
|
||||
void startNextPicDownload();
|
||||
QString getPicUrl();
|
||||
bool cardImageExistsOnDisk(QString &setName, QString &correctedCardname);
|
||||
bool imageIsBlackListed(const QByteArray &picData);
|
||||
private slots:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue