mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-09 15:54:47 -07:00
A DeckLoader is not a DeckList. (#6306)
* A DeckLoader is not a DeckList. Took 2 hours 39 minutes * Explicitly initialize base class in copy constructor? Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
4c431e98a6
commit
8e88749078
32 changed files with 163 additions and 139 deletions
|
|
@ -264,7 +264,7 @@ void DeckViewContainer::loadLocalDeck()
|
|||
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||
{
|
||||
DeckLoader::FileFormat fmt = DeckLoader::getFormatFromName(filePath);
|
||||
DeckLoader deck;
|
||||
DeckLoader deck(this);
|
||||
|
||||
bool success = deck.loadFromFile(filePath, fmt, true);
|
||||
|
||||
|
|
@ -276,9 +276,9 @@ void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
|||
loadDeckFromDeckLoader(&deck);
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadDeckFromDeckLoader(const DeckLoader *deck)
|
||||
void DeckViewContainer::loadDeckFromDeckLoader(DeckLoader *deck)
|
||||
{
|
||||
QString deckString = deck->writeToString_Native();
|
||||
QString deckString = deck->getDeckList()->writeToString_Native();
|
||||
|
||||
if (deckString.length() > MAX_FILE_LENGTH) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Deck is greater than maximum file size."));
|
||||
|
|
@ -331,8 +331,9 @@ void DeckViewContainer::loadFromWebsite()
|
|||
void DeckViewContainer::deckSelectFinished(const Response &r)
|
||||
{
|
||||
const Response_DeckDownload &resp = r.GetExtension(Response_DeckDownload::ext);
|
||||
DeckLoader newDeck(QString::fromStdString(resp.deck()));
|
||||
CardPictureLoader::cacheCardPixmaps(CardDatabaseManager::query()->getCards(newDeck.getCardRefList()));
|
||||
DeckLoader newDeck(this, new DeckList(QString::fromStdString(resp.deck())));
|
||||
CardPictureLoader::cacheCardPixmaps(
|
||||
CardDatabaseManager::query()->getCards(newDeck.getDeckList()->getCardRefList()));
|
||||
setDeck(newDeck);
|
||||
switchToDeckLoadedView();
|
||||
}
|
||||
|
|
@ -413,8 +414,8 @@ void DeckViewContainer::setSideboardLocked(bool locked)
|
|||
deckView->resetSideboardPlan();
|
||||
}
|
||||
|
||||
void DeckViewContainer::setDeck(const DeckLoader &deck)
|
||||
void DeckViewContainer::setDeck(DeckLoader &deck)
|
||||
{
|
||||
deckView->setDeck(deck);
|
||||
deckView->setDeck(*deck.getDeckList());
|
||||
switchToDeckLoadedView();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue