cleanup
This commit is contained in:
parent
ae6803f9f2
commit
912c0bcdbf
2 changed files with 15 additions and 22 deletions
|
@ -86,7 +86,7 @@ CardInfo *OracleImporter::addCard(QString cardName, const QString &cardCost, con
|
||||||
colors << "G";
|
colors << "G";
|
||||||
|
|
||||||
card = new CardInfo(this, cardName, cardCost, cardType, cardPT, fullCardText, colors);
|
card = new CardInfo(this, cardName, cardCost, cardType, cardPT, fullCardText, colors);
|
||||||
card->setPicURL(getURLFromName(normalizeName(cardName)));
|
card->setPicURL(getURLFromName(cardName));
|
||||||
int tableRow = 1;
|
int tableRow = 1;
|
||||||
QString mainCardType = card->getMainCardType();
|
QString mainCardType = card->getMainCardType();
|
||||||
if ((mainCardType == "Land") || mArtifact)
|
if ((mainCardType == "Land") || mArtifact)
|
||||||
|
@ -163,26 +163,20 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QByteArray &data)
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString OracleImporter::normalizeName(QString cardname)
|
QString OracleImporter::getURLFromName(QString name) const
|
||||||
{
|
{
|
||||||
QString normalized = cardname;
|
return pictureUrl.arg(
|
||||||
normalized.remove("'",Qt::CaseInsensitive);
|
name
|
||||||
normalized.remove("//",Qt::CaseInsensitive);
|
.remove('\'')
|
||||||
normalized.remove(",",Qt::CaseInsensitive);
|
.remove("//")
|
||||||
normalized.remove(":",Qt::CaseInsensitive);
|
.remove(',')
|
||||||
normalized.remove(".",Qt::CaseInsensitive);
|
.remove(':')
|
||||||
normalized.remove(QRegExp("\\(.*\\)"));
|
.remove('.')
|
||||||
normalized = normalized.trimmed();
|
.remove(QRegExp("\\(.*\\)"))
|
||||||
normalized = normalized.simplified();
|
.simplified()
|
||||||
normalized = normalized.replace(" ", "_");
|
.replace(' ', '_')
|
||||||
normalized = normalized.replace("-", "_");
|
.replace('-', '_')
|
||||||
return normalized;
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString OracleImporter::getURLFromName(QString normalizedName)
|
|
||||||
{
|
|
||||||
return pictureUrl.arg(normalizedName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OracleImporter::downloadNextFile()
|
void OracleImporter::downloadNextFile()
|
||||||
|
|
|
@ -27,8 +27,7 @@ private:
|
||||||
int reqId;
|
int reqId;
|
||||||
QBuffer *buffer;
|
QBuffer *buffer;
|
||||||
QHttp *http;
|
QHttp *http;
|
||||||
QString normalizeName(QString);
|
QString getURLFromName(QString name) const;
|
||||||
QString getURLFromName(QString);
|
|
||||||
|
|
||||||
CardInfo *addCard(QString cardName, const QString &cardCost, const QString &cardType, const QString &cardPT, const QStringList &cardText);
|
CardInfo *addCard(QString cardName, const QString &cardCost, const QString &cardType, const QString &cardPT, const QStringList &cardText);
|
||||||
private slots:
|
private slots:
|
||||||
|
|
Loading…
Reference in a new issue