mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 08:24:39 -07:00
[Card] Pass localized card names and texts into CardInfo construction
Address review: instead of constructing the card and then calling setLocalizedName/setLocalizedText (which emit a cardInfoChanged signal per language), both constructors, both newInstance overloads and their callers (cards.xml v4 parser and the binary cache reader) now pass the localized maps as constructor arguments.
This commit is contained in:
parent
8bb2337117
commit
c35aff8b7f
4 changed files with 44 additions and 29 deletions
|
|
@ -40,8 +40,11 @@ CardInfo::CardInfo(const QString &_name,
|
|||
const QList<CardRelation *> &_relatedCards,
|
||||
const QList<CardRelation *> &_reverseRelatedCards,
|
||||
SetToPrintingsMap _sets,
|
||||
const UiAttributes _uiAttributes)
|
||||
: name(_name), text(_text), isToken(_isToken), properties(LazyPropertiesHash(_properties)),
|
||||
const UiAttributes _uiAttributes,
|
||||
QMap<QString, QString> _localizedNames,
|
||||
QMap<QString, QString> _localizedTexts)
|
||||
: name(_name), text(_text), isToken(_isToken), localizedNames(std::move(_localizedNames)),
|
||||
localizedTexts(std::move(_localizedTexts)), properties(LazyPropertiesHash(_properties)),
|
||||
relatedCards(_relatedCards), reverseRelatedCards(_reverseRelatedCards), setsToPrintings(std::move(_sets)),
|
||||
uiAttributes(_uiAttributes)
|
||||
{
|
||||
|
|
@ -59,8 +62,11 @@ CardInfo::CardInfo(const QString &_name,
|
|||
SetToPrintingsMap _sets,
|
||||
const UiAttributes _uiAttributes,
|
||||
QString _simpleName,
|
||||
QSet<QString> _altNames)
|
||||
QSet<QString> _altNames,
|
||||
QMap<QString, QString> _localizedNames,
|
||||
QMap<QString, QString> _localizedTexts)
|
||||
: name(_name), simpleName(std::move(_simpleName)), text(_text), isToken(_isToken),
|
||||
localizedNames(std::move(_localizedNames)), localizedTexts(std::move(_localizedTexts)),
|
||||
properties(LazyPropertiesHash(_propertiesBlob)), relatedCards(_relatedCards),
|
||||
reverseRelatedCards(_reverseRelatedCards), setsToPrintings(std::move(_sets)), uiAttributes(_uiAttributes),
|
||||
altNames(std::move(_altNames))
|
||||
|
|
@ -83,10 +89,12 @@ CardInfoPtr CardInfo::newInstance(const QString &_name,
|
|||
const QList<CardRelation *> &_relatedCards,
|
||||
const QList<CardRelation *> &_reverseRelatedCards,
|
||||
SetToPrintingsMap _sets,
|
||||
const UiAttributes _uiAttributes)
|
||||
const UiAttributes _uiAttributes,
|
||||
QMap<QString, QString> _localizedNames,
|
||||
QMap<QString, QString> _localizedTexts)
|
||||
{
|
||||
CardInfoPtr ptr(
|
||||
new CardInfo(_name, _text, _isToken, _properties, _relatedCards, _reverseRelatedCards, _sets, _uiAttributes));
|
||||
CardInfoPtr ptr(new CardInfo(_name, _text, _isToken, _properties, _relatedCards, _reverseRelatedCards, _sets,
|
||||
_uiAttributes, std::move(_localizedNames), std::move(_localizedTexts)));
|
||||
ptr->setSmartPointer(ptr);
|
||||
|
||||
for (const auto &printings : _sets) {
|
||||
|
|
@ -109,11 +117,13 @@ CardInfoPtr CardInfo::newInstance(const QString &_name,
|
|||
const UiAttributes _uiAttributes,
|
||||
QString _simpleName,
|
||||
QSet<QString> _altNames,
|
||||
bool _appendToSets)
|
||||
bool _appendToSets,
|
||||
QMap<QString, QString> _localizedNames,
|
||||
QMap<QString, QString> _localizedTexts)
|
||||
{
|
||||
CardInfoPtr ptr(new CardInfo(_name, _text, _isToken, std::move(_propertiesBlob), _relatedCards,
|
||||
_reverseRelatedCards, _sets, _uiAttributes, std::move(_simpleName),
|
||||
std::move(_altNames)));
|
||||
std::move(_altNames), std::move(_localizedNames), std::move(_localizedTexts)));
|
||||
ptr->setSmartPointer(ptr);
|
||||
|
||||
if (_appendToSets) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue