diff --git a/cockatrice/src/client/ui/picture_loader/picture_to_load.cpp b/cockatrice/src/client/ui/picture_loader/picture_to_load.cpp index 9bbe50e82..3ffd9011c 100644 --- a/cockatrice/src/client/ui/picture_loader/picture_to_load.cpp +++ b/cockatrice/src/client/ui/picture_loader/picture_to_load.cpp @@ -30,7 +30,7 @@ QList PictureToLoad::extractSetsSorted(const CardInfoPtr &card) QList sortedSets; for (const auto &cardInfoPerSetList : card->getSets()) { for (const auto &set : cardInfoPerSetList) { - sortedSets << set.getPtr(); + sortedSets << set.getSet(); } } if (sortedSets.empty()) { @@ -45,7 +45,7 @@ QList PictureToLoad::extractSetsSorted(const CardInfoPtr &card) for (const auto &set : cardInfoPerSetList) { if (QLatin1String("card_") + card->getName() + QString("_") + QString(set.getProperty("uuid")) == card->getPixmapCacheKey()) { - long long setIndex = sortedSets.indexOf(set.getPtr()); + long long setIndex = sortedSets.indexOf(set.getSet()); CardSetPtr setForCardProviderID = sortedSets.takeAt(setIndex); sortedSets.prepend(setForCardProviderID); } diff --git a/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp b/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp index 03ad65e4f..628a37cd5 100644 --- a/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp +++ b/cockatrice/src/client/ui/widgets/deck_editor/deck_editor_deck_dock_widget.cpp @@ -477,7 +477,7 @@ bool DeckEditorDeckDockWidget::swapCard(const QModelIndex ¤tIndex) // Third argument (true) says create the card no matter what, even if not in DB QModelIndex newCardIndex = deckModel->addCard( - cardName, CardDatabaseManager::getInstance()->getSpecificSetForCard(cardName, cardProviderID), otherZoneName, + cardName, CardDatabaseManager::getInstance()->getSpecificPrinting(cardName, cardProviderID), otherZoneName, true); recursiveExpand(newCardIndex); diff --git a/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.cpp index dc2a34e76..331212f13 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.cpp @@ -16,7 +16,7 @@ * @param deckView Pointer to the QTreeView for the deck display. * @param cardSizeSlider Pointer to the QSlider used for dynamic font resizing. * @param rootCard The root card for the widget. - * @param setInfoForCard The set information for the card. + * @param printingInfo The printing information for the card. */ AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent, AbstractTabDeckEditor *deckEditor, @@ -24,9 +24,9 @@ AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent, QTreeView *deckView, QSlider *cardSizeSlider, CardInfoPtr rootCard, - PrintingInfo setInfoForCard) + PrintingInfo printingInfo) : QWidget(parent), deckEditor(deckEditor), deckModel(deckModel), deckView(deckView), cardSizeSlider(cardSizeSlider), - rootCard(rootCard), setInfoForCard(setInfoForCard) + rootCard(rootCard), printingInfo(printingInfo) { layout = new QVBoxLayout(this); layout->setAlignment(Qt::AlignHCenter); @@ -36,10 +36,10 @@ AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent, zoneLabelMainboard = new ShadowBackgroundLabel(this, tr("Mainboard")); buttonBoxMainboard = new CardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard, - setInfoForCard, DECK_ZONE_MAIN); + printingInfo, DECK_ZONE_MAIN); zoneLabelSideboard = new ShadowBackgroundLabel(this, tr("Sideboard")); buttonBoxSideboard = new CardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard, - setInfoForCard, DECK_ZONE_SIDE); + printingInfo, DECK_ZONE_SIDE); layout->addWidget(zoneLabelMainboard, 0, Qt::AlignHCenter | Qt::AlignBottom); layout->addWidget(buttonBoxMainboard, 0, Qt::AlignHCenter | Qt::AlignTop); diff --git a/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.h b/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.h index 2a108ac21..ba2c2ce2e 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/all_zones_card_amount_widget.h @@ -17,7 +17,7 @@ public: QTreeView *deckView, QSlider *cardSizeSlider, CardInfoPtr rootCard, - PrintingInfo setInfoForCard); + PrintingInfo printingInfo); int getMainboardAmount(); int getSideboardAmount(); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) @@ -36,7 +36,7 @@ private: QTreeView *deckView; QSlider *cardSizeSlider; CardInfoPtr rootCard; - PrintingInfo setInfoForCard; + PrintingInfo printingInfo; QLabel *zoneLabelMainboard; CardAmountWidget *buttonBoxMainboard; QLabel *zoneLabelSideboard; diff --git a/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp index be4099765..0832d81bc 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.cpp @@ -12,7 +12,7 @@ * @param deckView Pointer to the QTreeView displaying the deck. * @param cardSizeSlider Pointer to the QSlider for adjusting font size. * @param rootCard The root card to manage within the widget. - * @param setInfoForCard Card set information for the root card. + * @param printingInfo Printing info for the root card. * @param zoneName The zone name (e.g., DECK_ZONE_MAIN or DECK_ZONE_SIDE). */ CardAmountWidget::CardAmountWidget(QWidget *parent, @@ -21,10 +21,10 @@ CardAmountWidget::CardAmountWidget(QWidget *parent, QTreeView *deckView, QSlider *cardSizeSlider, CardInfoPtr &rootCard, - PrintingInfo &setInfoForCard, + PrintingInfo &printingInfo, const QString &zoneName) : QWidget(parent), deckEditor(deckEditor), deckModel(deckModel), deckView(deckView), cardSizeSlider(cardSizeSlider), - rootCard(rootCard), setInfoForCard(setInfoForCard), zoneName(zoneName), hovered(false) + rootCard(rootCard), printingInfo(printingInfo), zoneName(zoneName), hovered(false) { layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); @@ -142,18 +142,18 @@ void CardAmountWidget::updateCardCount() */ void CardAmountWidget::addPrinting(const QString &zone) { - auto newCardIndex = deckModel->addCard(rootCard->getName(), setInfoForCard, zone); + auto newCardIndex = deckModel->addCard(rootCard->getName(), printingInfo, zone); recursiveExpand(newCardIndex); QModelIndex find_card = deckModel->findCard(rootCard->getName(), zone); if (find_card.isValid() && find_card != newCardIndex) { auto amount = deckModel->data(find_card, Qt::DisplayRole); for (int i = 0; i < amount.toInt() - 1; i++) { - deckModel->addCard(rootCard->getName(), setInfoForCard, zone); + deckModel->addCard(rootCard->getName(), printingInfo, zone); } deckModel->removeRow(find_card.row(), find_card.parent()); } - newCardIndex = deckModel->findCard(rootCard->getName(), zone, setInfoForCard.getProperty("uuid"), - setInfoForCard.getProperty("num")); + newCardIndex = deckModel->findCard(rootCard->getName(), zone, printingInfo.getProperty("uuid"), + 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, setInfoForCard.getProperty("uuid"), - setInfoForCard.getProperty("num")); + QModelIndex idx = deckModel->findCard(rootCard->getName(), zone, printingInfo.getProperty("uuid"), + 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 (setInfoForCard.getProperty("uuid").isEmpty()) { + if (printingInfo.getProperty("uuid").isEmpty()) { return 0; // Cards without uuids/providerIds CANNOT match another card, they are undefined for us. } @@ -286,7 +286,7 @@ int CardAmountWidget::countCardsInZone(const QString &deckZone) } for (int k = 0; k < currentCard->getNumber(); ++k) { - if (currentCard->getCardProviderId() == setInfoForCard.getProperty("uuid")) { + if (currentCard->getCardProviderId() == printingInfo.getProperty("uuid")) { count++; } } diff --git a/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.h b/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.h index b5e7f0327..6761befca 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/card_amount_widget.h @@ -23,7 +23,7 @@ public: QTreeView *deckView, QSlider *cardSizeSlider, CardInfoPtr &rootCard, - PrintingInfo &setInfoForCard, + PrintingInfo &printingInfo, const QString &zoneName); int countCardsInZone(const QString &deckZone); @@ -41,7 +41,7 @@ private: QTreeView *deckView; QSlider *cardSizeSlider; CardInfoPtr rootCard; - PrintingInfo setInfoForCard; + PrintingInfo printingInfo; QString zoneName; QHBoxLayout *layout; DynamicFontSizePushButton *incrementButton; diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp index 2fb945f11..d2a43be3e 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp @@ -224,27 +224,27 @@ void PrintingSelector::getAllSetsForCurrentCard() return; } - PrintingInfoPerSetMap cardInfoPerSets = selectedCard->getSets(); - const QList sortedSets = sortToolBar->sortSets(cardInfoPerSets); - const QList filteredSets = - sortToolBar->filterSets(sortedSets, searchBar->getSearchText().trimmed().toLower()); - QList setsToUse; + PrintingInfoPerSetMap perSetMap = selectedCard->getSets(); + const QList sortedPrintings = sortToolBar->sortSets(perSetMap); + const QList filteredPrintings = + sortToolBar->filterSets(sortedPrintings, searchBar->getSearchText().trimmed().toLower()); + QList printingsToUse; if (SettingsCache::instance().getBumpSetsWithCardsInDeckToTop()) { - setsToUse = sortToolBar->prependPrintingsInDeck(filteredSets, selectedCard, deckModel); + printingsToUse = sortToolBar->prependPrintingsInDeck(filteredPrintings, selectedCard, deckModel); } else { - setsToUse = filteredSets; + printingsToUse = filteredPrintings; } - setsToUse = sortToolBar->prependPinnedPrintings(setsToUse, selectedCard->getName()); + printingsToUse = sortToolBar->prependPinnedPrintings(printingsToUse, selectedCard->getName()); // Defer widget creation currentIndex = 0; connect(widgetLoadingBufferTimer, &QTimer::timeout, this, [=, this]() mutable { - for (int i = 0; i < BATCH_SIZE && currentIndex < setsToUse.size(); ++i, ++currentIndex) { + for (int i = 0; i < BATCH_SIZE && currentIndex < printingsToUse.size(); ++i, ++currentIndex) { auto *cardDisplayWidget = new PrintingSelectorCardDisplayWidget(this, deckEditor, deckModel, deckView, cardSizeWidget->getSlider(), selectedCard, - setsToUse[currentIndex], currentZone); + printingsToUse[currentIndex], currentZone); flowWidget->addWidget(cardDisplayWidget); cardDisplayWidget->clampSetNameToPicture(); connect(cardDisplayWidget, &PrintingSelectorCardDisplayWidget::cardPreferenceChanged, this, @@ -252,7 +252,7 @@ void PrintingSelector::getAllSetsForCurrentCard() } // Stop timer when done - if (currentIndex >= setsToUse.size()) { + if (currentIndex >= printingsToUse.size()) { widgetLoadingBufferTimer->stop(); } }); diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.cpp index fd6c579cf..877cff2d5 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.cpp @@ -24,7 +24,7 @@ * @param _deckView The QTreeView instance displaying the deck. * @param _cardSizeSlider The slider controlling the size of the displayed card. * @param _rootCard The root card object, representing the card to be displayed. - * @param _setInfoForCard The set-specific information for the card being displayed. + * @param _printingInfo The printing info for the card being displayed. * @param _currentZone The current zone in which the card is located. */ PrintingSelectorCardDisplayWidget::PrintingSelectorCardDisplayWidget(QWidget *parent, @@ -33,10 +33,10 @@ PrintingSelectorCardDisplayWidget::PrintingSelectorCardDisplayWidget(QWidget *pa QTreeView *_deckView, QSlider *_cardSizeSlider, CardInfoPtr _rootCard, - const PrintingInfo &_setInfoForCard, + const PrintingInfo &_printingInfo, QString &_currentZone) : QWidget(parent), deckEditor(_deckEditor), deckModel(_deckModel), deckView(_deckView), - cardSizeSlider(_cardSizeSlider), rootCard(std::move(_rootCard)), setInfoForCard(_setInfoForCard), + cardSizeSlider(_cardSizeSlider), rootCard(std::move(_rootCard)), printingInfo(_printingInfo), currentZone(_currentZone) { layout = new QVBoxLayout(this); @@ -45,15 +45,15 @@ PrintingSelectorCardDisplayWidget::PrintingSelectorCardDisplayWidget(QWidget *pa // Create the overlay widget for the card display overlayWidget = new PrintingSelectorCardOverlayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, - rootCard, setInfoForCard); + rootCard, _printingInfo); connect(overlayWidget, &PrintingSelectorCardOverlayWidget::cardPreferenceChanged, this, [this]() { emit cardPreferenceChanged(); }); // Create the widget to display the set name and collector's number const QString combinedSetName = - QString(setInfoForCard.getPtr()->getLongName() + " (" + setInfoForCard.getPtr()->getShortName() + ")"); + QString(_printingInfo.getSet()->getLongName() + " (" + _printingInfo.getSet()->getShortName() + ")"); setNameAndCollectorsNumberDisplayWidget = new SetNameAndCollectorsNumberDisplayWidget( - this, combinedSetName, setInfoForCard.getProperty("num"), cardSizeSlider); + this, combinedSetName, _printingInfo.getProperty("num"), cardSizeSlider); // Add the widgets to the layout layout->addWidget(overlayWidget, 0, Qt::AlignHCenter); diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.h b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.h index 98de586da..4bda0541a 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_display_widget.h @@ -21,7 +21,7 @@ public: QTreeView *_deckView, QSlider *_cardSizeSlider, CardInfoPtr _rootCard, - const PrintingInfo &_setInfoForCard, + const PrintingInfo &_printingInfo, QString &_currentZone); public slots: @@ -39,7 +39,7 @@ private: QSlider *cardSizeSlider; CardInfoPtr rootCard; CardInfoPtr setCard; - PrintingInfo setInfoForCard; + PrintingInfo printingInfo; QString currentZone; PrintingSelectorCardOverlayWidget *overlayWidget; }; diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.cpp index b0d71540b..cd6b08f25 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.cpp @@ -22,7 +22,7 @@ * @param _deckView The QTreeView instance displaying the deck. * @param _cardSizeSlider The slider controlling the size of the card. * @param _rootCard The root card object that contains information about the card. - * @param _setInfoForCard The set-specific information for the card being displayed. + * @param _printingInfo The printing-specific information for the card being displayed. */ PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *parent, AbstractTabDeckEditor *_deckEditor, @@ -30,9 +30,9 @@ PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *pa QTreeView *_deckView, QSlider *_cardSizeSlider, CardInfoPtr _rootCard, - const PrintingInfo &_setInfoForCard) + const PrintingInfo &_printingInfo) : QWidget(parent), deckEditor(_deckEditor), deckModel(_deckModel), deckView(_deckView), - cardSizeSlider(_cardSizeSlider), rootCard(std::move(_rootCard)), setInfoForCard(_setInfoForCard) + cardSizeSlider(_cardSizeSlider), rootCard(std::move(_rootCard)), printingInfo(_printingInfo) { // Set up the main layout auto *mainLayout = new QVBoxLayout(this); @@ -45,13 +45,13 @@ PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *pa cardInfoPicture->setMinimumSize(0, 0); cardInfoPicture->setScaleFactor(cardSizeSlider->value()); setCard = CardDatabaseManager::getInstance()->getCardByNameAndProviderId(rootCard->getName(), - setInfoForCard.getProperty("uuid")); + _printingInfo.getProperty("uuid")); cardInfoPicture->setCard(setCard); mainLayout->addWidget(cardInfoPicture); // Add AllZonesCardAmountWidget allZonesCardAmountWidget = - new AllZonesCardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, setCard, setInfoForCard); + new AllZonesCardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, setCard, _printingInfo); allZonesCardAmountWidget->raise(); // Ensure it's on top of the picture // Set initial visibility based on amounts @@ -172,7 +172,7 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point) const auto &preferredProviderId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(rootCard->getName()); - const auto &cardProviderId = setInfoForCard.getProperty("uuid"); + const auto &cardProviderId = printingInfo.getProperty("uuid"); if (preferredProviderId.isEmpty() || preferredProviderId != cardProviderId) { auto *pinAction = preferenceMenu->addAction(tr("Pin Printing")); diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.h b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.h index e28d45ab8..5d9a8c93d 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_overlay_widget.h @@ -20,7 +20,7 @@ public: QTreeView *_deckView, QSlider *_cardSizeSlider, CardInfoPtr _rootCard, - const PrintingInfo &_setInfoForCard); + const PrintingInfo &_printingInfo); protected: void resizeEvent(QResizeEvent *event) override; @@ -45,7 +45,7 @@ private: QSlider *cardSizeSlider; CardInfoPtr rootCard; CardInfoPtr setCard; - PrintingInfo setInfoForCard; + PrintingInfo printingInfo; }; #endif // PRINTING_SELECTOR_CARD_OVERLAY_WIDGET_H diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp index 902c52c58..0cfc938fb 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp @@ -73,16 +73,16 @@ void PrintingSelectorCardSortingWidget::updateSortSetting() * - Contained in Deck * - Potential Cards in Deck * - * @param cardInfoPerSets The list of card sets to be sorted. - * @return A sorted list of card sets. + * @param perSetMap The list of card sets to be sorted. + * @return A sorted list of printings. */ -QList PrintingSelectorCardSortingWidget::sortSets(const PrintingInfoPerSetMap &cardInfoPerSets) +QList PrintingSelectorCardSortingWidget::sortSets(const PrintingInfoPerSetMap &perSetMap) { QList sortedSets; - for (const auto &cardInfoPerSetList : cardInfoPerSets) { - for (const auto &set : cardInfoPerSetList) { - sortedSets << set.getPtr(); + for (const auto &printingInfos : perSetMap) { + for (const auto &set : printingInfos) { + sortedSets << set.getSet(); break; } } @@ -98,14 +98,14 @@ QList PrintingSelectorCardSortingWidget::sortSets(const PrintingIn std::sort(sortedSets.begin(), sortedSets.end(), SetReleaseDateComparator()); } - QList sortedCardInfoPerSets; + QList sortedPrintings; // Reconstruct sorted list of CardInfoPerSet for (const auto &set : sortedSets) { - for (auto it = cardInfoPerSets.begin(); it != cardInfoPerSets.end(); ++it) { + for (auto it = perSetMap.begin(); it != perSetMap.end(); ++it) { for (const auto &cardInfoPerSet : it.value()) { - if (cardInfoPerSet.getPtr() == set) { - if (!sortedCardInfoPerSets.contains(cardInfoPerSet)) { - sortedCardInfoPerSets << cardInfoPerSet; + if (cardInfoPerSet.getSet() == set) { + if (!sortedPrintings.contains(cardInfoPerSet)) { + sortedPrintings << cardInfoPerSet; } } } @@ -113,10 +113,10 @@ QList PrintingSelectorCardSortingWidget::sortSets(const PrintingIn } if (descendingSort) { - std::reverse(sortedCardInfoPerSets.begin(), sortedCardInfoPerSets.end()); + std::reverse(sortedPrintings.begin(), sortedPrintings.end()); } - return sortedCardInfoPerSets; + return sortedPrintings; } /** @@ -126,81 +126,81 @@ QList PrintingSelectorCardSortingWidget::sortSets(const PrintingIn * text. If the search text matches either the long or short name of a card set, that set is included in the filtered * list. * - * @param sets The list of card sets to be filtered. + * @param printings The list of printings to be filtered. * @param searchText The search text used to filter the card sets. * @return A filtered list of card sets. */ -QList PrintingSelectorCardSortingWidget::filterSets(const QList &sets, - const QString &searchText) +QList PrintingSelectorCardSortingWidget::filterSets(const QList &printings, + const QString &searchText) { if (searchText.isEmpty()) { - return sets; + return printings; } - QList filteredSets; + QList filteredPrintings; - for (const auto &set : sets) { - const QString longName = set.getPtr()->getLongName().toLower(); - const QString shortName = set.getPtr()->getShortName().toLower(); + for (const auto &printing : printings) { + const QString longName = printing.getSet()->getLongName().toLower(); + const QString shortName = printing.getSet()->getShortName().toLower(); if (longName.contains(searchText) || shortName.contains(searchText)) { - filteredSets << set; + filteredPrintings << printing; } } - return filteredSets; + return filteredPrintings; } -QList PrintingSelectorCardSortingWidget::prependPinnedPrintings(const QList &sets, - const QString &cardName) +QList PrintingSelectorCardSortingWidget::prependPinnedPrintings(const QList &printings, + const QString &cardName) { - auto setsToUse = sets; + auto printingsToUse = printings; const auto &cardProviderId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardName); if (!cardProviderId.isEmpty()) { - for (int i = 0; i < setsToUse.size(); ++i) { - const auto &card = setsToUse[i]; + for (int i = 0; i < printingsToUse.size(); ++i) { + const auto &card = printingsToUse[i]; if (card.getProperty("uuid") == cardProviderId) { - setsToUse.move(i, 0); + printingsToUse.move(i, 0); break; } } } - return setsToUse; + return printingsToUse; } /** - * @brief Prepend card printings that are contained in the deck to the list of card sets. + * @brief Prepend card printings that are contained in the deck to the list of printings. * - * This function adjusts the list of card sets by moving the printings that are already contained in the deck to the + * This function adjusts the list of printings by moving the printings that are already contained in the deck to the * beginning of the list, sorted by the count of cards in the deck. * - * @param sets The original list of card sets. + * @param printings The original list of printings. * @param selectedCard The currently selected card. * @param deckModel The model representing the deck. - * @return A list of card sets with the printings contained in the deck prepended. + * @return A list of printings with the printings contained in the deck prepended. */ -QList PrintingSelectorCardSortingWidget::prependPrintingsInDeck(const QList &sets, - const CardInfoPtr &selectedCard, - DeckListModel *deckModel) +QList PrintingSelectorCardSortingWidget::prependPrintingsInDeck(const QList &printings, + const CardInfoPtr &selectedCard, + DeckListModel *deckModel) { if (!selectedCard) { return {}; } - PrintingInfoPerSetMap cardInfoPerSets = selectedCard->getSets(); + PrintingInfoPerSetMap perSetMap = selectedCard->getSets(); QList> countList; // Collect sets with their counts - for (const auto &cardInfoPerSetList : cardInfoPerSets) { - for (const auto &cardInfoPerSet : cardInfoPerSetList) { + for (const auto &printingList : perSetMap) { + for (const auto &printing : printingList) { QModelIndex find_card = - deckModel->findCard(selectedCard->getName(), DECK_ZONE_MAIN, cardInfoPerSet.getProperty("uuid")); + deckModel->findCard(selectedCard->getName(), DECK_ZONE_MAIN, printing.getProperty("uuid")); if (find_card.isValid()) { int count = deckModel->data(find_card, Qt::DisplayRole).toInt(); // Ensure the count is treated as an integer if (count > 0) { - countList.append(qMakePair(cardInfoPerSet, count)); + countList.append(qMakePair(printing, count)); } } break; @@ -214,7 +214,7 @@ QList PrintingSelectorCardSortingWidget::prependPrintingsInDeck(co }); // Create a copy of the original list to modify - QList result = sets; + QList result = printings; // Prepend sorted sets and remove them from the original list for (const auto &pair : countList) { diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.h b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.h index aa8d8f3df..f8c3cf570 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.h @@ -12,12 +12,12 @@ class PrintingSelectorCardSortingWidget : public QWidget Q_OBJECT public: explicit PrintingSelectorCardSortingWidget(PrintingSelector *parent); - QList sortSets(const PrintingInfoPerSetMap &cardInfoPerSets); - QList filterSets(const QList &sets, const QString &searchText); - QList prependPinnedPrintings(const QList &sets, const QString &cardName); - QList prependPrintingsInDeck(const QList &sets, - const CardInfoPtr &selectedCard, - DeckListModel *deckModel); + QList sortSets(const PrintingInfoPerSetMap &perSetMap); + QList filterSets(const QList &printings, const QString &searchText); + QList prependPinnedPrintings(const QList &printings, const QString &cardName); + QList prependPrintingsInDeck(const QList &printings, + const CardInfoPtr &selectedCard, + DeckListModel *deckModel); public slots: void updateSortOrder(); diff --git a/cockatrice/src/client/ui/widgets/visual_database_display/visual_database_display_widget.cpp b/cockatrice/src/client/ui/widgets/visual_database_display/visual_database_display_widget.cpp index f995d631d..ab398369a 100644 --- a/cockatrice/src/client/ui/widgets/visual_database_display/visual_database_display_widget.cpp +++ b/cockatrice/src/client/ui/widgets/visual_database_display/visual_database_display_widget.cpp @@ -232,9 +232,9 @@ void VisualDatabaseDisplayWidget::populateCards() if (setFilter) { PrintingInfoPerSetMap setMap = info->getSets(); if (setMap.contains(setFilter->term())) { - for (PrintingInfo cardSetInstance : setMap[setFilter->term()]) { + for (PrintingInfo printing : setMap[setFilter->term()]) { addCard(CardDatabaseManager::getInstance()->getCardByNameAndProviderId( - name.toString(), cardSetInstance.getProperty("uuid"))); + name.toString(), printing.getProperty("uuid"))); } } } else { @@ -298,9 +298,9 @@ void VisualDatabaseDisplayWidget::loadNextPage() if (setFilter) { PrintingInfoPerSetMap setMap = info->getSets(); if (setMap.contains(setFilter->term())) { - for (PrintingInfo cardSetInstance : setMap[setFilter->term()]) { + for (PrintingInfo printing : setMap[setFilter->term()]) { addCard(CardDatabaseManager::getInstance()->getCardByNameAndProviderId( - name.toString(), cardSetInstance.getProperty("uuid"))); + name.toString(), printing.getProperty("uuid"))); } } } else { diff --git a/cockatrice/src/deck/deck_list_model.cpp b/cockatrice/src/deck/deck_list_model.cpp index 24447f187..75e1effae 100644 --- a/cockatrice/src/deck/deck_list_model.cpp +++ b/cockatrice/src/deck/deck_list_model.cpp @@ -367,17 +367,17 @@ QModelIndex DeckListModel::findCard(const QString &cardName, QModelIndex DeckListModel::addPreferredPrintingCard(const QString &cardName, const QString &zoneName, bool abAddAnyway) { - return addCard(cardName, CardDatabaseManager::getInstance()->getPreferredSetForCard(cardName), zoneName, + return addCard(cardName, CardDatabaseManager::getInstance()->getPreferredPrinting(cardName), zoneName, abAddAnyway); } QModelIndex DeckListModel::addCard(const QString &cardName, - const PrintingInfo &cardInfoSet, + const PrintingInfo &printingInfo, const QString &zoneName, bool abAddAnyway) { CardInfoPtr cardInfo = - CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, cardInfoSet.getProperty("uuid")); + CardDatabaseManager::getInstance()->getCardByNameAndProviderId(cardName, printingInfo.getProperty("uuid")); if (cardInfo == nullptr) { if (abAddAnyway) { @@ -398,15 +398,15 @@ QModelIndex DeckListModel::addCard(const QString &cardName, const QModelIndex parentIndex = nodeToIndex(groupNode); auto *cardNode = dynamic_cast(groupNode->findCardChildByNameProviderIdAndNumber( - cardName, cardInfoSet.getProperty("uuid"), cardInfoSet.getProperty("num"))); - const auto cardSetName = cardInfoSet.getPtr().isNull() ? "" : cardInfoSet.getPtr()->getCorrectedShortName(); + cardName, printingInfo.getProperty("uuid"), printingInfo.getProperty("num"))); + const auto cardSetName = printingInfo.getSet().isNull() ? "" : printingInfo.getSet()->getCorrectedShortName(); if (!cardNode) { // Determine the correct index int insertRow = findSortedInsertRow(groupNode, cardInfo); auto *decklistCard = deckList->addCard(cardInfo->getName(), zoneName, insertRow, cardSetName, - cardInfoSet.getProperty("num"), cardInfoSet.getProperty("uuid")); + printingInfo.getProperty("num"), printingInfo.getProperty("uuid")); beginInsertRows(parentIndex, insertRow, insertRow); cardNode = new DecklistModelCardNode(decklistCard, groupNode, insertRow); @@ -414,8 +414,8 @@ QModelIndex DeckListModel::addCard(const QString &cardName, } else { cardNode->setNumber(cardNode->getNumber() + 1); cardNode->setCardSetShortName(cardSetName); - cardNode->setCardCollectorNumber(cardInfoSet.getProperty("num")); - cardNode->setCardProviderId(cardInfoSet.getProperty("uuid")); + cardNode->setCardCollectorNumber(printingInfo.getProperty("num")); + cardNode->setCardProviderId(printingInfo.getProperty("uuid")); deckList->refreshDeckHash(); } sort(lastKnownColumn, lastKnownOrder); diff --git a/cockatrice/src/deck/deck_list_model.h b/cockatrice/src/deck/deck_list_model.h index 2a8b20b02..84fd0c05a 100644 --- a/cockatrice/src/deck/deck_list_model.h +++ b/cockatrice/src/deck/deck_list_model.h @@ -112,7 +112,7 @@ public: const QString &cardNumber = "") const; QModelIndex addPreferredPrintingCard(const QString &cardName, const QString &zoneName, bool abAddAnyway); QModelIndex addCard(const ::QString &cardName, - const PrintingInfo &cardInfoSet, + const PrintingInfo &printingInfo, const QString &zoneName, bool abAddAnyway = false); int findSortedInsertRow(InnerDecklistNode *parent, CardInfoPtr cardInfo) const; diff --git a/cockatrice/src/deck/deck_loader.cpp b/cockatrice/src/deck/deck_loader.cpp index 97166134a..7e85d874f 100644 --- a/cockatrice/src/deck/deck_loader.cpp +++ b/cockatrice/src/deck/deck_loader.cpp @@ -324,12 +324,12 @@ struct SetProviderIdToPreferred void operator()(const InnerDecklistNode *node, DecklistCardNode *card) const { Q_UNUSED(node); - PrintingInfo preferredSet = CardDatabaseManager::getInstance()->getSpecificSetForCard( + PrintingInfo preferredPrinting = CardDatabaseManager::getInstance()->getSpecificPrinting( card->getName(), CardDatabaseManager::getInstance()->getPreferredPrintingProviderIdForCard(card->getName())); - QString providerId = preferredSet.getProperty("uuid"); - QString setShortName = preferredSet.getPtr()->getShortName(); - QString collectorNumber = preferredSet.getProperty("num"); + QString providerId = preferredPrinting.getProperty("uuid"); + QString setShortName = preferredPrinting.getSet()->getShortName(); + QString collectorNumber = preferredPrinting.getProperty("num"); card->setCardProviderId(providerId); card->setCardCollectorNumber(collectorNumber); @@ -360,7 +360,7 @@ void DeckLoader::resolveSetNameAndNumberToProviderID() // Retrieve the providerId based on setName and collectorNumber QString providerId = CardDatabaseManager::getInstance() - ->getSpecificSetForCard(card->getName(), card->getCardSetShortName(), card->getCardCollectorNumber()) + ->getSpecificPrinting(card->getName(), card->getCardSetShortName(), card->getCardCollectorNumber()) .getProperty("uuid"); // Set the providerId on the card diff --git a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp b/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp index 685f62fe4..e88385e84 100644 --- a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp +++ b/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp @@ -152,7 +152,7 @@ void DlgSelectSetForCards::actOK() continue; } model->removeRow(find_card.row(), find_card.parent()); - model->addCard(card, CardDatabaseManager::getInstance()->getSpecificSetForCard(card, modifiedSet, ""), + model->addCard(card, CardDatabaseManager::getInstance()->getSpecificPrinting(card, modifiedSet, ""), DECK_ZONE_MAIN); } } @@ -226,8 +226,8 @@ QMap DlgSelectSetForCards::getSetsForCards() if (!infoPtr) continue; - PrintingInfoPerSetMap infoPerSetMap = infoPtr->getSets(); - for (auto it = infoPerSetMap.begin(); it != infoPerSetMap.end(); ++it) { + PrintingInfoPerSetMap perSetMap = infoPtr->getSets(); + for (auto it = perSetMap.begin(); it != perSetMap.end(); ++it) { setCounts[it.key()]++; } } @@ -297,7 +297,7 @@ void DlgSelectSetForCards::updateCardLists() } else { CardInfoPtr infoPtr = CardDatabaseManager::getInstance()->getCardByNameAndProviderId( currentCard->getName(), CardDatabaseManager::getInstance() - ->getSpecificSetForCard(currentCard->getName(), foundSetName, "") + ->getSpecificPrinting(currentCard->getName(), foundSetName, "") .getProperty("uuid")); CardInfoPictureWidget *picture_widget = new CardInfoPictureWidget(modifiedCardsFlowWidget); picture_widget->setCard(infoPtr); @@ -380,8 +380,8 @@ QMap DlgSelectSetForCards::getCardsForSets() if (!infoPtr) continue; - PrintingInfoPerSetMap infoPerSetMap = infoPtr->getSets(); - for (auto it = infoPerSetMap.begin(); it != infoPerSetMap.end(); ++it) { + PrintingInfoPerSetMap perSetMap = infoPtr->getSets(); + for (auto it = perSetMap.begin(); it != perSetMap.end(); ++it) { setCards[it.key()].append(currentCard->getName()); } } @@ -628,7 +628,7 @@ void SetEntryWidget::updateCardDisplayWidgets() CardInfoPictureWidget *picture_widget = new CardInfoPictureWidget(cardListContainer); picture_widget->setCard(CardDatabaseManager::getInstance()->getCardByNameAndProviderId( cardName, - CardDatabaseManager::getInstance()->getSpecificSetForCard(cardName, setName, nullptr).getProperty("uuid"))); + CardDatabaseManager::getInstance()->getSpecificPrinting(cardName, setName, nullptr).getProperty("uuid"))); cardListContainer->addWidget(picture_widget); } @@ -636,7 +636,7 @@ void SetEntryWidget::updateCardDisplayWidgets() CardInfoPictureWidget *picture_widget = new CardInfoPictureWidget(alreadySelectedCardListContainer); picture_widget->setCard(CardDatabaseManager::getInstance()->getCardByNameAndProviderId( cardName, - CardDatabaseManager::getInstance()->getSpecificSetForCard(cardName, setName, nullptr).getProperty("uuid"))); + CardDatabaseManager::getInstance()->getSpecificPrinting(cardName, setName, nullptr).getProperty("uuid"))); alreadySelectedCardListContainer->addWidget(picture_widget); } } diff --git a/cockatrice/src/game/cards/card_database.cpp b/cockatrice/src/game/cards/card_database.cpp index 38b25d628..b6e61af04 100644 --- a/cockatrice/src/game/cards/card_database.cpp +++ b/cockatrice/src/game/cards/card_database.cpp @@ -73,9 +73,9 @@ void CardDatabase::addCard(CardInfoPtr card) // if card already exists just add the new set property if (cards.contains(card->getName())) { CardInfoPtr sameCard = cards[card->getName()]; - for (const auto &cardInfoPerSetList : card->getSets()) { - for (const PrintingInfo &set : cardInfoPerSetList) { - sameCard->addToSet(set.getPtr(), set); + for (const auto &printings : card->getSets()) { + for (const PrintingInfo &printing : printings) { + sameCard->addToSet(printing.getSet(), printing); } } return; @@ -309,7 +309,7 @@ void CardDatabase::refreshPreferredPrintings() } } -PrintingInfo CardDatabase::getPreferredSetForCard(const QString &cardName) const +PrintingInfo CardDatabase::getPreferredPrinting(const QString &cardName) const { CardInfoPtr cardInfo = getCard(cardName); if (!cardInfo) { @@ -322,27 +322,27 @@ PrintingInfo CardDatabase::getPreferredSetForCard(const QString &cardName) const } CardSetPtr preferredSet = nullptr; - PrintingInfo preferredCard; + PrintingInfo preferredPrinting; SetPriorityComparator comparator; - for (const auto &cardInfoPerSetList : setMap) { - for (auto &cardInfoForSet : cardInfoPerSetList) { - CardSetPtr currentSet = cardInfoForSet.getPtr(); + for (const auto &printings : setMap) { + for (auto &printing : printings) { + CardSetPtr currentSet = printing.getSet(); if (!preferredSet || comparator(currentSet, preferredSet)) { preferredSet = currentSet; - preferredCard = cardInfoForSet; + preferredPrinting = printing; } } } if (preferredSet) { - return preferredCard; + return preferredPrinting; } return PrintingInfo(nullptr); } -PrintingInfo CardDatabase::getSpecificSetForCard(const QString &cardName, const QString &providerId) const +PrintingInfo CardDatabase::getSpecificPrinting(const QString &cardName, const QString &providerId) const { CardInfoPtr cardInfo = getCard(cardName); if (!cardInfo) { @@ -363,15 +363,15 @@ PrintingInfo CardDatabase::getSpecificSetForCard(const QString &cardName, const } if (providerId.isNull()) { - return getPreferredSetForCard(cardName); + return getPreferredPrinting(cardName); } return PrintingInfo(nullptr); } -PrintingInfo CardDatabase::getSpecificSetForCard(const QString &cardName, - const QString &setShortName, - const QString &collectorNumber) const +PrintingInfo CardDatabase::getSpecificPrinting(const QString &cardName, + const QString &setShortName, + const QString &collectorNumber) const { CardInfoPtr cardInfo = getCard(cardName); if (!cardInfo) { @@ -386,12 +386,12 @@ PrintingInfo CardDatabase::getSpecificSetForCard(const QString &cardName, for (const auto &cardInfoPerSetList : setMap) { for (auto &cardInfoForSet : cardInfoPerSetList) { if (collectorNumber != nullptr) { - if (cardInfoForSet.getPtr()->getShortName() == setShortName && + if (cardInfoForSet.getSet()->getShortName() == setShortName && cardInfoForSet.getProperty("num") == collectorNumber) { return cardInfoForSet; } } else { - if (cardInfoForSet.getPtr()->getShortName() == setShortName) { + if (cardInfoForSet.getSet()->getShortName() == setShortName) { return cardInfoForSet; } } @@ -403,8 +403,8 @@ PrintingInfo CardDatabase::getSpecificSetForCard(const QString &cardName, QString CardDatabase::getPreferredPrintingProviderIdForCard(const QString &cardName) { - PrintingInfo preferredSetCardInfo = getPreferredSetForCard(cardName); - QString preferredPrintingProviderId = preferredSetCardInfo.getProperty(QString("uuid")); + PrintingInfo preferredPrinting = getPreferredPrinting(cardName); + QString preferredPrintingProviderId = preferredPrinting.getProperty(QString("uuid")); if (preferredPrintingProviderId.isEmpty()) { CardInfoPtr defaultCardInfo = getCard(cardName); if (defaultCardInfo.isNull()) { diff --git a/cockatrice/src/game/cards/card_database.h b/cockatrice/src/game/cards/card_database.h index 490fcd722..8bd3d14e0 100644 --- a/cockatrice/src/game/cards/card_database.h +++ b/cockatrice/src/game/cards/card_database.h @@ -69,10 +69,10 @@ public: [[nodiscard]] QList getCards(const QStringList &cardNames) const; QList getCardsByNameAndProviderId(const QMap &cardNames) const; [[nodiscard]] CardInfoPtr getCardByNameAndProviderId(const QString &cardName, const QString &providerId) const; - [[nodiscard]] PrintingInfo getPreferredSetForCard(const QString &cardName) const; - [[nodiscard]] PrintingInfo getSpecificSetForCard(const QString &cardName, const QString &providerId) const; + [[nodiscard]] PrintingInfo getPreferredPrinting(const QString &cardName) const; + [[nodiscard]] PrintingInfo getSpecificPrinting(const QString &cardName, const QString &providerId) const; PrintingInfo - getSpecificSetForCard(const QString &cardName, const QString &setShortName, const QString &collectorNumber) const; + getSpecificPrinting(const QString &cardName, const QString &setShortName, const QString &collectorNumber) const; QString getPreferredPrintingProviderIdForCard(const QString &cardName); [[nodiscard]] CardInfoPtr guessCard(const QString &cardName, const QString &providerId = QString()) const; diff --git a/cockatrice/src/game/cards/card_database_model.cpp b/cockatrice/src/game/cards/card_database_model.cpp index 93bb7f02a..4010ba7b3 100644 --- a/cockatrice/src/game/cards/card_database_model.cpp +++ b/cockatrice/src/game/cards/card_database_model.cpp @@ -100,7 +100,7 @@ bool CardDatabaseModel::checkCardHasAtLeastOneEnabledSet(CardInfoPtr card) for (const auto &cardInfoPerSetList : card->getSets()) { for (const auto &set : cardInfoPerSetList) { - if (set.getPtr()->getEnabled()) + if (set.getSet()->getEnabled()) return true; } } diff --git a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.cpp b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.cpp index 6499adc17..fe7be88e4 100644 --- a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.cpp +++ b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_3.cpp @@ -343,9 +343,9 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfoPtr &in } // sets - const PrintingInfoPerSetMap sets = info->getSets(); - for (const auto &cardInfoPerSetList : sets) { - for (const PrintingInfo &set : cardInfoPerSetList) { + const PrintingInfoPerSetMap perSetMap = info->getSets(); + for (const auto &printings : perSetMap) { + for (const PrintingInfo &set : printings) { xml.writeStartElement("set"); xml.writeAttribute("rarity", set.getProperty("rarity")); xml.writeAttribute("muId", set.getProperty("muid")); @@ -361,7 +361,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfoPtr &in xml.writeAttribute("picURL", tmpString); } - xml.writeCharacters(set.getPtr()->getShortName()); + xml.writeCharacters(set.getSet()->getShortName()); xml.writeEndElement(); } } diff --git a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.cpp b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.cpp index 8900a8ea3..0cc3f42a3 100644 --- a/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.cpp +++ b/cockatrice/src/game/cards/card_database_parser/cockatrice_xml_4.cpp @@ -184,12 +184,12 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml) QString setName = xml.readElementText(QXmlStreamReader::IncludeChildElements); auto set = internalAddSet(setName); if (set->getEnabled()) { - PrintingInfo setInfo(set); + PrintingInfo printingInfo(set); for (QXmlStreamAttribute attr : attrs) { QString attrName = attr.name().toString(); if (attrName == "picURL") attrName = "picurl"; - setInfo.setProperty(attrName, attr.value().toString()); + printingInfo.setProperty(attrName, attr.value().toString()); } // This is very much a hack and not the right place to @@ -199,8 +199,8 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml) // However, this is also true of the `set->getEnabled()` // check above (which is currently bugged as well), so // we'll fix both at the same time. - if (includeRebalancedCards || setInfo.getProperty("isRebalanced") != "true") { - _sets[setName].append(setInfo); + if (includeRebalancedCards || printingInfo.getProperty("isRebalanced") != "true") { + _sets[setName].append(printingInfo); } } // related cards @@ -309,14 +309,14 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfoPtr &in xml.writeEndElement(); // sets - for (const auto &cardInfoPerSetList : info->getSets()) { - for (const PrintingInfo &set : cardInfoPerSetList) { + for (const auto &printings : info->getSets()) { + for (const PrintingInfo &set : printings) { xml.writeStartElement("set"); for (const QString &propName : set.getProperties()) { xml.writeAttribute(propName, set.getProperty(propName)); } - xml.writeCharacters(set.getPtr()->getShortName()); + xml.writeCharacters(set.getSet()->getShortName()); xml.writeEndElement(); } } diff --git a/cockatrice/src/game/cards/card_info.cpp b/cockatrice/src/game/cards/card_info.cpp index bca678e81..76719d3e1 100644 --- a/cockatrice/src/game/cards/card_info.cpp +++ b/cockatrice/src/game/cards/card_info.cpp @@ -267,9 +267,9 @@ CardInfoPtr CardInfo::newInstance(const QString &_name, _sets, _cipt, _landscapeOrientation, _tableRow, _upsideDownArt)); ptr->setSmartPointer(ptr); - for (const auto &cardInfoPerSetList : _sets) { - for (const PrintingInfo &set : cardInfoPerSetList) { - set.getPtr()->append(ptr); + for (const auto &printings : _sets) { + for (const PrintingInfo &printing : printings) { + printing.getSet()->append(ptr); break; } } @@ -318,8 +318,8 @@ void CardInfo::refreshCachedSetNames() // update the cached list of set names for (const auto &cardInfoPerSetList : sets) { for (const auto &set : cardInfoPerSetList) { - if (set.getPtr()->getEnabled()) { - setList << set.getPtr()->getShortName(); + if (set.getSet()->getEnabled()) { + setList << set.getSet()->getShortName(); } break; } diff --git a/cockatrice/src/game/cards/card_info.h b/cockatrice/src/game/cards/card_info.h index ddffcad28..69d047bac 100644 --- a/cockatrice/src/game/cards/card_info.h +++ b/cockatrice/src/game/cards/card_info.h @@ -162,7 +162,7 @@ private: QVariantHash properties; public: - CardSetPtr getPtr() const + CardSetPtr getSet() const { return set; } diff --git a/cockatrice/src/game/filters/filter_tree.cpp b/cockatrice/src/game/filters/filter_tree.cpp index 4e65fc06e..5ce84f329 100644 --- a/cockatrice/src/game/filters/filter_tree.cpp +++ b/cockatrice/src/game/filters/filter_tree.cpp @@ -217,8 +217,8 @@ bool FilterItem::acceptSet(const CardInfoPtr info) const bool status = false; for (const auto &cardInfoPerSetList : info->getSets()) { for (const auto &set : cardInfoPerSetList) { - if (set.getPtr()->getShortName().compare(term, Qt::CaseInsensitive) == 0 || - set.getPtr()->getLongName().compare(term, Qt::CaseInsensitive) == 0) { + if (set.getSet()->getShortName().compare(term, Qt::CaseInsensitive) == 0 || + set.getSet()->getLongName().compare(term, Qt::CaseInsensitive) == 0) { status = true; break; } diff --git a/cockatrice/src/utility/card_set_comparator.h b/cockatrice/src/utility/card_set_comparator.h index 549e0180c..bca3084e1 100644 --- a/cockatrice/src/utility/card_set_comparator.h +++ b/cockatrice/src/utility/card_set_comparator.h @@ -49,10 +49,10 @@ public: */ inline bool operator()(const PrintingInfo &a, const PrintingInfo &b) const { - if (a.getPtr()->getEnabled()) { - return !b.getPtr()->getEnabled() || a.getPtr()->getSortKey() < b.getPtr()->getSortKey(); + if (a.getSet()->getEnabled()) { + return !b.getSet()->getEnabled() || a.getSet()->getSortKey() < b.getSet()->getSortKey(); } else { - return !b.getPtr()->getEnabled() && a.getPtr()->getSortKey() < b.getPtr()->getSortKey(); + return !b.getSet()->getEnabled() && a.getSet()->getSortKey() < b.getSet()->getSortKey(); } } }; diff --git a/oracle/src/oracleimporter.cpp b/oracle/src/oracleimporter.cpp index b18d5273a..6cd7c5641 100644 --- a/oracle/src/oracleimporter.cpp +++ b/oracle/src/oracleimporter.cpp @@ -12,8 +12,8 @@ SplitCardPart::SplitCardPart(const QString &_name, const QString &_text, const QVariantHash &_properties, - const PrintingInfo &_setInfo) - : name(_name), text(_text), properties(_properties), setInfo(_setInfo) + const PrintingInfo &_printingInfo) + : name(_name), text(_text), properties(_properties), printingInfo(_printingInfo) { } @@ -129,14 +129,14 @@ CardInfoPtr OracleImporter::addCard(QString name, bool isToken, QVariantHash properties, const QList &relatedCards, - const PrintingInfo &setInfo) + const PrintingInfo &printingInfo) { // Workaround for card name weirdness name = name.replace("Æ", "AE"); name = name.replace("’", "'"); if (cards.contains(name)) { CardInfoPtr card = cards.value(name); - card->addToSet(setInfo.getPtr(), setInfo); + card->addToSet(printingInfo.getSet(), printingInfo); if (card->getProperties().filter(formatRegex).empty()) { card->combineLegalities(properties); } @@ -201,12 +201,12 @@ CardInfoPtr OracleImporter::addCard(QString name, // insert the card and its properties QList reverseRelatedCards; PrintingInfoPerSetMap setsInfo; - setsInfo[setInfo.getPtr()->getShortName()].append(setInfo); + setsInfo[printingInfo.getSet()->getShortName()].append(printingInfo); CardInfoPtr newCard = CardInfo::newInstance(name, text, isToken, properties, relatedCards, reverseRelatedCards, setsInfo, cipt, landscapeOrientation, tableRow, upsideDown); if (name.isEmpty()) { - qDebug() << "warning: an empty card was added to set" << setInfo.getPtr()->getShortName(); + qDebug() << "warning: an empty card was added to set" << printingInfo.getSet()->getShortName(); } cards.insert(name, newCard); @@ -242,7 +242,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList static constexpr bool isToken = false; static const QList setsWithCardsWithSameNameButDifferentText = {"UST"}; QVariantHash properties; - PrintingInfo setInfo; + PrintingInfo printingInfo; QList relatedCards; QList allNameProps; @@ -281,7 +281,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList } // per-set properties - setInfo = PrintingInfo(currentSet); + printingInfo = PrintingInfo(currentSet); QMapIterator it2(setInfoProperties); while (it2.hasNext()) { it2.next(); @@ -289,7 +289,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList QString xmlPropertyName = it2.value(); QString propertyValue = getStringPropertyFromMap(card, mtgjsonProperty); if (!propertyValue.isEmpty()) - setInfo.setProperty(xmlPropertyName, propertyValue); + printingInfo.setProperty(xmlPropertyName, propertyValue); } // Identifiers @@ -300,12 +300,12 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList auto xmlPropertyName = it3.value(); auto propertyValue = getStringPropertyFromMap(card.value("identifiers").toMap(), mtgjsonProperty); if (!propertyValue.isEmpty()) { - setInfo.setProperty(xmlPropertyName, propertyValue); + printingInfo.setProperty(xmlPropertyName, propertyValue); } } QString numComponent; - const QString numProperty = setInfo.getProperty("num"); + const QString numProperty = printingInfo.getProperty("num"); const QChar lastChar = numProperty.isEmpty() ? QChar() : numProperty.back(); // Un-Sets do some wonky stuff. Split up these cards as individual entries. @@ -353,7 +353,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList // split cards are considered a single card, enqueue for later merging if (layout == "split" || layout == "aftermath" || layout == "adventure") { auto _faceName = getStringPropertyFromMap(card, "faceName"); - SplitCardPart split(_faceName, text, properties, setInfo); + SplitCardPart split(_faceName, text, properties, printingInfo); auto found_iter = splitCards.find(name + numProperty); if (found_iter == splitCards.end()) { splitCards.insert(name + numProperty, {{split}, name}); @@ -404,7 +404,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList } } - CardInfoPtr newCard = addCard(name + numComponent, text, isToken, properties, relatedCards, setInfo); + CardInfoPtr newCard = addCard(name + numComponent, text, isToken, properties, relatedCards, printingInfo); numCards++; } } @@ -430,7 +430,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList if (properties.isEmpty()) { properties = tmp.getProperties(); - setInfo = tmp.getSetInfo(); + printingInfo = tmp.getPrintingInfo(); } else { const QVariantHash &tmpProps = tmp.getProperties(); for (const QString &prop : tmpProps.keys()) { @@ -451,7 +451,7 @@ int OracleImporter::importCardsFromSet(const CardSetPtr ¤tSet, const QList } } } - CardInfoPtr newCard = addCard(name, text, isToken, properties, relatedCards, setInfo); + CardInfoPtr newCard = addCard(name, text, isToken, properties, relatedCards, printingInfo); numCards++; } diff --git a/oracle/src/oracleimporter.h b/oracle/src/oracleimporter.h index db36e25de..4d5d77805 100644 --- a/oracle/src/oracleimporter.h +++ b/oracle/src/oracleimporter.h @@ -95,7 +95,7 @@ public: SplitCardPart(const QString &_name, const QString &_text, const QVariantHash &_properties, - const PrintingInfo &setInfo); + const PrintingInfo &_printingInfo); inline const QString &getName() const { return name; @@ -108,16 +108,16 @@ public: { return properties; } - inline const PrintingInfo &getSetInfo() const + inline const PrintingInfo &getPrintingInfo() const { - return setInfo; + return printingInfo; } private: QString name; QString text; QVariantHash properties; - PrintingInfo setInfo; + PrintingInfo printingInfo; }; class OracleImporter : public QObject @@ -143,7 +143,7 @@ private: bool isToken, QVariantHash properties, const QList &relatedCards, - const PrintingInfo &setInfo); + const PrintingInfo &printingInfo); signals: void setIndexChanged(int cardsImported, int setIndex, const QString &setName); void dataReadProgress(int bytesRead, int totalBytes);