mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 01:23:57 -07:00
update usages
This commit is contained in:
parent
7782b35f6e
commit
e954ba6647
7 changed files with 17 additions and 9 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
#ifndef INTERFACE_JSON_DECK_PARSER_H
|
||||||
#define INTERFACE_JSON_DECK_PARSER_H
|
#define INTERFACE_JSON_DECK_PARSER_H
|
||||||
|
|
||||||
|
#include "../../../interface/deck_loader/card_name_normalizer.h"
|
||||||
#include "../../../interface/deck_loader/card_node_function.h"
|
#include "../../../interface/deck_loader/card_node_function.h"
|
||||||
#include "../../../interface/deck_loader/deck_loader.h"
|
#include "../../../interface/deck_loader/deck_loader.h"
|
||||||
|
|
||||||
|
|
@ -49,7 +50,7 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
deckList.loadFromStream_Plain(outStream, false);
|
deckList.loadFromStream_Plain(outStream, false, CardNameNormalizer());
|
||||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
||||||
return deckList;
|
return deckList;
|
||||||
|
|
@ -96,7 +97,7 @@ public:
|
||||||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
deckList.loadFromStream_Plain(outStream, false);
|
deckList.loadFromStream_Plain(outStream, false, CardNameNormalizer());
|
||||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
||||||
QJsonObject commandersObj = obj.value("commanders").toObject();
|
QJsonObject commandersObj = obj.value("commanders").toObject();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "deck_loader.h"
|
#include "deck_loader.h"
|
||||||
|
|
||||||
|
#include "card_name_normalizer.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -42,7 +44,7 @@ DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bo
|
||||||
DeckList deckList;
|
DeckList deckList;
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case DeckFileFormat::PlainText:
|
case DeckFileFormat::PlainText:
|
||||||
result = deckList.loadFromFile_Plain(&file);
|
result = deckList.loadFromFile_Plain(&file, CardNameNormalizer());
|
||||||
break;
|
break;
|
||||||
case DeckFileFormat::Cockatrice: {
|
case DeckFileFormat::Cockatrice: {
|
||||||
result = deckList.loadFromFile_Native(&file);
|
result = deckList.loadFromFile_Native(&file);
|
||||||
|
|
@ -50,7 +52,7 @@ DeckLoader::loadFromFile(const QString &fileName, DeckFileFormat::Format fmt, bo
|
||||||
qCInfo(DeckLoaderLog) << "Failed to load " << fileName
|
qCInfo(DeckLoaderLog) << "Failed to load " << fileName
|
||||||
<< "as cockatrice format; retrying as plain format";
|
<< "as cockatrice format; retrying as plain format";
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
result = deckList.loadFromFile_Plain(&file);
|
result = deckList.loadFromFile_Plain(&file, CardNameNormalizer());
|
||||||
fmt = DeckFileFormat::PlainText;
|
fmt = DeckFileFormat::PlainText;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "dlg_load_deck_from_clipboard.h"
|
#include "dlg_load_deck_from_clipboard.h"
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
|
#include "../../deck_loader/card_name_normalizer.h"
|
||||||
#include "../../deck_loader/card_node_function.h"
|
#include "../../deck_loader/card_node_function.h"
|
||||||
#include "../../deck_loader/deck_loader.h"
|
#include "../../deck_loader/deck_loader.h"
|
||||||
#include "dlg_settings.h"
|
#include "dlg_settings.h"
|
||||||
|
|
@ -81,7 +82,7 @@ bool AbstractDlgDeckTextEdit::loadIntoDeck(DeckList &deckList) const
|
||||||
|
|
||||||
QTextStream stream(&buffer);
|
QTextStream stream(&buffer);
|
||||||
|
|
||||||
if (deckList.loadFromStream_Plain(stream, true)) {
|
if (deckList.loadFromStream_Plain(stream, true, CardNameNormalizer())) {
|
||||||
if (loadSetNameAndNumberCheckBox->isChecked()) {
|
if (loadSetNameAndNumberCheckBox->isChecked()) {
|
||||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "dlg_load_deck_from_website.h"
|
#include "dlg_load_deck_from_website.h"
|
||||||
|
|
||||||
|
#include "../../deck_loader/card_name_normalizer.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
|
@ -99,7 +101,7 @@ void DlgLoadDeckFromWebsite::accept()
|
||||||
// Parse the plain text deck here
|
// Parse the plain text deck here
|
||||||
DeckList deckList;
|
DeckList deckList;
|
||||||
QTextStream stream(&deckText);
|
QTextStream stream(&deckText);
|
||||||
deckList.loadFromStream_Plain(stream, false);
|
deckList.loadFromStream_Plain(stream, false, CardNameNormalizer());
|
||||||
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
deckList.forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
deck = deckList;
|
deck = deckList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "archidekt_api_response_deck_display_widget.h"
|
#include "archidekt_api_response_deck_display_widget.h"
|
||||||
|
|
||||||
|
#include "../../../../../deck_loader/card_name_normalizer.h"
|
||||||
#include "../../../../../deck_loader/card_node_function.h"
|
#include "../../../../../deck_loader/card_node_function.h"
|
||||||
#include "../../../../../deck_loader/deck_loader.h"
|
#include "../../../../../deck_loader/deck_loader.h"
|
||||||
#include "../../../../cards/card_info_picture_with_text_overlay_widget.h"
|
#include "../../../../cards/card_info_picture_with_text_overlay_widget.h"
|
||||||
|
|
@ -80,7 +81,7 @@ ArchidektApiResponseDeckDisplayWidget::ArchidektApiResponseDeckDisplayWidget(QWi
|
||||||
connect(model, &DeckListModel::modelReset, this, &ArchidektApiResponseDeckDisplayWidget::decklistModelReset);
|
connect(model, &DeckListModel::modelReset, this, &ArchidektApiResponseDeckDisplayWidget::decklistModelReset);
|
||||||
|
|
||||||
auto decklist = QSharedPointer<DeckList>(new DeckList);
|
auto decklist = QSharedPointer<DeckList>(new DeckList);
|
||||||
decklist->loadFromStream_Plain(deckStream, false);
|
decklist->loadFromStream_Plain(deckStream, false, CardNameNormalizer());
|
||||||
model->setDeckList(decklist);
|
model->setDeckList(decklist);
|
||||||
|
|
||||||
model->forEachCard(CardNodeFunction::ResolveProviderId());
|
model->forEachCard(CardNodeFunction::ResolveProviderId());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "edhrec_deck_api_response.h"
|
#include "edhrec_deck_api_response.h"
|
||||||
|
|
||||||
|
#include "../../../../../../deck_loader/card_name_normalizer.h"
|
||||||
#include "../../../../../../deck_loader/deck_loader.h"
|
#include "../../../../../../deck_loader/deck_loader.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
@ -15,7 +16,7 @@ void EdhrecDeckApiResponse::fromJson(const QJsonArray &json)
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream stream(&deckList);
|
QTextStream stream(&deckList);
|
||||||
deck.loadFromStream_Plain(stream, true);
|
deck.loadFromStream_Plain(stream, true, CardNameNormalizer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EdhrecDeckApiResponse::debugPrint() const
|
void EdhrecDeckApiResponse::debugPrint() const
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ DeckList getDeckList(const QString &clipboard)
|
||||||
DeckList deckList;
|
DeckList deckList;
|
||||||
QString cp(clipboard);
|
QString cp(clipboard);
|
||||||
QTextStream stream(&cp); // text stream requires local copy
|
QTextStream stream(&cp); // text stream requires local copy
|
||||||
deckList.loadFromStream_Plain(stream, false);
|
deckList.loadFromStream_Plain(stream, false, [](auto s) { return s; });
|
||||||
return deckList;
|
return deckList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue