mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 16:13: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
|
|
@ -130,7 +130,7 @@ void AbstractTabDeckEditor::actDecrementCardFromSideboard(CardInfoPtr info)
|
|||
|
||||
void AbstractTabDeckEditor::actSwapCard(CardInfoPtr info, QString zoneName)
|
||||
{
|
||||
QString providerId = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("uuid");
|
||||
QString providerId = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getUuid();
|
||||
QString collectorNumber = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("num");
|
||||
|
||||
QModelIndex foundCard = deckDockWidget->deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ QImage PictureLoaderLocal::tryLoad(const CardInfoPtr &toLoad) const
|
|||
if (setInstance.getSet()) {
|
||||
setName = setInstance.getSet()->getCorrectedShortName();
|
||||
collectorNumber = setInstance.getProperty("num");
|
||||
providerId = setInstance.getProperty("uuid");
|
||||
providerId = setInstance.getUuid();
|
||||
}
|
||||
|
||||
qCDebug(PictureLoaderLocalLog).nospace()
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ void DeckEditorDeckDockWidget::actDecrementCard(CardInfoPtr info, QString zoneNa
|
|||
if (info->getIsToken())
|
||||
zoneName = DECK_ZONE_TOKENS;
|
||||
|
||||
QString providerId = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("uuid");
|
||||
QString providerId = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getUuid();
|
||||
QString collectorNumber = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("num");
|
||||
|
||||
QModelIndex idx = deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber);
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ void CardAmountWidget::addPrinting(const QString &zone)
|
|||
}
|
||||
deckModel->removeRow(find_card.row(), find_card.parent());
|
||||
}
|
||||
newCardIndex = deckModel->findCard(rootCard->getName(), zone, printingInfo.getProperty("uuid"),
|
||||
printingInfo.getProperty("num"));
|
||||
newCardIndex =
|
||||
deckModel->findCard(rootCard->getName(), zone, printingInfo.getUuid(), printingInfo.getProperty("num"));
|
||||
deckView->setCurrentIndex(newCardIndex);
|
||||
deckView->setFocus(Qt::FocusReason::MouseFocusReason);
|
||||
deckEditor->setModified(true);
|
||||
|
|
@ -235,8 +235,8 @@ void CardAmountWidget::offsetCountAtIndex(const QModelIndex &idx, int offset)
|
|||
*/
|
||||
void CardAmountWidget::decrementCardHelper(const QString &zone)
|
||||
{
|
||||
QModelIndex idx = deckModel->findCard(rootCard->getName(), zone, printingInfo.getProperty("uuid"),
|
||||
printingInfo.getProperty("num"));
|
||||
QModelIndex idx =
|
||||
deckModel->findCard(rootCard->getName(), zone, printingInfo.getUuid(), printingInfo.getProperty("num"));
|
||||
offsetCountAtIndex(idx, -1);
|
||||
deckEditor->setModified(true);
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ void CardAmountWidget::decrementCardHelper(const QString &zone)
|
|||
*/
|
||||
int CardAmountWidget::countCardsInZone(const QString &deckZone)
|
||||
{
|
||||
if (printingInfo.getProperty("uuid").isEmpty()) {
|
||||
if (printingInfo.getUuid().isEmpty()) {
|
||||
return 0; // Cards without uuids/providerIds CANNOT match another card, they are undefined for us.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *pa
|
|||
cardInfoPicture = new CardInfoPictureWidget(this);
|
||||
cardInfoPicture->setMinimumSize(0, 0);
|
||||
cardInfoPicture->setScaleFactor(cardSizeSlider->value());
|
||||
setCard = CardDatabaseManager::getInstance()->getCard({rootCard->getName(), _printingInfo.getProperty("uuid")});
|
||||
setCard = CardDatabaseManager::getInstance()->getCard({rootCard->getName(), _printingInfo.getUuid()});
|
||||
cardInfoPicture->setCard(setCard);
|
||||
mainLayout->addWidget(cardInfoPicture);
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point)
|
|||
|
||||
const auto &preferredProviderId =
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(rootCard->getName());
|
||||
const auto &cardProviderId = printingInfo.getProperty("uuid");
|
||||
const auto &cardProviderId = printingInfo.getUuid();
|
||||
|
||||
if (preferredProviderId.isEmpty() || preferredProviderId != cardProviderId) {
|
||||
auto *pinAction = preferenceMenu->addAction(tr("Pin Printing"));
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ QList<PrintingInfo> PrintingSelectorCardSortingWidget::prependPinnedPrintings(co
|
|||
if (!cardProviderId.isEmpty()) {
|
||||
for (int i = 0; i < printingsToUse.size(); ++i) {
|
||||
const auto &card = printingsToUse[i];
|
||||
if (card.getProperty("uuid") == cardProviderId) {
|
||||
if (card.getUuid() == cardProviderId) {
|
||||
printingsToUse.move(i, 0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -218,9 +218,8 @@ QList<PrintingInfo> PrintingSelectorCardSortingWidget::prependPrintingsInDeck(co
|
|||
|
||||
// Prepend sorted sets and remove them from the original list
|
||||
for (const auto &pair : countList) {
|
||||
auto it = std::find_if(result.begin(), result.end(), [&pair](const PrintingInfo &item) {
|
||||
return item.getProperty("uuid") == pair.first.getProperty("uuid");
|
||||
});
|
||||
auto it = std::find_if(result.begin(), result.end(),
|
||||
[&pair](const PrintingInfo &item) { return item.getUuid() == pair.first.getUuid(); });
|
||||
if (it != result.end()) {
|
||||
result.erase(it); // Remove the matching entry
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,8 +233,7 @@ void VisualDatabaseDisplayWidget::populateCards()
|
|||
SetToPrintingsMap setMap = info->getSets();
|
||||
if (setMap.contains(setFilter->term())) {
|
||||
for (PrintingInfo printing : setMap[setFilter->term()]) {
|
||||
addCard(CardDatabaseManager::getInstance()->getCard(
|
||||
{name.toString(), printing.getProperty("uuid")}));
|
||||
addCard(CardDatabaseManager::getInstance()->getCard({name.toString(), printing.getUuid()}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -299,8 +298,7 @@ void VisualDatabaseDisplayWidget::loadNextPage()
|
|||
SetToPrintingsMap setMap = info->getSets();
|
||||
if (setMap.contains(setFilter->term())) {
|
||||
for (PrintingInfo printing : setMap[setFilter->term()]) {
|
||||
addCard(CardDatabaseManager::getInstance()->getCard(
|
||||
{name.toString(), printing.getProperty("uuid")}));
|
||||
addCard(CardDatabaseManager::getInstance()->getCard({name.toString(), printing.getUuid()}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue