mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-16 03:57:46 -07:00
[DeckList] Refactor load from plaintext to take normalizer as param (#6664)
* [DeckList] Refactor load from plaintext to take normalizer as param * update usages * weaken unit test * weaken unit test more * revert unit test * move CardNameNormalizer to libcockatrice_card * update unit test * formatting
This commit is contained in:
parent
bd5cbb89d4
commit
dead993639
14 changed files with 94 additions and 52 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include <QtConcurrentRun>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/card/import/card_name_normalizer.h>
|
||||
#include <libcockatrice/deck_list/deck_list.h>
|
||||
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bo
|
|||
DeckList deckList;
|
||||
switch (fmt) {
|
||||
case DeckFileFormat::PlainText:
|
||||
result = deckList.loadFromFile_Plain(&file);
|
||||
result = deckList.loadFromFile_Plain(&file, CardNameNormalizer());
|
||||
break;
|
||||
case DeckFileFormat::Cockatrice: {
|
||||
result = deckList.loadFromFile_Native(&file);
|
||||
|
|
@ -50,7 +51,7 @@ DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bo
|
|||
qCInfo(DeckLoaderLog) << "Failed to load " << fileName
|
||||
<< "as cockatrice format; retrying as plain format";
|
||||
file.seek(0);
|
||||
result = deckList.loadFromFile_Plain(&file);
|
||||
result = deckList.loadFromFile_Plain(&file, CardNameNormalizer());
|
||||
fmt = DeckFileFormat::PlainText;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue