mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
[Card DB] Split out database loading and querying from main class (#6175)
* Simplify add card. Took 25 minutes Took 8 minutes # Commit time for manual adjustment: # Took 16 minutes Took 7 seconds * Refactor out db loading from card db. Took 39 minutes Took 9 minutes Took 2 minutes Took 17 seconds * Refactor out db queries from card db. Took 42 minutes * Lint. Took 3 minutes * I guess. Took 7 minutes * Tests. Took 15 minutes * I don't understand this. Took 9 minutes * fix linker errors * Rename to querier and promote to QObject Took 39 minutes * Lint. Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
754dd904d2
commit
d31b044529
49 changed files with 719 additions and 572 deletions
|
|
@ -76,7 +76,7 @@ void DeckPreviewWidget::initializeUi(const bool deckLoadSuccess)
|
|||
}
|
||||
auto bannerCard = deckLoader->getBannerCard().name.isEmpty()
|
||||
? ExactCard()
|
||||
: CardDatabaseManager::getInstance()->getCard(deckLoader->getBannerCard());
|
||||
: CardDatabaseManager::query()->getCard(deckLoader->getBannerCard());
|
||||
|
||||
bannerCardDisplayWidget->setCard(bannerCard);
|
||||
bannerCardDisplayWidget->setFontSize(24);
|
||||
|
|
@ -160,7 +160,7 @@ QString DeckPreviewWidget::getColorIdentity()
|
|||
QSet<QChar> colorSet; // A set to collect unique color symbols (e.g., W, U, B, R, G)
|
||||
|
||||
for (const QString &cardName : cardList) {
|
||||
CardInfoPtr currentCard = CardDatabaseManager::getInstance()->getCardInfo(cardName);
|
||||
CardInfoPtr currentCard = CardDatabaseManager::query()->getCardInfo(cardName);
|
||||
if (currentCard) {
|
||||
QString colors = currentCard->getColors(); // Assuming this returns something like "WUB"
|
||||
for (const QChar &color : colors) {
|
||||
|
|
@ -293,7 +293,7 @@ void DeckPreviewWidget::setBannerCard(int /* changedIndex */)
|
|||
CardRef cardRef = {name, id};
|
||||
deckLoader->setBannerCard(cardRef);
|
||||
deckLoader->saveToFile(filePath, DeckLoader::getFormatFromName(filePath));
|
||||
bannerCardDisplayWidget->setCard(CardDatabaseManager::getInstance()->getCard(cardRef));
|
||||
bannerCardDisplayWidget->setCard(CardDatabaseManager::query()->getCard(cardRef));
|
||||
}
|
||||
|
||||
void DeckPreviewWidget::imageClickedEvent(QMouseEvent *event, DeckPreviewCardPictureWidget *instance)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue