This commit is contained in:
Max-Wilhelm Bruker 2009-10-13 01:24:01 +02:00
parent ae6803f9f2
commit 912c0bcdbf
2 changed files with 15 additions and 22 deletions

View file

@ -86,7 +86,7 @@ CardInfo *OracleImporter::addCard(QString cardName, const QString &cardCost, con
colors << "G";
card = new CardInfo(this, cardName, cardCost, cardType, cardPT, fullCardText, colors);
card->setPicURL(getURLFromName(normalizeName(cardName)));
card->setPicURL(getURLFromName(cardName));
int tableRow = 1;
QString mainCardType = card->getMainCardType();
if ((mainCardType == "Land") || mArtifact)
@ -163,26 +163,20 @@ int OracleImporter::importTextSpoiler(CardSet *set, const QByteArray &data)
return cards;
}
QString OracleImporter::normalizeName(QString cardname)
QString OracleImporter::getURLFromName(QString name) const
{
QString normalized = cardname;
normalized.remove("'",Qt::CaseInsensitive);
normalized.remove("//",Qt::CaseInsensitive);
normalized.remove(",",Qt::CaseInsensitive);
normalized.remove(":",Qt::CaseInsensitive);
normalized.remove(".",Qt::CaseInsensitive);
normalized.remove(QRegExp("\\(.*\\)"));
normalized = normalized.trimmed();
normalized = normalized.simplified();
normalized = normalized.replace(" ", "_");
normalized = normalized.replace("-", "_");
return normalized;
}
QString OracleImporter::getURLFromName(QString normalizedName)
{
return pictureUrl.arg(normalizedName);
return pictureUrl.arg(
name
.remove('\'')
.remove("//")
.remove(',')
.remove(':')
.remove('.')
.remove(QRegExp("\\(.*\\)"))
.simplified()
.replace(' ', '_')
.replace('-', '_')
);
}
void OracleImporter::downloadNextFile()

View file

@ -27,8 +27,7 @@ private:
int reqId;
QBuffer *buffer;
QHttp *http;
QString normalizeName(QString);
QString getURLFromName(QString);
QString getURLFromName(QString name) const;
CardInfo *addCard(QString cardName, const QString &cardCost, const QString &cardType, const QString &cardPT, const QStringList &cardText);
private slots: