mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
Refactor: Add PrintingInfo::getUuid (#6046)
This commit is contained in:
parent
4fd2f1f974
commit
ae47ee802b
14 changed files with 37 additions and 30 deletions
|
|
@ -340,7 +340,7 @@ PrintingInfo CardDatabase::findPrintingWithId(const CardInfoPtr &cardInfo, const
|
|||
{
|
||||
for (const auto &printings : cardInfo->getSets()) {
|
||||
for (const auto &printing : printings) {
|
||||
if (printing.getProperty("uuid") == providerId) {
|
||||
if (printing.getUuid() == providerId) {
|
||||
return printing;
|
||||
}
|
||||
}
|
||||
|
|
@ -432,7 +432,7 @@ PrintingInfo CardDatabase::getSpecificPrinting(const QString &cardName,
|
|||
QString CardDatabase::getPreferredPrintingProviderId(const QString &cardName) const
|
||||
{
|
||||
PrintingInfo preferredPrinting = getPreferredPrinting(cardName);
|
||||
QString uuid = preferredPrinting.getProperty("uuid");
|
||||
QString uuid = preferredPrinting.getUuid();
|
||||
if (!uuid.isEmpty()) {
|
||||
return uuid;
|
||||
}
|
||||
|
|
@ -462,7 +462,7 @@ PrintingInfo CardDatabase::getSetInfoForCard(const CardInfoPtr &_card)
|
|||
|
||||
for (const auto &printings : setMap) {
|
||||
for (const auto &cardInfoForSet : printings) {
|
||||
if (QLatin1String("card_") + _card->getName() + QString("_") + cardInfoForSet.getProperty("uuid") ==
|
||||
if (QLatin1String("card_") + _card->getName() + QString("_") + cardInfoForSet.getUuid() ==
|
||||
_card->getPixmapCacheKey()) {
|
||||
return cardInfoForSet;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,14 @@ PrintingInfo::PrintingInfo(const CardSetPtr &_set) : set(_set)
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the uuid property of the printing, or an empty string if the property isn't present
|
||||
*/
|
||||
QString PrintingInfo::getUuid() const
|
||||
{
|
||||
return properties.value("uuid").toString();
|
||||
}
|
||||
|
||||
CardInfo::CardInfo(const QString &_name,
|
||||
const QString &_text,
|
||||
bool _isToken,
|
||||
|
|
|
|||
|
|
@ -178,6 +178,8 @@ public:
|
|||
{
|
||||
properties.insert(_name, _value);
|
||||
}
|
||||
|
||||
QString getUuid() const;
|
||||
};
|
||||
|
||||
class CardInfo : public QObject
|
||||
|
|
|
|||
|
|
@ -4105,7 +4105,7 @@ void Player::addRelatedCardView(const CardItem *card, QMenu *cardMenu)
|
|||
QString relatedCardName = relatedCard->getName();
|
||||
QAction *viewCard = viewRelatedCards->addAction(relatedCardName);
|
||||
connect(viewCard, &QAction::triggered, game, [this, relatedCardName, currentCardSet] {
|
||||
game->viewCardInfo({relatedCardName, currentCardSet.getProperty("uuid")});
|
||||
game->viewCardInfo({relatedCardName, currentCardSet.getUuid()});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -4132,7 +4132,7 @@ void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu)
|
|||
QAction *createRelatedCards = nullptr;
|
||||
for (const CardRelation *cardRelation : relatedCards) {
|
||||
CardInfoPtr relatedCard =
|
||||
CardDatabaseManager::getInstance()->getCard({cardRelation->getName(), currentCardSet.getProperty("uuid")});
|
||||
CardDatabaseManager::getInstance()->getCard({cardRelation->getName(), currentCardSet.getUuid()});
|
||||
if (relatedCard == nullptr) {
|
||||
relatedCard = CardDatabaseManager::getInstance()->getCardInfo(cardRelation->getName());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue