mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 06:22:15 -07:00
Revert pulling up setters/getters now that getDeckList is no longer const.
Took 6 minutes
This commit is contained in:
parent
faf73376f0
commit
e2231df8ff
8 changed files with 15 additions and 77 deletions
|
|
@ -29,8 +29,8 @@ public:
|
|||
QString deckName = obj.value("name").toString();
|
||||
QString deckDescription = obj.value("description").toString();
|
||||
|
||||
loader->setName(deckName);
|
||||
loader->setComments(deckDescription);
|
||||
loader->getDeckList()->setName(deckName);
|
||||
loader->getDeckList()->setComments(deckDescription);
|
||||
|
||||
QString outputText;
|
||||
QTextStream outStream(&outputText);
|
||||
|
|
@ -47,7 +47,7 @@ public:
|
|||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||
}
|
||||
|
||||
loader->loadFromStream_Plain(outStream, false);
|
||||
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
||||
|
||||
return loader;
|
||||
|
|
@ -64,8 +64,8 @@ public:
|
|||
QString deckName = obj.value("name").toString();
|
||||
QString deckDescription = obj.value("description").toString();
|
||||
|
||||
loader->setName(deckName);
|
||||
loader->setComments(deckDescription);
|
||||
loader->getDeckList()->setName(deckName);
|
||||
loader->getDeckList()->setComments(deckDescription);
|
||||
|
||||
QString outputText;
|
||||
QTextStream outStream(&outputText);
|
||||
|
|
@ -94,7 +94,7 @@ public:
|
|||
outStream << quantity << ' ' << cardName << " (" << setName << ") " << collectorNumber << '\n';
|
||||
}
|
||||
|
||||
loader->loadFromStream_Plain(outStream, false);
|
||||
loader->getDeckList()->loadFromStream_Plain(outStream, false);
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
||||
|
||||
QJsonObject commandersObj = obj.value("commanders").toObject();
|
||||
|
|
|
|||
|
|
@ -78,20 +78,6 @@ public:
|
|||
return getLastFileName().isEmpty() && getLastRemoteDeckId() == -1;
|
||||
}
|
||||
|
||||
void setName(const QString &_name = QString())
|
||||
{
|
||||
deckList->setName(_name);
|
||||
}
|
||||
|
||||
void setComments(const QString &_comments = QString())
|
||||
{
|
||||
deckList->setComments(_comments);
|
||||
}
|
||||
void setTags(const QStringList &_tags = QStringList())
|
||||
{
|
||||
deckList->setTags(_tags);
|
||||
}
|
||||
|
||||
static void clearSetNamesAndNumbers(const DeckList *deckList);
|
||||
static FileFormat getFormatFromName(const QString &fileName);
|
||||
|
||||
|
|
@ -112,54 +98,6 @@ public:
|
|||
bool addComments = true,
|
||||
bool addSetNameAndNumber = true);
|
||||
|
||||
/// @name Serialization (XML)
|
||||
///@{
|
||||
bool loadFromXml(QXmlStreamReader *xml)
|
||||
{
|
||||
return deckList->loadFromXml(xml);
|
||||
};
|
||||
bool loadFromString_Native(const QString &nativeString)
|
||||
{
|
||||
return deckList->loadFromString_Native(nativeString);
|
||||
};
|
||||
QString writeToString_Native() const
|
||||
{
|
||||
return deckList->writeToString_Native();
|
||||
};
|
||||
bool loadFromFile_Native(QIODevice *device)
|
||||
{
|
||||
return deckList->loadFromFile_Native(device);
|
||||
};
|
||||
bool saveToFile_Native(QIODevice *device)
|
||||
{
|
||||
return deckList->saveToFile_Native(device);
|
||||
};
|
||||
///@}
|
||||
|
||||
/// @name Serialization (Plain text)
|
||||
///@{
|
||||
bool loadFromStream_Plain(QTextStream &stream, bool preserveMetadata)
|
||||
{
|
||||
return deckList->loadFromStream_Plain(stream, preserveMetadata);
|
||||
};
|
||||
bool loadFromFile_Plain(QIODevice *device)
|
||||
{
|
||||
return deckList->loadFromFile_Plain(device);
|
||||
};
|
||||
bool saveToStream_Plain(QTextStream &stream, bool prefixSideboardCards, bool slashTappedOutSplitCards)
|
||||
{
|
||||
return deckList->saveToStream_Plain(stream, prefixSideboardCards, slashTappedOutSplitCards);
|
||||
};
|
||||
bool saveToFile_Plain(QIODevice *device, bool prefixSideboardCards = true, bool slashTappedOutSplitCards = false)
|
||||
{
|
||||
return deckList->saveToFile_Plain(device, prefixSideboardCards, slashTappedOutSplitCards);
|
||||
};
|
||||
QString writeToString_Plain(bool prefixSideboardCards = true, bool slashTappedOutSplitCards = false)
|
||||
{
|
||||
return deckList->writeToString_Plain(prefixSideboardCards, slashTappedOutSplitCards);
|
||||
};
|
||||
///@}
|
||||
|
||||
/**
|
||||
* @brief Prints the decklist to the provided QPrinter.
|
||||
* @param printer The printer to render the decklist to.
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ bool AbstractDlgDeckTextEdit::loadIntoDeck(DeckLoader *deckLoader) const
|
|||
QString buffer = contentsEdit->toPlainText();
|
||||
|
||||
if (buffer.contains("<cockatrice_deck version=\"1\">")) {
|
||||
return deckLoader->loadFromString_Native(buffer);
|
||||
return deckLoader->getDeckList()->loadFromString_Native(buffer);
|
||||
}
|
||||
|
||||
QTextStream stream(&buffer);
|
||||
|
||||
if (deckLoader->loadFromStream_Plain(stream, true)) {
|
||||
if (deckLoader->getDeckList()->loadFromStream_Plain(stream, true)) {
|
||||
if (loadSetNameAndNumberCheckBox->isChecked()) {
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(deckLoader->getDeckList());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
// Parse the plain text deck here
|
||||
DeckLoader *loader = new DeckLoader(this);
|
||||
QTextStream stream(&deckText);
|
||||
loader->loadFromStream_Plain(stream, false);
|
||||
loader->getDeckList()->loadFromStream_Plain(stream, false);
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
||||
deck = loader;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ void EdhrecDeckApiResponse::fromJson(const QJsonArray &json)
|
|||
deckLoader = new DeckLoader(nullptr);
|
||||
|
||||
QTextStream stream(&deckList);
|
||||
deckLoader->loadFromStream_Plain(stream, true);
|
||||
deckLoader->getDeckList()->loadFromStream_Plain(stream, true);
|
||||
}
|
||||
|
||||
void EdhrecDeckApiResponse::debugPrint() const
|
||||
|
|
|
|||
|
|
@ -323,9 +323,9 @@ void TabDeckStorage::uploadDeck(const QString &filePath, const QString &targetPa
|
|||
return;
|
||||
if (deckName.isEmpty())
|
||||
deckName = tr("Unnamed deck");
|
||||
deck.setName(deckName);
|
||||
deck.getDeckList()->setName(deckName);
|
||||
} else {
|
||||
deck.setName(deck.getDeckList()->getName().left(MAX_NAME_LENGTH));
|
||||
deck.getDeckList()->setName(deck.getDeckList()->getName().left(MAX_NAME_LENGTH));
|
||||
}
|
||||
|
||||
QString deckString = deck.getDeckList()->writeToString_Native();
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void DeckPreviewDeckTagsDisplayWidget::openTagEditDlg()
|
|||
DeckPreviewTagDialog dialog(knownTags, activeTags);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QStringList updatedTags = dialog.getActiveTags();
|
||||
deckLoader->setTags(updatedTags);
|
||||
deckLoader->getDeckList()->setTags(updatedTags);
|
||||
deckPreviewWidget->deckLoader->saveToFile(deckPreviewWidget->filePath, DeckLoader::CockatriceFormat);
|
||||
}
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ void DeckPreviewDeckTagsDisplayWidget::openTagEditDlg()
|
|||
DeckPreviewTagDialog dialog(knownTags, activeTags);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
QStringList updatedTags = dialog.getActiveTags();
|
||||
deckLoader->setTags(updatedTags);
|
||||
deckLoader->getDeckList()->setTags(updatedTags);
|
||||
deckEditor->setModified(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ void DeckPreviewWidget::actRenameDeck()
|
|||
}
|
||||
|
||||
// write change
|
||||
deckLoader->setName(newName);
|
||||
deckLoader->getDeckList()->setName(newName);
|
||||
deckLoader->saveToFile(filePath, DeckLoader::getFormatFromName(filePath));
|
||||
|
||||
// update VDS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue