mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 07:22:16 -07:00
Refactor: use ExactCard to represent specific printings (#6049)
* Create new class * Update CardInfo and CardDatabase * Use new class instead of CardInfoPtr * fix cmake
This commit is contained in:
parent
4a2a646943
commit
ae2c55c33b
79 changed files with 715 additions and 642 deletions
|
|
@ -99,7 +99,7 @@ void CardGroupDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithText
|
|||
emit cardClicked(event, card);
|
||||
}
|
||||
|
||||
void CardGroupDisplayWidget::onHover(CardInfoPtr card)
|
||||
void CardGroupDisplayWidget::onHover(const ExactCard &card)
|
||||
{
|
||||
emit cardHovered(card);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card);
|
||||
void onHover(CardInfoPtr card);
|
||||
void onHover(const ExactCard &card);
|
||||
virtual QWidget *constructWidgetForIndex(int rowIndex);
|
||||
virtual void updateCardDisplays();
|
||||
virtual void onCardAddition(const QModelIndex &parent, int first, int last);
|
||||
|
|
@ -46,7 +46,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void cardClicked(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card);
|
||||
void cardHovered(CardInfoPtr card);
|
||||
void cardHovered(const ExactCard &card);
|
||||
void cleanupRequested(CardGroupDisplayWidget *cardGroupDisplayWidget);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <utility>
|
||||
|
||||
CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *parent, Qt::WindowFlags flags)
|
||||
: QFrame(parent, flags), aspectRatio((qreal)CARD_HEIGHT / (qreal)CARD_WIDTH), info(nullptr)
|
||||
: QFrame(parent, flags), aspectRatio((qreal)CARD_HEIGHT / (qreal)CARD_WIDTH)
|
||||
{
|
||||
setContentsMargins(3, 3, 3, 3);
|
||||
pic = new CardInfoPictureWidget();
|
||||
|
|
@ -43,32 +43,32 @@ CardInfoDisplayWidget::CardInfoDisplayWidget(const CardRef &cardRef, QWidget *pa
|
|||
resize(width(), sizeHint().height());
|
||||
}
|
||||
|
||||
void CardInfoDisplayWidget::setCard(CardInfoPtr card)
|
||||
void CardInfoDisplayWidget::setCard(const ExactCard &card)
|
||||
{
|
||||
if (info)
|
||||
disconnect(info.data(), nullptr, this, nullptr);
|
||||
info = std::move(card);
|
||||
if (info)
|
||||
connect(info.data(), &QObject::destroyed, this, &CardInfoDisplayWidget::clear);
|
||||
if (exactCard)
|
||||
disconnect(exactCard.getCardPtr().data(), nullptr, this, nullptr);
|
||||
exactCard = card;
|
||||
if (exactCard)
|
||||
connect(exactCard.getCardPtr().data(), &QObject::destroyed, this, &CardInfoDisplayWidget::clear);
|
||||
|
||||
text->setCard(info);
|
||||
pic->setCard(info);
|
||||
text->setCard(exactCard.getCardPtr());
|
||||
pic->setCard(exactCard);
|
||||
}
|
||||
|
||||
void CardInfoDisplayWidget::setCard(const CardRef &cardRef)
|
||||
{
|
||||
setCard(CardDatabaseManager::getInstance()->guessCard(cardRef));
|
||||
if (info == nullptr) {
|
||||
if (exactCard.isEmpty()) {
|
||||
text->setInvalidCardName(cardRef.name);
|
||||
}
|
||||
}
|
||||
|
||||
void CardInfoDisplayWidget::setCard(AbstractCardItem *card)
|
||||
{
|
||||
setCard(card->getInfo());
|
||||
setCard(card->getCard());
|
||||
}
|
||||
|
||||
void CardInfoDisplayWidget::clear()
|
||||
{
|
||||
setCard((CardInfoPtr) nullptr);
|
||||
setCard(ExactCard());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CARDINFOWIDGET_H
|
||||
#define CARDINFOWIDGET_H
|
||||
|
||||
#include "../../../../game/cards/card_info.h"
|
||||
#include "../../../../game/cards/exact_card.h"
|
||||
#include "card_ref.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
|
@ -18,7 +18,7 @@ class CardInfoDisplayWidget : public QFrame
|
|||
|
||||
private:
|
||||
qreal aspectRatio;
|
||||
CardInfoPtr info;
|
||||
ExactCard exactCard;
|
||||
CardInfoPictureWidget *pic;
|
||||
CardInfoTextWidget *text;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ public:
|
|||
explicit CardInfoDisplayWidget(const CardRef &cardRef, QWidget *parent = nullptr, Qt::WindowFlags f = {});
|
||||
|
||||
public slots:
|
||||
void setCard(CardInfoPtr card);
|
||||
void setCard(const ExactCard &card);
|
||||
void setCard(const CardRef &cardRef);
|
||||
void setCard(AbstractCardItem *card);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@
|
|||
#include <utility>
|
||||
|
||||
CardInfoFrameWidget::CardInfoFrameWidget(QWidget *parent)
|
||||
: QTabWidget(parent), info(nullptr), viewTransformationButton(nullptr), cardTextOnly(false)
|
||||
: QTabWidget(parent), viewTransformationButton(nullptr), cardTextOnly(false)
|
||||
{
|
||||
setContentsMargins(3, 3, 3, 3);
|
||||
pic = new CardInfoPictureWidget();
|
||||
pic->setObjectName("pic");
|
||||
connect(pic, &CardInfoPictureWidget::cardChanged, this, qOverload<CardInfoPtr>(&CardInfoFrameWidget::setCard));
|
||||
connect(pic, &CardInfoPictureWidget::cardChanged, this,
|
||||
qOverload<const ExactCard &>(&CardInfoFrameWidget::setCard));
|
||||
|
||||
text = new CardInfoTextWidget();
|
||||
text->setObjectName("text");
|
||||
|
|
@ -129,13 +130,9 @@ void CardInfoFrameWidget::setViewMode(int mode)
|
|||
SettingsCache::instance().setCardInfoViewMode(mode);
|
||||
}
|
||||
|
||||
static bool hasTransformation(const CardInfoPtr &info)
|
||||
static bool hasTransformation(const CardInfo &info)
|
||||
{
|
||||
if (!info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto &cardRelation : info->getAllRelatedCards()) {
|
||||
for (const auto &cardRelation : info.getAllRelatedCards()) {
|
||||
if (cardRelation->getDoesTransform()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -143,22 +140,22 @@ static bool hasTransformation(const CardInfoPtr &info)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CardInfoFrameWidget::setCard(CardInfoPtr card)
|
||||
void CardInfoFrameWidget::setCard(const ExactCard &card)
|
||||
{
|
||||
if (info) {
|
||||
disconnect(info.data(), nullptr, this, nullptr);
|
||||
if (exactCard) {
|
||||
disconnect(exactCard.getCardPtr().data(), nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
info = std::move(card);
|
||||
exactCard = card;
|
||||
|
||||
if (info) {
|
||||
connect(info.data(), &QObject::destroyed, this, &CardInfoFrameWidget::clearCard);
|
||||
if (exactCard) {
|
||||
connect(exactCard.getCardPtr().data(), &QObject::destroyed, this, &CardInfoFrameWidget::clearCard);
|
||||
}
|
||||
|
||||
setViewTransformationButtonVisibility(hasTransformation(info));
|
||||
setViewTransformationButtonVisibility(hasTransformation(exactCard.getInfo()));
|
||||
|
||||
text->setCard(info);
|
||||
pic->setCard(info);
|
||||
text->setCard(exactCard.getCardPtr());
|
||||
pic->setCard(exactCard);
|
||||
}
|
||||
|
||||
void CardInfoFrameWidget::setCard(const QString &cardName)
|
||||
|
|
@ -174,14 +171,14 @@ void CardInfoFrameWidget::setCard(const CardRef &cardRef)
|
|||
void CardInfoFrameWidget::setCard(AbstractCardItem *card)
|
||||
{
|
||||
if (card) {
|
||||
setCard(card->getInfo());
|
||||
setCard(card->getCard());
|
||||
}
|
||||
}
|
||||
|
||||
void CardInfoFrameWidget::viewTransformation()
|
||||
{
|
||||
if (info) {
|
||||
const auto &cardRelations = info->getAllRelatedCards();
|
||||
if (exactCard) {
|
||||
const auto &cardRelations = exactCard.getInfo().getAllRelatedCards();
|
||||
for (const auto &cardRelation : cardRelations) {
|
||||
if (cardRelation->getDoesTransform()) {
|
||||
setCard(cardRelation->getName());
|
||||
|
|
@ -193,5 +190,5 @@ void CardInfoFrameWidget::viewTransformation()
|
|||
|
||||
void CardInfoFrameWidget::clearCard()
|
||||
{
|
||||
setCard((CardInfoPtr) nullptr);
|
||||
setCard(ExactCard());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CARDFRAME_H
|
||||
#define CARDFRAME_H
|
||||
|
||||
#include "../../../../game/cards/card_info.h"
|
||||
#include "../../../../game/cards/exact_card.h"
|
||||
#include "card_ref.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
|
@ -17,7 +17,7 @@ class CardInfoFrameWidget : public QTabWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
CardInfoPtr info;
|
||||
ExactCard exactCard;
|
||||
CardInfoPictureWidget *pic;
|
||||
CardInfoTextWidget *text;
|
||||
QPushButton *viewTransformationButton;
|
||||
|
|
@ -38,14 +38,14 @@ public:
|
|||
};
|
||||
|
||||
explicit CardInfoFrameWidget(QWidget *parent = nullptr);
|
||||
CardInfoPtr getInfo()
|
||||
ExactCard getCard()
|
||||
{
|
||||
return info;
|
||||
return exactCard;
|
||||
}
|
||||
void retranslateUi();
|
||||
|
||||
public slots:
|
||||
void setCard(CardInfoPtr card);
|
||||
void setCard(const ExactCard &card);
|
||||
void setCard(const QString &cardName);
|
||||
void setCard(const CardRef &cardRef);
|
||||
void setCard(AbstractCardItem *card);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@
|
|||
*
|
||||
* Sets the widget's window flags to keep it displayed as a tooltip overlay.
|
||||
*/
|
||||
CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent)
|
||||
: QWidget(parent), pixmapDirty(true), info(nullptr)
|
||||
CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent) : QWidget(parent), pixmapDirty(true)
|
||||
{
|
||||
setWindowFlags(Qt::ToolTip); // Keeps this widget on top of everything
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
|
@ -35,8 +34,8 @@ CardInfoPictureEnlargedWidget::CardInfoPictureEnlargedWidget(QWidget *parent)
|
|||
*/
|
||||
void CardInfoPictureEnlargedWidget::loadPixmap(const QSize &size)
|
||||
{
|
||||
if (info) {
|
||||
PictureLoader::getPixmap(enlargedPixmap, info, size);
|
||||
if (card) {
|
||||
PictureLoader::getPixmap(enlargedPixmap, card, size);
|
||||
} else {
|
||||
PictureLoader::getCardBackPixmap(enlargedPixmap, size);
|
||||
}
|
||||
|
|
@ -45,14 +44,14 @@ void CardInfoPictureEnlargedWidget::loadPixmap(const QSize &size)
|
|||
|
||||
/**
|
||||
* @brief Sets the pixmap for the widget based on a provided card.
|
||||
* @param card The card information to load.
|
||||
* @param _card The card information to load.
|
||||
* @param size The desired size for the pixmap.
|
||||
*
|
||||
* Sets the widget's pixmap to the card image and resizes the widget to match the specified size. Triggers a repaint.
|
||||
*/
|
||||
void CardInfoPictureEnlargedWidget::setCardPixmap(CardInfoPtr card, const QSize size)
|
||||
void CardInfoPictureEnlargedWidget::setCardPixmap(const ExactCard &_card, const QSize size)
|
||||
{
|
||||
info = std::move(card);
|
||||
card = _card;
|
||||
loadPixmap(size);
|
||||
|
||||
setFixedSize(size); // Set the widget size to the enlarged size
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CARD_PICTURE_ENLARGED_WIDGET_H
|
||||
#define CARD_PICTURE_ENLARGED_WIDGET_H
|
||||
|
||||
#include "../../../../game/cards/card_info.h"
|
||||
#include "../../../../game/cards/exact_card.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
|
@ -15,7 +15,7 @@ public:
|
|||
explicit CardInfoPictureEnlargedWidget(QWidget *parent = nullptr);
|
||||
|
||||
// Sets the card pixmap to display
|
||||
void setCardPixmap(CardInfoPtr card, QSize size);
|
||||
void setCardPixmap(const ExactCard &_card, QSize size);
|
||||
|
||||
protected:
|
||||
// Handles the painting event for the enlarged card
|
||||
|
|
@ -28,8 +28,8 @@ private:
|
|||
// Tracks if the pixmap needs to be refreshed/redrawn
|
||||
bool pixmapDirty;
|
||||
|
||||
// Card information (card data pointer)
|
||||
CardInfoPtr info;
|
||||
// Card information
|
||||
ExactCard card;
|
||||
|
||||
// Loads the enlarged card pixmap
|
||||
void loadPixmap(const QSize &size);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@
|
|||
* Initializes the widget with a minimum height and sets the pixmap to a dirty state for initial loading.
|
||||
*/
|
||||
CardInfoPictureWidget::CardInfoPictureWidget(QWidget *parent, const bool _hoverToZoomEnabled, const bool _raiseOnEnter)
|
||||
: QWidget(parent), info(nullptr), pixmapDirty(true), hoverToZoomEnabled(_hoverToZoomEnabled),
|
||||
raiseOnEnter(_raiseOnEnter)
|
||||
: QWidget(parent), pixmapDirty(true), hoverToZoomEnabled(_hoverToZoomEnabled), raiseOnEnter(_raiseOnEnter)
|
||||
{
|
||||
setMinimumHeight(baseHeight);
|
||||
if (hoverToZoomEnabled) {
|
||||
|
|
@ -77,16 +76,16 @@ CardInfoPictureWidget::~CardInfoPictureWidget()
|
|||
* Disconnects any existing signal connections from the previous card info and connects to the `pixmapUpdated`
|
||||
* signal of the new card to automatically update the pixmap when the card image changes.
|
||||
*/
|
||||
void CardInfoPictureWidget::setCard(CardInfoPtr card)
|
||||
void CardInfoPictureWidget::setCard(const ExactCard &card)
|
||||
{
|
||||
if (info) {
|
||||
disconnect(info.data(), nullptr, this, nullptr);
|
||||
if (exactCard.getCardPtr()) {
|
||||
disconnect(exactCard.getCardPtr().data(), nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
info = std::move(card);
|
||||
exactCard = card;
|
||||
|
||||
if (info) {
|
||||
connect(info.data(), &CardInfo::pixmapUpdated, this, &CardInfoPictureWidget::updatePixmap);
|
||||
if (exactCard.getCardPtr()) {
|
||||
connect(exactCard.getCardPtr().data(), &CardInfo::pixmapUpdated, this, &CardInfoPictureWidget::updatePixmap);
|
||||
}
|
||||
|
||||
updatePixmap();
|
||||
|
|
@ -158,8 +157,8 @@ void CardInfoPictureWidget::updatePixmap()
|
|||
void CardInfoPictureWidget::loadPixmap()
|
||||
{
|
||||
PictureLoader::getCardBackLoadingInProgressPixmap(resizedPixmap, size());
|
||||
if (info) {
|
||||
PictureLoader::getPixmap(resizedPixmap, info, size());
|
||||
if (exactCard) {
|
||||
PictureLoader::getPixmap(resizedPixmap, exactCard, size());
|
||||
} else {
|
||||
PictureLoader::getCardBackLoadingFailedPixmap(resizedPixmap, size());
|
||||
}
|
||||
|
|
@ -188,7 +187,7 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
|||
|
||||
QPixmap transformedPixmap = resizedPixmap; // Default pixmap
|
||||
if (SettingsCache::instance().getAutoRotateSidewaysLayoutCards()) {
|
||||
if (info && info->getLandscapeOrientation()) {
|
||||
if (exactCard.getInfo().getLandscapeOrientation()) {
|
||||
// Rotate pixmap 90 degrees to the left
|
||||
QTransform transform;
|
||||
transform.rotate(90);
|
||||
|
|
@ -257,7 +256,7 @@ void CardInfoPictureWidget::enterEvent(QEvent *event)
|
|||
}
|
||||
|
||||
// Emit signal indicating a card is being hovered on
|
||||
emit hoveredOnCard(info);
|
||||
emit hoveredOnCard(exactCard);
|
||||
|
||||
if (raiseOnEnter) {
|
||||
if (animation->state() == QAbstractAnimation::Running) {
|
||||
|
|
@ -357,7 +356,7 @@ QMenu *CardInfoPictureWidget::createRightClickMenu()
|
|||
{
|
||||
auto *cardMenu = new QMenu(this);
|
||||
|
||||
if (!info) {
|
||||
if (!exactCard) {
|
||||
return cardMenu;
|
||||
}
|
||||
|
||||
|
|
@ -371,7 +370,7 @@ QMenu *CardInfoPictureWidget::createViewRelatedCardsMenu()
|
|||
{
|
||||
auto viewRelatedCards = new QMenu(tr("View related cards"));
|
||||
|
||||
QList<CardRelation *> relatedCards = info->getAllRelatedCards();
|
||||
QList<CardRelation *> relatedCards = exactCard.getInfo().getAllRelatedCards();
|
||||
|
||||
auto relatedCardExists = [](const CardRelation *cardRelation) {
|
||||
return CardDatabaseManager::getInstance()->getCardInfo(cardRelation->getName()) != nullptr;
|
||||
|
|
@ -388,7 +387,8 @@ QMenu *CardInfoPictureWidget::createViewRelatedCardsMenu()
|
|||
const auto &relatedCardName = relatedCard->getName();
|
||||
QAction *viewCard = viewRelatedCards->addAction(relatedCardName);
|
||||
connect(viewCard, &QAction::triggered, this, [this, &relatedCardName] {
|
||||
emit cardChanged(CardDatabaseManager::getInstance()->getCardInfo(relatedCardName));
|
||||
emit cardChanged(
|
||||
CardDatabaseManager::getInstance()->getCard({relatedCardName, exactCard.getPrinting().getUuid()}));
|
||||
});
|
||||
viewRelatedCards->addAction(viewCard);
|
||||
}
|
||||
|
|
@ -428,14 +428,14 @@ QMenu *CardInfoPictureWidget::createAddToOpenDeckMenu()
|
|||
|
||||
QAction *addCard = addCardMenu->addAction(tr("Mainboard"));
|
||||
connect(addCard, &QAction::triggered, this, [this, deckEditorTab] {
|
||||
deckEditorTab->updateCard(info);
|
||||
deckEditorTab->actAddCard(info);
|
||||
deckEditorTab->updateCard(exactCard);
|
||||
deckEditorTab->actAddCard(exactCard);
|
||||
});
|
||||
|
||||
QAction *addCardSideboard = addCardMenu->addAction(tr("Sideboard"));
|
||||
connect(addCardSideboard, &QAction::triggered, this, [this, deckEditorTab] {
|
||||
deckEditorTab->updateCard(info);
|
||||
deckEditorTab->actAddCardToSideboard(info);
|
||||
deckEditorTab->updateCard(exactCard);
|
||||
deckEditorTab->actAddCardToSideboard(exactCard);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -450,12 +450,12 @@ QMenu *CardInfoPictureWidget::createAddToOpenDeckMenu()
|
|||
*/
|
||||
void CardInfoPictureWidget::showEnlargedPixmap() const
|
||||
{
|
||||
if (!info) {
|
||||
if (!exactCard) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QSize enlargedSize(static_cast<int>(size().width() * 2), static_cast<int>(size().width() * aspectRatio * 2));
|
||||
enlargedPixmapWidget->setCardPixmap(info, enlargedSize);
|
||||
enlargedPixmapWidget->setCardPixmap(exactCard, enlargedSize);
|
||||
|
||||
const QPoint cursorPos = QCursor::pos();
|
||||
const QRect screenGeometry = QGuiApplication::screenAt(cursorPos)->geometry();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CARD_INFO_PICTURE_H
|
||||
#define CARD_INFO_PICTURE_H
|
||||
|
||||
#include "../../../../game/cards/card_info.h"
|
||||
#include "../../../../game/cards/exact_card.h"
|
||||
#include "card_info_picture_enlarged_widget.h"
|
||||
|
||||
#include <QPropertyAnimation>
|
||||
|
|
@ -22,23 +22,23 @@ public:
|
|||
bool hoverToZoomEnabled = false,
|
||||
bool raiseOnEnter = false);
|
||||
~CardInfoPictureWidget();
|
||||
CardInfoPtr getInfo()
|
||||
ExactCard getCard()
|
||||
{
|
||||
return info;
|
||||
return exactCard;
|
||||
}
|
||||
[[nodiscard]] QSize sizeHint() const override;
|
||||
|
||||
public slots:
|
||||
void setCard(CardInfoPtr card);
|
||||
void setCard(const ExactCard &card);
|
||||
void setScaleFactor(int scale); // New slot for scaling
|
||||
void setHoverToZoomEnabled(bool enabled);
|
||||
void setRaiseOnEnterEnabled(bool enabled);
|
||||
void updatePixmap();
|
||||
|
||||
signals:
|
||||
void hoveredOnCard(CardInfoPtr hoveredCard);
|
||||
void hoveredOnCard(const ExactCard &hoveredCard);
|
||||
void cardScaleFactorChanged(int _scale);
|
||||
void cardChanged(CardInfoPtr card);
|
||||
void cardChanged(const ExactCard &card);
|
||||
void cardClicked();
|
||||
|
||||
protected:
|
||||
|
|
@ -62,7 +62,7 @@ protected:
|
|||
void showEnlargedPixmap() const;
|
||||
|
||||
private:
|
||||
CardInfoPtr info;
|
||||
ExactCard exactCard;
|
||||
qreal magicTheGatheringCardAspectRatio = 1.396;
|
||||
qreal yuGiOhCardAspectRatio = 1.457;
|
||||
qreal aspectRatio = magicTheGatheringCardAspectRatio;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void DeckCardZoneDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWithT
|
|||
{
|
||||
emit cardClicked(event, card, zoneName);
|
||||
}
|
||||
void DeckCardZoneDisplayWidget::onHover(CardInfoPtr card)
|
||||
void DeckCardZoneDisplayWidget::onHover(const ExactCard &card)
|
||||
{
|
||||
emit cardHovered(card);
|
||||
}
|
||||
|
|
@ -181,10 +181,10 @@ QList<QString> DeckCardZoneDisplayWidget::getGroupCriteriaValueList()
|
|||
{
|
||||
QList<QString> groupCriteriaValues;
|
||||
|
||||
QList<CardInfoPtr> cardsInZone = deckListModel->getCardsAsCardInfoPtrsForZone(zoneName);
|
||||
QList<ExactCard> cardsInZone = deckListModel->getCardsForZone(zoneName);
|
||||
|
||||
for (CardInfoPtr cardInZone : cardsInZone) {
|
||||
groupCriteriaValues.append(cardInZone->getProperty(activeGroupCriteria));
|
||||
for (const ExactCard &cardInZone : cardsInZone) {
|
||||
groupCriteriaValues.append(cardInZone.getInfo().getProperty(activeGroupCriteria));
|
||||
}
|
||||
|
||||
groupCriteriaValues.removeDuplicates();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card);
|
||||
void onHover(CardInfoPtr card);
|
||||
void onHover(const ExactCard &card);
|
||||
void cleanupInvalidCardGroup(CardGroupDisplayWidget *displayWidget);
|
||||
void constructAppropriateWidget(QPersistentModelIndex index);
|
||||
void displayCards();
|
||||
|
|
@ -49,7 +49,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void cardClicked(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *card, QString zoneName);
|
||||
void cardHovered(CardInfoPtr card);
|
||||
void cardHovered(const ExactCard &card);
|
||||
void activeSortCriteriaChanged(QStringList activeSortCriteria);
|
||||
void requestCleanup(DeckCardZoneDisplayWidget *displayWidget);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void DeckEditorCardInfoDockWidget::createCardInfoDock()
|
|||
connect(this, &QDockWidget::topLevelChanged, deckEditor, &AbstractTabDeckEditor::dockTopLevelChanged);
|
||||
}
|
||||
|
||||
void DeckEditorCardInfoDockWidget::updateCard(CardInfoPtr _card)
|
||||
void DeckEditorCardInfoDockWidget::updateCard(const ExactCard &_card)
|
||||
{
|
||||
cardInfo->setCard(_card);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
CardInfoFrameWidget *cardInfo;
|
||||
|
||||
public slots:
|
||||
void updateCard(CardInfoPtr _card);
|
||||
void updateCard(const ExactCard &_card);
|
||||
};
|
||||
|
||||
#endif // DECK_EDITOR_CARD_INFO_DOCK_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
#include <QToolButton>
|
||||
#include <QTreeView>
|
||||
|
||||
static bool canBeCommander(const CardInfoPtr &cardInfo)
|
||||
static bool canBeCommander(const CardInfo &cardInfo)
|
||||
{
|
||||
return ((cardInfo->getCardType().contains("Legendary", Qt::CaseInsensitive) &&
|
||||
cardInfo->getCardType().contains("Creature", Qt::CaseInsensitive))) ||
|
||||
cardInfo->getText().contains("can be your commander", Qt::CaseInsensitive);
|
||||
return (cardInfo.getCardType().contains("Legendary", Qt::CaseInsensitive) &&
|
||||
cardInfo.getCardType().contains("Creature", Qt::CaseInsensitive)) ||
|
||||
cardInfo.getText().contains("can be your commander", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(AbstractTabDeckEditor *parent)
|
||||
|
|
@ -136,42 +136,38 @@ void DeckEditorDatabaseDisplayWidget::clearAllDatabaseFilters()
|
|||
void DeckEditorDatabaseDisplayWidget::updateCard(const QModelIndex ¤t, const QModelIndex & /*previous*/)
|
||||
{
|
||||
const QString cardName = current.sibling(current.row(), 0).data().toString();
|
||||
const QString cardProviderID = CardDatabaseManager::getInstance()->getPreferredPrintingProviderId(cardName);
|
||||
|
||||
if (!current.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
CardInfoPtr card = CardDatabaseManager::getInstance()->getCard({cardName, cardProviderID});
|
||||
if (!card) {
|
||||
card = CardDatabaseManager::getInstance()->getCardInfo(cardName);
|
||||
}
|
||||
ExactCard card = CardDatabaseManager::getInstance()->getCard({cardName});
|
||||
emit cardChanged(card);
|
||||
}
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck()
|
||||
{
|
||||
emit addCardToMainDeck(currentCardInfo());
|
||||
emit addCardToMainDeck(currentCard());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actAddCardToSideboard()
|
||||
{
|
||||
emit addCardToSideboard(currentCardInfo());
|
||||
emit addCardToSideboard(currentCard());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actDecrementCardFromMainDeck()
|
||||
{
|
||||
emit decrementCardFromMainDeck(currentCardInfo());
|
||||
emit decrementCardFromMainDeck(currentCard());
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::actDecrementCardFromSideboard()
|
||||
{
|
||||
emit decrementCardFromSideboard(currentCardInfo());
|
||||
emit decrementCardFromSideboard(currentCard());
|
||||
}
|
||||
|
||||
CardInfoPtr DeckEditorDatabaseDisplayWidget::currentCardInfo() const
|
||||
ExactCard DeckEditorDatabaseDisplayWidget::currentCard() const
|
||||
{
|
||||
const QModelIndex currentIndex = databaseView->selectionModel()->currentIndex();
|
||||
if (!currentIndex.isValid()) {
|
||||
|
|
@ -180,37 +176,37 @@ CardInfoPtr DeckEditorDatabaseDisplayWidget::currentCardInfo() const
|
|||
|
||||
const QString cardName = currentIndex.sibling(currentIndex.row(), 0).data().toString();
|
||||
|
||||
return CardDatabaseManager::getInstance()->getCardInfo(cardName);
|
||||
return CardDatabaseManager::getInstance()->getCard({cardName});
|
||||
}
|
||||
|
||||
void DeckEditorDatabaseDisplayWidget::databaseCustomMenu(QPoint point)
|
||||
{
|
||||
QMenu menu;
|
||||
const CardInfoPtr info = currentCardInfo();
|
||||
ExactCard card = currentCard();
|
||||
|
||||
if (info) {
|
||||
if (card) {
|
||||
// add to deck and sideboard options
|
||||
QAction *addToDeck, *addToSideboard, *selectPrinting, *edhRecCommander, *edhRecCard;
|
||||
addToDeck = menu.addAction(tr("Add to Deck"));
|
||||
addToSideboard = menu.addAction(tr("Add to Sideboard"));
|
||||
selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
if (canBeCommander(info)) {
|
||||
if (canBeCommander(card.getInfo())) {
|
||||
edhRecCommander = menu.addAction(tr("Show on EDHRec (Commander)"));
|
||||
connect(edhRecCommander, &QAction::triggered, this,
|
||||
[this, info] { deckEditor->getTabSupervisor()->addEdhrecTab(info, true); });
|
||||
[this, card] { deckEditor->getTabSupervisor()->addEdhrecTab(card.getCardPtr(), true); });
|
||||
}
|
||||
edhRecCard = menu.addAction(tr("Show on EDHRec (Card)"));
|
||||
|
||||
connect(addToDeck, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
|
||||
connect(addToSideboard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToSideboard);
|
||||
connect(selectPrinting, &QAction::triggered, this, [this, info] { deckEditor->showPrintingSelector(); });
|
||||
connect(selectPrinting, &QAction::triggered, this, [this, card] { deckEditor->showPrintingSelector(); });
|
||||
connect(edhRecCard, &QAction::triggered, this,
|
||||
[this, info] { deckEditor->getTabSupervisor()->addEdhrecTab(info); });
|
||||
[this, card] { deckEditor->getTabSupervisor()->addEdhrecTab(card.getCardPtr()); });
|
||||
|
||||
// filling out the related cards submenu
|
||||
auto *relatedMenu = new QMenu(tr("Show Related cards"));
|
||||
menu.addMenu(relatedMenu);
|
||||
auto relatedCards = info->getAllRelatedCards();
|
||||
auto relatedCards = card.getInfo().getAllRelatedCards();
|
||||
if (relatedCards.isEmpty()) {
|
||||
relatedMenu->setDisabled(true);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -22,16 +22,16 @@ public:
|
|||
CardDatabaseDisplayModel *databaseDisplayModel;
|
||||
|
||||
public slots:
|
||||
CardInfoPtr currentCardInfo() const;
|
||||
ExactCard currentCard() const;
|
||||
void setFilterTree(FilterTree *filterTree);
|
||||
void clearAllDatabaseFilters();
|
||||
|
||||
signals:
|
||||
void addCardToMainDeck(CardInfoPtr card);
|
||||
void addCardToSideboard(CardInfoPtr card);
|
||||
void decrementCardFromMainDeck(CardInfoPtr card);
|
||||
void decrementCardFromSideboard(CardInfoPtr card);
|
||||
void cardChanged(CardInfoPtr _card);
|
||||
void addCardToMainDeck(const ExactCard &card);
|
||||
void addCardToSideboard(const ExactCard &card);
|
||||
void decrementCardFromMainDeck(const ExactCard &card);
|
||||
void decrementCardFromSideboard(const ExactCard &card);
|
||||
void cardChanged(const ExactCard &_card);
|
||||
|
||||
private:
|
||||
KeySignals searchKeySignals;
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
|||
retranslateUi();
|
||||
}
|
||||
|
||||
CardInfoPtr DeckEditorDeckDockWidget::getCurrentCard()
|
||||
ExactCard DeckEditorDeckDockWidget::getCurrentCard()
|
||||
{
|
||||
QModelIndex current = deckView->selectionModel()->currentIndex();
|
||||
if (!current.isValid())
|
||||
|
|
@ -227,7 +227,7 @@ CardInfoPtr DeckEditorDeckDockWidget::getCurrentCard()
|
|||
if (!current.model()->hasChildren(current.sibling(current.row(), 0))) {
|
||||
QString cardName = current.sibling(current.row(), 1).data().toString();
|
||||
QString providerId = current.sibling(current.row(), 4).data().toString();
|
||||
if (CardInfoPtr selectedCard = CardDatabaseManager::getInstance()->getCard({cardName, providerId})) {
|
||||
if (ExactCard selectedCard = CardDatabaseManager::getInstance()->getCard({cardName, providerId})) {
|
||||
return selectedCard;
|
||||
}
|
||||
}
|
||||
|
|
@ -236,7 +236,7 @@ CardInfoPtr DeckEditorDeckDockWidget::getCurrentCard()
|
|||
|
||||
void DeckEditorDeckDockWidget::updateCard(const QModelIndex /*¤t*/, const QModelIndex & /*previous*/)
|
||||
{
|
||||
if (CardInfoPtr card = getCurrentCard()) {
|
||||
if (ExactCard card = getCurrentCard()) {
|
||||
emit cardChanged(card);
|
||||
}
|
||||
}
|
||||
|
|
@ -286,8 +286,7 @@ void DeckEditorDeckDockWidget::updateBannerCardComboBox()
|
|||
continue;
|
||||
|
||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCard(currentCard->toCardRef());
|
||||
if (info) {
|
||||
if (CardDatabaseManager::getInstance()->getCard(currentCard->toCardRef())) {
|
||||
bannerCardSet.insert({currentCard->getName(), currentCard->getCardProviderId()});
|
||||
}
|
||||
}
|
||||
|
|
@ -472,26 +471,26 @@ bool DeckEditorDeckDockWidget::swapCard(const QModelIndex ¤tIndex)
|
|||
offsetCountAtIndex(currentIndex, -1);
|
||||
const QString otherZoneName = zoneName == DECK_ZONE_MAIN ? DECK_ZONE_SIDE : DECK_ZONE_MAIN;
|
||||
|
||||
// Third argument (true) says create the card no matter what, even if not in DB
|
||||
QModelIndex newCardIndex = deckModel->addCard(
|
||||
cardName, CardDatabaseManager::getInstance()->getSpecificPrinting({cardName, cardProviderID}), otherZoneName,
|
||||
true);
|
||||
ExactCard card = CardDatabaseManager::getInstance()->getCard({cardName, cardProviderID});
|
||||
QModelIndex newCardIndex = card ? deckModel->addCard(card, otherZoneName)
|
||||
// Third argument (true) says create the card no matter what, even if not in DB
|
||||
: deckModel->addPreferredPrintingCard(cardName, otherZoneName, true);
|
||||
recursiveExpand(newCardIndex);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::actDecrementCard(CardInfoPtr info, QString zoneName)
|
||||
void DeckEditorDeckDockWidget::actDecrementCard(const ExactCard &card, QString zoneName)
|
||||
{
|
||||
if (!info)
|
||||
if (!card)
|
||||
return;
|
||||
if (info->getIsToken())
|
||||
if (card.getInfo().getIsToken())
|
||||
zoneName = DECK_ZONE_TOKENS;
|
||||
|
||||
QString providerId = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getUuid();
|
||||
QString collectorNumber = CardDatabaseManager::getInstance()->getSetInfoForCard(info).getProperty("num");
|
||||
QString providerId = card.getPrinting().getUuid();
|
||||
QString collectorNumber = card.getPrinting().getProperty("num");
|
||||
|
||||
QModelIndex idx = deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber);
|
||||
QModelIndex idx = deckModel->findCard(card.getName(), zoneName, providerId, collectorNumber);
|
||||
if (!idx.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -564,7 +563,6 @@ void DeckEditorDeckDockWidget::offsetCountAtIndex(const QModelIndex &idx, int of
|
|||
void DeckEditorDeckDockWidget::decklistCustomMenu(QPoint point)
|
||||
{
|
||||
QMenu menu;
|
||||
const CardInfoPtr info = getCurrentCard();
|
||||
|
||||
QAction *selectPrinting = menu.addAction(tr("Select Printing"));
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
QTreeView *deckView;
|
||||
QComboBox *bannerCardComboBox;
|
||||
void createDeckDock();
|
||||
CardInfoPtr getCurrentCard();
|
||||
ExactCard getCurrentCard();
|
||||
void retranslateUi();
|
||||
QString getDeckName()
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ public slots:
|
|||
DeckLoader *getDeckList();
|
||||
void actIncrement();
|
||||
bool swapCard(const QModelIndex &idx);
|
||||
void actDecrementCard(CardInfoPtr info, QString zoneName);
|
||||
void actDecrementCard(const ExactCard &card, QString zoneName);
|
||||
void actDecrementSelection();
|
||||
void actSwapCard();
|
||||
void actRemoveCard();
|
||||
|
|
@ -54,7 +54,7 @@ signals:
|
|||
void hashChanged();
|
||||
void deckChanged();
|
||||
void deckModified();
|
||||
void cardChanged(CardInfoPtr _card);
|
||||
void cardChanged(const ExactCard &_card);
|
||||
|
||||
private:
|
||||
AbstractTabDeckEditor *deckEditor;
|
||||
|
|
|
|||
|
|
@ -16,17 +16,15 @@
|
|||
* @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 printingInfo The printing information for the card.
|
||||
*/
|
||||
AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent,
|
||||
AbstractTabDeckEditor *deckEditor,
|
||||
DeckListModel *deckModel,
|
||||
QTreeView *deckView,
|
||||
QSlider *cardSizeSlider,
|
||||
CardInfoPtr rootCard,
|
||||
PrintingInfo printingInfo)
|
||||
const ExactCard &rootCard)
|
||||
: QWidget(parent), deckEditor(deckEditor), deckModel(deckModel), deckView(deckView), cardSizeSlider(cardSizeSlider),
|
||||
rootCard(rootCard), printingInfo(printingInfo)
|
||||
rootCard(rootCard)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
|
|
@ -35,11 +33,11 @@ AllZonesCardAmountWidget::AllZonesCardAmountWidget(QWidget *parent,
|
|||
setContentsMargins(5, 5, 5, 5); // Padding around the text
|
||||
|
||||
zoneLabelMainboard = new ShadowBackgroundLabel(this, tr("Mainboard"));
|
||||
buttonBoxMainboard = new CardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard,
|
||||
printingInfo, DECK_ZONE_MAIN);
|
||||
buttonBoxMainboard =
|
||||
new CardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard, DECK_ZONE_MAIN);
|
||||
zoneLabelSideboard = new ShadowBackgroundLabel(this, tr("Sideboard"));
|
||||
buttonBoxSideboard = new CardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard,
|
||||
printingInfo, DECK_ZONE_SIDE);
|
||||
buttonBoxSideboard =
|
||||
new CardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard, DECK_ZONE_SIDE);
|
||||
|
||||
layout->addWidget(zoneLabelMainboard, 0, Qt::AlignHCenter | Qt::AlignBottom);
|
||||
layout->addWidget(buttonBoxMainboard, 0, Qt::AlignHCenter | Qt::AlignTop);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ public:
|
|||
DeckListModel *deckModel,
|
||||
QTreeView *deckView,
|
||||
QSlider *cardSizeSlider,
|
||||
CardInfoPtr rootCard,
|
||||
PrintingInfo printingInfo);
|
||||
const ExactCard &rootCard);
|
||||
int getMainboardAmount();
|
||||
int getSideboardAmount();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
|
@ -35,8 +34,7 @@ private:
|
|||
DeckListModel *deckModel;
|
||||
QTreeView *deckView;
|
||||
QSlider *cardSizeSlider;
|
||||
CardInfoPtr rootCard;
|
||||
PrintingInfo printingInfo;
|
||||
ExactCard rootCard;
|
||||
QLabel *zoneLabelMainboard;
|
||||
CardAmountWidget *buttonBoxMainboard;
|
||||
QLabel *zoneLabelSideboard;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
* @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 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,
|
||||
|
|
@ -20,11 +19,10 @@ CardAmountWidget::CardAmountWidget(QWidget *parent,
|
|||
DeckListModel *deckModel,
|
||||
QTreeView *deckView,
|
||||
QSlider *cardSizeSlider,
|
||||
CardInfoPtr &rootCard,
|
||||
PrintingInfo &printingInfo,
|
||||
const ExactCard &rootCard,
|
||||
const QString &zoneName)
|
||||
: QWidget(parent), deckEditor(deckEditor), deckModel(deckModel), deckView(deckView), cardSizeSlider(cardSizeSlider),
|
||||
rootCard(rootCard), printingInfo(printingInfo), zoneName(zoneName), hovered(false)
|
||||
rootCard(rootCard), zoneName(zoneName), hovered(false)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
|
@ -142,18 +140,18 @@ void CardAmountWidget::updateCardCount()
|
|||
*/
|
||||
void CardAmountWidget::addPrinting(const QString &zone)
|
||||
{
|
||||
auto newCardIndex = deckModel->addCard(rootCard->getName(), printingInfo, zone);
|
||||
auto newCardIndex = deckModel->addCard(rootCard, zone);
|
||||
recursiveExpand(newCardIndex);
|
||||
QModelIndex find_card = deckModel->findCard(rootCard->getName(), zone);
|
||||
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(), printingInfo, zone);
|
||||
deckModel->addCard(rootCard, zone);
|
||||
}
|
||||
deckModel->removeRow(find_card.row(), find_card.parent());
|
||||
}
|
||||
newCardIndex =
|
||||
deckModel->findCard(rootCard->getName(), zone, printingInfo.getUuid(), printingInfo.getProperty("num"));
|
||||
newCardIndex = deckModel->findCard(rootCard.getName(), zone, rootCard.getPrinting().getUuid(),
|
||||
rootCard.getPrinting().getProperty("num"));
|
||||
deckView->setCurrentIndex(newCardIndex);
|
||||
deckView->setFocus(Qt::FocusReason::MouseFocusReason);
|
||||
deckEditor->setModified(true);
|
||||
|
|
@ -235,8 +233,8 @@ void CardAmountWidget::offsetCountAtIndex(const QModelIndex &idx, int offset)
|
|||
*/
|
||||
void CardAmountWidget::decrementCardHelper(const QString &zone)
|
||||
{
|
||||
QModelIndex idx =
|
||||
deckModel->findCard(rootCard->getName(), zone, printingInfo.getUuid(), printingInfo.getProperty("num"));
|
||||
QModelIndex idx = deckModel->findCard(rootCard.getName(), zone, rootCard.getPrinting().getUuid(),
|
||||
rootCard.getPrinting().getProperty("num"));
|
||||
offsetCountAtIndex(idx, -1);
|
||||
deckEditor->setModified(true);
|
||||
}
|
||||
|
|
@ -249,7 +247,7 @@ void CardAmountWidget::decrementCardHelper(const QString &zone)
|
|||
*/
|
||||
int CardAmountWidget::countCardsInZone(const QString &deckZone)
|
||||
{
|
||||
if (printingInfo.getUuid().isEmpty()) {
|
||||
if (rootCard.getPrinting().getUuid().isEmpty()) {
|
||||
return 0; // Cards without uuids/providerIds CANNOT match another card, they are undefined for us.
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +284,7 @@ int CardAmountWidget::countCardsInZone(const QString &deckZone)
|
|||
}
|
||||
|
||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||
if (currentCard->getCardProviderId() == printingInfo.getProperty("uuid")) {
|
||||
if (currentCard->getCardProviderId() == rootCard.getPrinting().getProperty("uuid")) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ public:
|
|||
DeckListModel *deckModel,
|
||||
QTreeView *deckView,
|
||||
QSlider *cardSizeSlider,
|
||||
CardInfoPtr &rootCard,
|
||||
PrintingInfo &printingInfo,
|
||||
const ExactCard &rootCard,
|
||||
const QString &zoneName);
|
||||
int countCardsInZone(const QString &deckZone);
|
||||
|
||||
|
|
@ -40,8 +39,7 @@ private:
|
|||
DeckListModel *deckModel;
|
||||
QTreeView *deckView;
|
||||
QSlider *cardSizeSlider;
|
||||
CardInfoPtr rootCard;
|
||||
PrintingInfo printingInfo;
|
||||
ExactCard rootCard;
|
||||
QString zoneName;
|
||||
QHBoxLayout *layout;
|
||||
DynamicFontSizePushButton *incrementButton;
|
||||
|
|
|
|||
|
|
@ -218,9 +218,9 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
|||
|
||||
connect(widgetLoadingBufferTimer, &QTimer::timeout, this, [=, this]() mutable {
|
||||
for (int i = 0; i < BATCH_SIZE && currentIndex < printingsToUse.size(); ++i, ++currentIndex) {
|
||||
auto *cardDisplayWidget = new PrintingSelectorCardDisplayWidget(this, deckEditor, deckModel, deckView,
|
||||
cardSizeWidget->getSlider(), selectedCard,
|
||||
printingsToUse[currentIndex], currentZone);
|
||||
ExactCard card = ExactCard(selectedCard, printingsToUse[currentIndex]);
|
||||
auto *cardDisplayWidget = new PrintingSelectorCardDisplayWidget(
|
||||
this, deckEditor, deckModel, deckView, cardSizeWidget->getSlider(), card, currentZone);
|
||||
flowWidget->addWidget(cardDisplayWidget);
|
||||
cardDisplayWidget->clampSetNameToPicture();
|
||||
connect(cardDisplayWidget, &PrintingSelectorCardDisplayWidget::cardPreferenceChanged, this,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
* @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 _printingInfo The printing info for the card being displayed.
|
||||
* @param _currentZone The current zone in which the card is located.
|
||||
*/
|
||||
PrintingSelectorCardDisplayWidget::PrintingSelectorCardDisplayWidget(QWidget *parent,
|
||||
|
|
@ -32,28 +31,27 @@ PrintingSelectorCardDisplayWidget::PrintingSelectorCardDisplayWidget(QWidget *pa
|
|||
DeckListModel *_deckModel,
|
||||
QTreeView *_deckView,
|
||||
QSlider *_cardSizeSlider,
|
||||
CardInfoPtr _rootCard,
|
||||
const PrintingInfo &_printingInfo,
|
||||
const ExactCard &_rootCard,
|
||||
QString &_currentZone)
|
||||
: QWidget(parent), deckEditor(_deckEditor), deckModel(_deckModel), deckView(_deckView),
|
||||
cardSizeSlider(_cardSizeSlider), rootCard(std::move(_rootCard)), printingInfo(_printingInfo),
|
||||
currentZone(_currentZone)
|
||||
cardSizeSlider(_cardSizeSlider), rootCard(_rootCard), currentZone(_currentZone)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
// Create the overlay widget for the card display
|
||||
overlayWidget = new PrintingSelectorCardOverlayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider,
|
||||
rootCard, _printingInfo);
|
||||
overlayWidget =
|
||||
new PrintingSelectorCardOverlayWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, rootCard);
|
||||
connect(overlayWidget, &PrintingSelectorCardOverlayWidget::cardPreferenceChanged, this,
|
||||
[this]() { emit cardPreferenceChanged(); });
|
||||
|
||||
CardSetPtr set = rootCard.getPrinting().getSet();
|
||||
|
||||
// Create the widget to display the set name and collector's number
|
||||
const QString combinedSetName =
|
||||
QString(_printingInfo.getSet()->getLongName() + " (" + _printingInfo.getSet()->getShortName() + ")");
|
||||
QString combinedSetName = QString(set->getLongName() + " (" + set->getShortName() + ")");
|
||||
setNameAndCollectorsNumberDisplayWidget = new SetNameAndCollectorsNumberDisplayWidget(
|
||||
this, combinedSetName, _printingInfo.getProperty("num"), cardSizeSlider);
|
||||
this, combinedSetName, rootCard.getPrinting().getProperty("num"), cardSizeSlider);
|
||||
|
||||
// Add the widgets to the layout
|
||||
layout->addWidget(overlayWidget, 0, Qt::AlignHCenter);
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ public:
|
|||
DeckListModel *_deckModel,
|
||||
QTreeView *_deckView,
|
||||
QSlider *_cardSizeSlider,
|
||||
CardInfoPtr _rootCard,
|
||||
const PrintingInfo &_printingInfo,
|
||||
const ExactCard &_rootCard,
|
||||
QString &_currentZone);
|
||||
|
||||
public slots:
|
||||
|
|
@ -37,9 +36,7 @@ private:
|
|||
DeckListModel *deckModel;
|
||||
QTreeView *deckView;
|
||||
QSlider *cardSizeSlider;
|
||||
CardInfoPtr rootCard;
|
||||
CardInfoPtr setCard;
|
||||
PrintingInfo printingInfo;
|
||||
ExactCard rootCard;
|
||||
QString currentZone;
|
||||
PrintingSelectorCardOverlayWidget *overlayWidget;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,17 +22,15 @@
|
|||
* @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 _printingInfo The printing-specific information for the card being displayed.
|
||||
*/
|
||||
PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *parent,
|
||||
AbstractTabDeckEditor *_deckEditor,
|
||||
DeckListModel *_deckModel,
|
||||
QTreeView *_deckView,
|
||||
QSlider *_cardSizeSlider,
|
||||
CardInfoPtr _rootCard,
|
||||
const PrintingInfo &_printingInfo)
|
||||
const ExactCard &_rootCard)
|
||||
: QWidget(parent), deckEditor(_deckEditor), deckModel(_deckModel), deckView(_deckView),
|
||||
cardSizeSlider(_cardSizeSlider), rootCard(std::move(_rootCard)), printingInfo(_printingInfo)
|
||||
cardSizeSlider(_cardSizeSlider), rootCard(_rootCard)
|
||||
{
|
||||
// Set up the main layout
|
||||
auto *mainLayout = new QVBoxLayout(this);
|
||||
|
|
@ -44,13 +42,12 @@ PrintingSelectorCardOverlayWidget::PrintingSelectorCardOverlayWidget(QWidget *pa
|
|||
cardInfoPicture = new CardInfoPictureWidget(this);
|
||||
cardInfoPicture->setMinimumSize(0, 0);
|
||||
cardInfoPicture->setScaleFactor(cardSizeSlider->value());
|
||||
setCard = CardDatabaseManager::getInstance()->getCard({rootCard->getName(), _printingInfo.getUuid()});
|
||||
cardInfoPicture->setCard(setCard);
|
||||
cardInfoPicture->setCard(_rootCard);
|
||||
mainLayout->addWidget(cardInfoPicture);
|
||||
|
||||
// Add AllZonesCardAmountWidget
|
||||
allZonesCardAmountWidget =
|
||||
new AllZonesCardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, setCard, _printingInfo);
|
||||
new AllZonesCardAmountWidget(this, deckEditor, deckModel, deckView, cardSizeSlider, _rootCard);
|
||||
|
||||
allZonesCardAmountWidget->raise(); // Ensure it's on top of the picture
|
||||
// Set initial visibility based on amounts
|
||||
|
|
@ -119,7 +116,7 @@ void PrintingSelectorCardOverlayWidget::enterEvent(QEvent *event)
|
|||
#endif
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
deckEditor->updateCard(setCard);
|
||||
deckEditor->updateCard(rootCard);
|
||||
|
||||
// Check if either mainboard or sideboard amount is greater than 0
|
||||
if (allZonesCardAmountWidget->getMainboardAmount() > 0 || allZonesCardAmountWidget->getSideboardAmount() > 0) {
|
||||
|
|
@ -170,19 +167,20 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point)
|
|||
menu.addMenu(preferenceMenu);
|
||||
|
||||
const auto &preferredProviderId =
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(rootCard->getName());
|
||||
const auto &cardProviderId = printingInfo.getUuid();
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(rootCard.getName());
|
||||
const auto &cardProviderId = rootCard.getPrinting().getUuid();
|
||||
|
||||
if (preferredProviderId.isEmpty() || preferredProviderId != cardProviderId) {
|
||||
auto *pinAction = preferenceMenu->addAction(tr("Pin Printing"));
|
||||
connect(pinAction, &QAction::triggered, this, [this, cardProviderId]() {
|
||||
SettingsCache::instance().cardOverrides().setCardPreferenceOverride({rootCard->getName(), cardProviderId});
|
||||
connect(pinAction, &QAction::triggered, this, [this] {
|
||||
SettingsCache::instance().cardOverrides().setCardPreferenceOverride(
|
||||
{rootCard.getName(), rootCard.getPrinting().getUuid()});
|
||||
emit cardPreferenceChanged();
|
||||
});
|
||||
} else {
|
||||
auto *unpinAction = preferenceMenu->addAction(tr("Unpin Printing"));
|
||||
connect(unpinAction, &QAction::triggered, this, [this, cardProviderId]() {
|
||||
SettingsCache::instance().cardOverrides().deleteCardPreferenceOverride(rootCard->getName());
|
||||
connect(unpinAction, &QAction::triggered, this, [this] {
|
||||
SettingsCache::instance().cardOverrides().deleteCardPreferenceOverride(rootCard.getName());
|
||||
emit cardPreferenceChanged();
|
||||
});
|
||||
}
|
||||
|
|
@ -190,7 +188,7 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point)
|
|||
// filling out the related cards submenu
|
||||
auto *relatedMenu = new QMenu(tr("Show Related cards"));
|
||||
menu.addMenu(relatedMenu);
|
||||
auto relatedCards = rootCard->getAllRelatedCards();
|
||||
auto relatedCards = rootCard.getInfo().getAllRelatedCards();
|
||||
if (relatedCards.isEmpty()) {
|
||||
relatedMenu->setDisabled(true);
|
||||
} else {
|
||||
|
|
@ -198,7 +196,7 @@ void PrintingSelectorCardOverlayWidget::customMenu(QPoint point)
|
|||
const QString &relatedCardName = rel->getName();
|
||||
QAction *relatedCard = relatedMenu->addAction(relatedCardName);
|
||||
connect(relatedCard, &QAction::triggered, deckEditor, [this, relatedCardName] {
|
||||
deckEditor->updateCard(CardDatabaseManager::getInstance()->getCardInfo(relatedCardName));
|
||||
deckEditor->updateCard(CardDatabaseManager::getInstance()->getCard({relatedCardName}));
|
||||
deckEditor->showPrintingSelector();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ public:
|
|||
DeckListModel *_deckModel,
|
||||
QTreeView *_deckView,
|
||||
QSlider *_cardSizeSlider,
|
||||
CardInfoPtr _rootCard,
|
||||
const PrintingInfo &_printingInfo);
|
||||
const ExactCard &_rootCard);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
|
@ -43,9 +42,7 @@ private:
|
|||
DeckListModel *deckModel;
|
||||
QTreeView *deckView;
|
||||
QSlider *cardSizeSlider;
|
||||
CardInfoPtr rootCard;
|
||||
CardInfoPtr setCard;
|
||||
PrintingInfo printingInfo;
|
||||
ExactCard rootCard;
|
||||
};
|
||||
|
||||
#endif // PRINTING_SELECTOR_CARD_OVERLAY_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ VisualDatabaseDisplayWidget::VisualDatabaseDisplayWidget(QWidget *parent,
|
|||
: QWidget(parent), deckEditor(_deckEditor), databaseModel(database_model),
|
||||
databaseDisplayModel(database_display_model)
|
||||
{
|
||||
cards = new QList<CardInfoPtr>;
|
||||
cards = new QList<ExactCard>;
|
||||
connect(databaseDisplayModel, &CardDatabaseDisplayModel::modelDirty, this,
|
||||
&VisualDatabaseDisplayWidget::modelDirty);
|
||||
|
||||
|
|
@ -183,12 +183,12 @@ void VisualDatabaseDisplayWidget::onClick(QMouseEvent *event, CardInfoPictureWit
|
|||
emit cardClickedDatabaseDisplay(event, instance);
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayWidget::onHover(const CardInfoPtr &hoveredCard)
|
||||
void VisualDatabaseDisplayWidget::onHover(const ExactCard &hoveredCard)
|
||||
{
|
||||
emit cardHoveredDatabaseDisplay(hoveredCard);
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayWidget::addCard(const CardInfoPtr &cardToAdd)
|
||||
void VisualDatabaseDisplayWidget::addCard(const ExactCard &cardToAdd)
|
||||
{
|
||||
cards->append(cardToAdd);
|
||||
auto *display = new CardInfoPictureWithTextOverlayWidget(flowWidget, false);
|
||||
|
|
@ -233,11 +233,11 @@ 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.getUuid()}));
|
||||
addCard(ExactCard(info, printing));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addCard(info);
|
||||
addCard(CardDatabaseManager::getInstance()->getPreferredCard(info));
|
||||
}
|
||||
} else {
|
||||
qCDebug(VisualDatabaseDisplayLog) << "Card not found in database!";
|
||||
|
|
@ -298,11 +298,11 @@ 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.getUuid()}));
|
||||
addCard(ExactCard(info, printing));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addCard(info);
|
||||
addCard(CardDatabaseManager::getInstance()->getPreferredCard(info));
|
||||
}
|
||||
} else {
|
||||
qCDebug(VisualDatabaseDisplayLog) << "Card " << name.toString() << " not found in database!";
|
||||
|
|
@ -335,7 +335,9 @@ void VisualDatabaseDisplayWidget::sortCardList(const QStringList &properties,
|
|||
Qt::SortOrder order = Qt::AscendingOrder) const
|
||||
{
|
||||
CardInfoComparator comparator(properties, order);
|
||||
std::sort(cards->begin(), cards->end(), comparator);
|
||||
std::sort(cards->begin(), cards->end(), [comparator](const ExactCard &a, const ExactCard &b) {
|
||||
return comparator(a.getCardPtr(), b.getCardPtr());
|
||||
});
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayWidget::databaseDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ public slots:
|
|||
|
||||
signals:
|
||||
void cardClickedDatabaseDisplay(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *instance);
|
||||
void cardHoveredDatabaseDisplay(CardInfoPtr hoveredCard);
|
||||
void cardHoveredDatabaseDisplay(const ExactCard &hoveredCard);
|
||||
|
||||
protected slots:
|
||||
void onClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *instance);
|
||||
void onHover(const CardInfoPtr &hoveredCard);
|
||||
void addCard(const CardInfoPtr &cardToAdd);
|
||||
void onHover(const ExactCard &hoveredCard);
|
||||
void addCard(const ExactCard &cardToAdd);
|
||||
void databaseDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void modelDirty() const;
|
||||
|
|
@ -87,7 +87,7 @@ private:
|
|||
CardDatabaseModel *databaseModel;
|
||||
CardDatabaseDisplayModel *databaseDisplayModel;
|
||||
QTreeView *databaseView;
|
||||
QList<CardInfoPtr> *cards;
|
||||
QList<ExactCard> *cards;
|
||||
QVBoxLayout *mainLayout;
|
||||
QScrollArea *scrollArea;
|
||||
FlowWidget *flowWidget;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *pare
|
|||
cardSizeWidget = new CardSizeWidget(this, flowWidget);
|
||||
layout->addWidget(cardSizeWidget);
|
||||
|
||||
for (CardInfoPtr card : getRandomCards(handSizeSpinBox->value())) {
|
||||
for (const ExactCard &card : getRandomCards(handSizeSpinBox->value())) {
|
||||
auto displayWidget = new CardInfoPictureWidget(this);
|
||||
displayWidget->setCard(card);
|
||||
displayWidget->setScaleFactor(cardSizeWidget->getSlider()->value());
|
||||
|
|
@ -64,7 +64,7 @@ void VisualDeckEditorSampleHandWidget::setDeckModel(DeckListModel *deckModel)
|
|||
void VisualDeckEditorSampleHandWidget::updateDisplay()
|
||||
{
|
||||
flowWidget->clearLayout();
|
||||
for (CardInfoPtr card : getRandomCards(handSizeSpinBox->value())) {
|
||||
for (const ExactCard &card : getRandomCards(handSizeSpinBox->value())) {
|
||||
auto displayWidget = new CardInfoPictureWidget(this);
|
||||
displayWidget->setCard(card);
|
||||
displayWidget->setScaleFactor(cardSizeWidget->getSlider()->value());
|
||||
|
|
@ -74,10 +74,10 @@ void VisualDeckEditorSampleHandWidget::updateDisplay()
|
|||
}
|
||||
}
|
||||
|
||||
QList<CardInfoPtr> VisualDeckEditorSampleHandWidget::getRandomCards(int amountToGet)
|
||||
QList<ExactCard> VisualDeckEditorSampleHandWidget::getRandomCards(int amountToGet)
|
||||
{
|
||||
QList<CardInfoPtr> mainDeckCards;
|
||||
QList<CardInfoPtr> randomCards;
|
||||
QList<ExactCard> mainDeckCards;
|
||||
QList<ExactCard> randomCards;
|
||||
if (!deckListModel)
|
||||
return randomCards;
|
||||
DeckList *decklist = deckListModel->getDeckList();
|
||||
|
|
@ -101,9 +101,9 @@ QList<CardInfoPtr> VisualDeckEditorSampleHandWidget::getRandomCards(int amountTo
|
|||
continue;
|
||||
|
||||
for (int k = 0; k < currentCard->getNumber(); ++k) {
|
||||
CardInfoPtr info = CardDatabaseManager::getInstance()->getCard(currentCard->toCardRef());
|
||||
if (info) {
|
||||
mainDeckCards.append(info);
|
||||
ExactCard card = CardDatabaseManager::getInstance()->getCard(currentCard->toCardRef());
|
||||
if (card) {
|
||||
mainDeckCards.append(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ QList<CardInfoPtr> VisualDeckEditorSampleHandWidget::getRandomCards(int amountTo
|
|||
}
|
||||
|
||||
std::sort(randomCards.begin(), randomCards.end(),
|
||||
[](const CardInfoPtr &a, const CardInfoPtr &b) { return a->getCmc() < b->getCmc(); });
|
||||
[](const ExactCard &a, const ExactCard &b) { return a.getInfo().getCmc() < b.getInfo().getCmc(); });
|
||||
|
||||
return randomCards;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class VisualDeckEditorSampleHandWidget : public QWidget
|
|||
Q_OBJECT
|
||||
public:
|
||||
VisualDeckEditorSampleHandWidget(QWidget *parent, DeckListModel *deckListModel);
|
||||
QList<CardInfoPtr> getRandomCards(int amountToGet);
|
||||
QList<ExactCard> getRandomCards(int amountToGet);
|
||||
|
||||
public slots:
|
||||
void updateDisplay();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, DeckListModel *_
|
|||
if (!searchBar->hasFocus())
|
||||
return;
|
||||
|
||||
CardInfoPtr card = CardDatabaseManager::getInstance()->getCardInfo(searchBar->text());
|
||||
ExactCard card = CardDatabaseManager::getInstance()->getCard({searchBar->text()});
|
||||
if (card) {
|
||||
emit cardAdditionRequested(card);
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, DeckListModel *_
|
|||
// Search button functionality
|
||||
searchPushButton = new QPushButton(this);
|
||||
connect(searchPushButton, &QPushButton::clicked, this, [=, this]() {
|
||||
CardInfoPtr card = CardDatabaseManager::getInstance()->getCardInfo(searchBar->text());
|
||||
ExactCard card = CardDatabaseManager::getInstance()->getCard({searchBar->text()});
|
||||
if (card) {
|
||||
emit cardAdditionRequested(card);
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ void VisualDeckEditorWidget::decklistDataChanged(QModelIndex topLeft, QModelInde
|
|||
updateZoneWidgets();
|
||||
}
|
||||
|
||||
void VisualDeckEditorWidget::onHover(CardInfoPtr hoveredCard)
|
||||
void VisualDeckEditorWidget::onHover(const ExactCard &hoveredCard)
|
||||
{
|
||||
emit activeCardChanged(hoveredCard);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ public slots:
|
|||
void constructZoneWidgetsFromDeckListModel();
|
||||
|
||||
signals:
|
||||
void activeCardChanged(CardInfoPtr activeCard);
|
||||
void activeCardChanged(const ExactCard &activeCard);
|
||||
void activeGroupCriteriaChanged(QString activeGroupCriteria);
|
||||
void activeSortCriteriaChanged(QStringList activeSortCriteria);
|
||||
void cardClicked(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *instance, QString zoneName);
|
||||
void cardAdditionRequested(CardInfoPtr card);
|
||||
void cardAdditionRequested(const ExactCard &card);
|
||||
void displayTypeChanged(DisplayType displayType);
|
||||
|
||||
protected slots:
|
||||
void onHover(CardInfoPtr hoveredCard);
|
||||
void onHover(const ExactCard &hoveredCard);
|
||||
void onCardClick(QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *instance, QString zoneName);
|
||||
void actChangeActiveGroupCriteria();
|
||||
void actChangeActiveSortCriteria();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ void DeckPreviewWidget::initializeUi(const bool deckLoadSuccess)
|
|||
return;
|
||||
}
|
||||
auto bannerCard = deckLoader->getBannerCard().name.isEmpty()
|
||||
? CardInfoPtr()
|
||||
? ExactCard()
|
||||
: CardDatabaseManager::getInstance()->getCard(deckLoader->getBannerCard());
|
||||
|
||||
bannerCardDisplayWidget->setCard(bannerCard);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue