From ae456a5bc349d61260f9ed9ab2d6ff9af7dff412 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 19 Aug 2016 10:11:39 +0200 Subject: [PATCH] Renamed !setnumber! to !collectornumber! --- cockatrice/src/carddatabase.cpp | 14 +++++++------- cockatrice/src/carddatabase.h | 8 ++++---- cockatrice/src/pictureloader.cpp | 5 ++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 3288b944..8e250e1b 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -185,7 +185,7 @@ CardInfo::CardInfo(const QString &_name, const SetList &_sets, const QStringMap &_customPicURLs, MuidMap _muIds, - QStringMap _setNumbers, + QStringMap _collectorNumbers, QStringMap _rarities ) : name(_name), @@ -204,7 +204,7 @@ CardInfo::CardInfo(const QString &_name, loyalty(_loyalty), customPicURLs(_customPicURLs), muIds(_muIds), - setNumbers(_setNumbers), + collectorNumbers(_collectorNumbers), rarities(_rarities), cipt(_cipt), tableRow(_tableRow) @@ -333,9 +333,9 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info) xml.writeAttribute("rarity", info->getRarity(tmpSet)); xml.writeAttribute("muId", QString::number(info->getMuId(tmpSet))); - tmpString = info->getSetNumber(tmpSet); + tmpString = info->getCollectorNumber(tmpSet); if(!tmpString.isEmpty()) - xml.writeAttribute("num", info->getSetNumber(tmpSet)); + xml.writeAttribute("num", info->getCollectorNumber(tmpSet)); tmpString = info->getCustomPicURL(tmpSet); if(!tmpString.isEmpty()) @@ -508,7 +508,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml) QStringList colors, relatedCards, reverseRelatedCards; QStringMap customPicURLs; MuidMap muids; - QStringMap setNumbers, rarities; + QStringMap collectorNumbers, rarities; SetList sets; int tableRow = 0; int loyalty = 0; @@ -541,7 +541,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml) customPicURLs[setName] = attrs.value("picURL").toString(); } if (attrs.hasAttribute("num")) { - setNumbers[setName] = attrs.value("num").toString(); + collectorNumbers[setName] = attrs.value("num").toString(); } if (attrs.hasAttribute("rarity")) { rarities[setName] = attrs.value("rarity").toString(); @@ -568,7 +568,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml) } } - addCard(new CardInfo(name, isToken, manacost, cmc, type, pt, text, colors, relatedCards, reverseRelatedCards, upsideDown, loyalty, cipt, tableRow, sets, customPicURLs, muids, setNumbers, rarities)); + addCard(new CardInfo(name, isToken, manacost, cmc, type, pt, text, colors, relatedCards, reverseRelatedCards, upsideDown, loyalty, cipt, tableRow, sets, customPicURLs, muids, collectorNumbers, rarities)); } } } diff --git a/cockatrice/src/carddatabase.h b/cockatrice/src/carddatabase.h index cf8912ff..ced9f71a 100644 --- a/cockatrice/src/carddatabase.h +++ b/cockatrice/src/carddatabase.h @@ -88,7 +88,7 @@ private: int loyalty; QStringMap customPicURLs; MuidMap muIds; - QStringMap setNumbers; + QStringMap collectorNumbers; QStringMap rarities; bool cipt; int tableRow; @@ -111,7 +111,7 @@ public: const SetList &_sets = SetList(), const QStringMap &_customPicURLs = QStringMap(), MuidMap muids = MuidMap(), - QStringMap _setNumbers = QStringMap(), + QStringMap _collectorNumbers = QStringMap(), QStringMap _rarities = QStringMap() ); ~CardInfo(); @@ -144,7 +144,7 @@ public: bool getUpsideDownArt() const { return upsideDownArt; } QString getCustomPicURL(const QString &set) const { return customPicURLs.value(set); } int getMuId(const QString &set) const { return muIds.value(set); } - QString getSetNumber(const QString &set) const { return setNumbers.value(set); } + QString getCollectorNumber(const QString &set) const { return collectorNumbers.value(set); } QString getRarity(const QString &set) const { return rarities.value(set); } QStringMap getRarities() const { return rarities; } QString getMainCardType() const; @@ -154,7 +154,7 @@ public: void setLoyalty(int _loyalty) { loyalty = _loyalty; emit cardInfoChanged(this); } void setCustomPicURL(const QString &_set, const QString &_customPicURL) { customPicURLs.insert(_set, _customPicURL); } void setMuId(const QString &_set, const int &_muId) { muIds.insert(_set, _muId); } - void setSetNumber(const QString &_set, const QString &_setNumber) { setNumbers.insert(_set, _setNumber); } + void setSetNumber(const QString &_set, const QString &_setNumber) { collectorNumbers.insert(_set, _setNumber); } void setRarity(const QString &_set, const QString &_setNumber) { rarities.insert(_set, _setNumber); } void addToSet(CardSet *set); void emitPixmapUpdated() { emit pixmapUpdated(); } diff --git a/cockatrice/src/pictureloader.cpp b/cockatrice/src/pictureloader.cpp index 28bd0a3f..ee4b29da 100644 --- a/cockatrice/src/pictureloader.cpp +++ b/cockatrice/src/pictureloader.cpp @@ -220,7 +220,10 @@ QString PictureLoaderWorker::getPicUrl() picUrl.replace("!cardid!", QUrl::toPercentEncoding(QString::number(muid))); if (set) { - picUrl.replace("!setnumber!", QUrl::toPercentEncoding(card->getSetNumber(set->getShortName()))); + // renamed from !setnumber! to !collectornumber! on 20160819. Remove the old one when convenient. + picUrl.replace("!setnumber!", QUrl::toPercentEncoding(card->getCollectorNumber(set->getShortName()))); + picUrl.replace("!collectornumber!", QUrl::toPercentEncoding(card->getCollectorNumber(set->getShortName()))); + picUrl.replace("!setcode!", QUrl::toPercentEncoding(set->getShortName())); picUrl.replace("!setcode_lower!", QUrl::toPercentEncoding(set->getShortName().toLower())); picUrl.replace("!setname!", QUrl::toPercentEncoding(set->getLongName()));