[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:
RickyRister 2026-03-06 10:39:04 -08:00 committed by GitHub
parent bd5cbb89d4
commit dead993639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 94 additions and 52 deletions

View file

@ -14,6 +14,7 @@
#include <QPushButton>
#include <QTextStream>
#include <QVBoxLayout>
#include <libcockatrice/card/import/card_name_normalizer.h>
/**
* Creates the main layout and connects the signals that are common to all versions of this window
@ -81,7 +82,7 @@ bool AbstractDlgDeckTextEdit::loadIntoDeck(DeckList &deckList) const
QTextStream stream(&buffer);
if (deckList.loadFromStream_Plain(stream, true)) {
if (deckList.loadFromStream_Plain(stream, true, CardNameNormalizer())) {
if (loadSetNameAndNumberCheckBox->isChecked()) {
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
} else {

View file

@ -8,6 +8,7 @@
#include <QJsonObject>
#include <QMessageBox>
#include <QNetworkReply>
#include <libcockatrice/card/import/card_name_normalizer.h>
#include <version_string.h>
DlgLoadDeckFromWebsite::DlgLoadDeckFromWebsite(QWidget *parent) : QDialog(parent)
@ -99,7 +100,7 @@ void DlgLoadDeckFromWebsite::accept()
// Parse the plain text deck here
DeckList deckList;
QTextStream stream(&deckText);
deckList.loadFromStream_Plain(stream, false);
deckList.loadFromStream_Plain(stream, false, CardNameNormalizer());
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
deck = deckList;

View file

@ -14,6 +14,7 @@
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QLoggingCategory>
#include <QNetworkAccessManager>
#include <QVBoxLayout>