Introduce null checks, add setShortName and collectorNumber to deckList export. (#5471)

* Introduce null checks, add setShortName and collectorNumber to deckList export.

* Lint.

* Lint again.

* Lint AGAIN.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-01-14 16:54:15 +01:00 committed by GitHub
parent c079715c46
commit a717e715b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -254,6 +254,14 @@ struct FormatDeckListForExport
mainBoardCards += QString::number(card->getNumber());
mainBoardCards += "%20";
mainBoardCards += card->getName();
if (!card->getCardSetShortName().isNull()) {
mainBoardCards += "%20";
mainBoardCards += "(" + card->getCardSetShortName() + ")";
}
if (!card->getCardCollectorNumber().isNull()) {
mainBoardCards += "%20";
mainBoardCards += card->getCardCollectorNumber();
}
mainBoardCards += "%0A";
}
}
@ -419,7 +427,20 @@ void DeckLoader::saveToStream_DeckZoneCards(QTextStream &out,
out << "SB: ";
}
out << card->getNumber() << " " << card->getName() << "\n";
if (card->getNumber()) {
out << card->getNumber();
}
if (!card->getName().isNull() && !card->getName().isEmpty()) {
out << " " << card->getName();
}
if (!card->getCardSetShortName().isNull() && !card->getCardSetShortName().isEmpty()) {
out << " "
<< "(" << card->getCardSetShortName() << ")";
}
if (!card->getCardCollectorNumber().isNull()) {
out << " " << card->getCardCollectorNumber();
}
out << "\n";
}
}