[CardInfo] refactor some fields into a UiAttributes struct (#6322)

* refactor CardInfo

* refactor everything else
This commit is contained in:
RickyRister 2025-11-16 08:56:57 -08:00 committed by GitHub
parent 722344967f
commit 9a3104c5ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 73 additions and 87 deletions

View file

@ -154,7 +154,7 @@ void CardPictureLoader::imageLoaded(const ExactCard &card, const QImage &image)
qCDebug(CardPictureLoaderLog) << "Caching NULL pixmap for" << card.getName();
QPixmapCache::insert(card.getPixmapCacheKey(), QPixmap());
} else {
if (card.getInfo().getUpsideDownArt()) {
if (card.getInfo().getUiAttributes().upsideDownArt) {
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
QImage mirrorImage = image.flipped(Qt::Horizontal | Qt::Vertical);
#else

View file

@ -183,7 +183,7 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
QPixmap transformedPixmap = resizedPixmap; // Default pixmap
if (SettingsCache::instance().getAutoRotateSidewaysLayoutCards()) {
if (exactCard.getInfo().getLandscapeOrientation()) {
if (exactCard.getInfo().getUiAttributes().landscapeOrientation) {
// Rotate pixmap 90 degrees to the left
QTransform transform;
transform.rotate(90);

View file

@ -165,8 +165,8 @@ void DlgEditTokens::actAddToken()
QString setName = CardSet::TOKENS_SETNAME;
SetToPrintingsMap sets;
sets[setName].append(PrintingInfo(databaseModel->getDatabase()->getSet(setName)));
CardInfoPtr card = CardInfo::newInstance(name, "", true, QVariantHash(), QList<CardRelation *>(),
QList<CardRelation *>(), sets, false, false, -1, false);
CardInfo::UiAttributes attributes = {.tableRow = -1};
CardInfoPtr card = CardInfo::newInstance(name, "", true, {}, {}, {}, sets, attributes);
card->setCardType("Token");
databaseModel->getDatabase()->addCard(card);