mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Adjust to rebase.
Took 48 minutes
This commit is contained in:
parent
3cdd3df666
commit
aaa2c05b87
5 changed files with 19 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef TAB_HOME_H
|
||||
#define TAB_HOME_H
|
||||
|
||||
#include "../game_logic/abstract_client.h"
|
||||
#include "../../server/abstract_client.h"
|
||||
#include "../ui/widgets/general/home_widget.h"
|
||||
#include "tab.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ QPixmap CardInfoPictureArtCropWidget::getProcessedBackground(const QSize &target
|
|||
{
|
||||
// Load the full-resolution card image, not a pre-scaled one
|
||||
QPixmap fullResPixmap;
|
||||
if (getInfo()) {
|
||||
PictureLoader::getPixmap(fullResPixmap, getInfo(), QSize(745, 1040)); // or a high default size
|
||||
if (getCard()) {
|
||||
PictureLoader::getPixmap(fullResPixmap, getCard(), QSize(745, 1040)); // or a high default size
|
||||
} else {
|
||||
PictureLoader::getCardBackPixmap(fullResPixmap, QSize(745, 1040));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ void HomeWidget::startCardShuffleTimer()
|
|||
|
||||
void HomeWidget::updateRandomCard()
|
||||
{
|
||||
CardInfoPtr newCard = CardDatabaseManager::getInstance()->getRandomCard();
|
||||
ExactCard newCard = CardDatabaseManager::getInstance()->getRandomCard();
|
||||
if (!newCard)
|
||||
return;
|
||||
|
||||
connect(newCard.data(), &CardInfo::pixmapUpdated, this, &HomeWidget::updateBackgroundProperties);
|
||||
connect(newCard.getCardPtr().data(), &CardInfo::pixmapUpdated, this, &HomeWidget::updateBackgroundProperties);
|
||||
backgroundSource->setCard(newCard);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -214,15 +214,17 @@ ExactCard CardDatabase::guessCard(const CardRef &cardRef) const
|
|||
return ExactCard(temp, findPrintingWithId(temp, cardRef.providerId));
|
||||
}
|
||||
|
||||
CardInfoPtr CardDatabase::getRandomCard()
|
||||
ExactCard CardDatabase::getRandomCard()
|
||||
{
|
||||
if (cards.isEmpty()) return nullptr;
|
||||
if (cards.isEmpty())
|
||||
return ExactCard();
|
||||
|
||||
const auto keys = cards.keys();
|
||||
int randomIndex = QRandomGenerator::global()->bounded(keys.size());
|
||||
const QString &randomKey = keys.at(randomIndex);
|
||||
CardInfoPtr randomCard = getCardFromMap(cards, randomKey);
|
||||
|
||||
return getCardFromMap(cards, randomKey);
|
||||
return ExactCard{randomCard, getPreferredPrinting(randomCard)};
|
||||
}
|
||||
|
||||
CardSetPtr CardDatabase::getSet(const QString &setName)
|
||||
|
|
@ -250,6 +252,14 @@ SetList CardDatabase::getSetList() const
|
|||
return result;
|
||||
}
|
||||
|
||||
CardInfoPtr CardDatabase::getCardFromMap(const CardNameMap &cardMap, const QString &cardName) const
|
||||
{
|
||||
if (cardMap.contains(cardName))
|
||||
return cardMap.value(cardName);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
LoadStatus CardDatabase::loadFromFile(const QString &fileName)
|
||||
{
|
||||
QFile file(fileName);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ protected:
|
|||
QVector<ICardDatabaseParser *> availableParsers;
|
||||
|
||||
private:
|
||||
CardInfoPtr getCardFromMap(const CardNameMap &cardMap, const QString &cardName) const;
|
||||
void checkUnknownSets();
|
||||
void refreshCachedReverseRelatedCards();
|
||||
|
||||
|
|
@ -100,6 +99,7 @@ public:
|
|||
return cards;
|
||||
}
|
||||
SetList getSetList() const;
|
||||
CardInfoPtr getCardFromMap(const CardNameMap &cardMap, const QString &cardName) const;
|
||||
LoadStatus loadFromFile(const QString &fileName);
|
||||
bool saveCustomTokensToFile();
|
||||
QStringList getAllMainCardTypes() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue