mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
[DeckLoader] Make save/load methods static (#6476)
* const * [DeckLoader] make methods static * use static methods * add docs * add docs
This commit is contained in:
parent
c7c7bf550a
commit
d579c82cb9
11 changed files with 209 additions and 166 deletions
|
|
@ -260,16 +260,15 @@ void DeckViewContainer::loadLocalDeck()
|
|||
void DeckViewContainer::loadDeckFromFile(const QString &filePath)
|
||||
{
|
||||
DeckFileFormat::Format fmt = DeckFileFormat::getFormatFromName(filePath);
|
||||
DeckLoader deck(this);
|
||||
|
||||
bool success = deck.loadFromFile(filePath, fmt, true);
|
||||
std::optional<LoadedDeck> deckOpt = DeckLoader::loadFromFile(filePath, fmt, true);
|
||||
|
||||
if (!success) {
|
||||
if (!deckOpt) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("The selected file could not be loaded."));
|
||||
return;
|
||||
}
|
||||
|
||||
loadDeckFromDeckList(deck.getDeck().deckList);
|
||||
loadDeckFromDeckList(deckOpt.value().deckList);
|
||||
}
|
||||
|
||||
void DeckViewContainer::loadDeckFromDeckList(const DeckList &deck)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue