mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
[DeckLoader] Refactor to make some methods static (#6336)
* Make forEachCard const * Make some DeckLoader methods static * Update usages * Update method param documentation in deck_loader.cpp --------- Co-authored-by: BruebachL <44814898+BruebachL@users.noreply.github.com>
This commit is contained in:
parent
a8ee0d7648
commit
16392c28c5
10 changed files with 80 additions and 65 deletions
|
|
@ -82,9 +82,9 @@ bool AbstractDlgDeckTextEdit::loadIntoDeck(DeckLoader *deckLoader) const
|
|||
|
||||
if (deckLoader->getDeckList()->loadFromStream_Plain(stream, true)) {
|
||||
if (loadSetNameAndNumberCheckBox->isChecked()) {
|
||||
deckLoader->resolveSetNameAndNumberToProviderID();
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(deckLoader->getDeckList());
|
||||
} else {
|
||||
deckLoader->clearSetNamesAndNumbers();
|
||||
DeckLoader::clearSetNamesAndNumbers(deckLoader->getDeckList());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -154,17 +154,17 @@ DlgEditDeckInClipboard::DlgEditDeckInClipboard(const DeckLoader &deckList, bool
|
|||
* @param addComments Whether to add annotations
|
||||
* @return A QString
|
||||
*/
|
||||
static QString deckListToString(const DeckLoader *deckList, bool addComments)
|
||||
static QString deckListToString(const DeckList *deckList, bool addComments)
|
||||
{
|
||||
QString buffer;
|
||||
QTextStream stream(&buffer);
|
||||
deckList->saveToStream_Plain(stream, addComments);
|
||||
DeckLoader::saveToStream_Plain(stream, deckList, addComments);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void DlgEditDeckInClipboard::actRefresh()
|
||||
{
|
||||
setText(deckListToString(deckLoader, annotated));
|
||||
setText(deckListToString(deckLoader->getDeckList(), annotated));
|
||||
}
|
||||
|
||||
void DlgEditDeckInClipboard::actOK()
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
DeckLoader *loader = new DeckLoader(this);
|
||||
QTextStream stream(&deckText);
|
||||
loader->getDeckList()->loadFromStream_Plain(stream, false);
|
||||
loader->resolveSetNameAndNumberToProviderID();
|
||||
DeckLoader::resolveSetNameAndNumberToProviderID(loader->getDeckList());
|
||||
deck = loader;
|
||||
|
||||
QDialog::accept();
|
||||
|
|
|
|||
|
|
@ -162,14 +162,14 @@ void DlgSelectSetForCards::actOK()
|
|||
|
||||
void DlgSelectSetForCards::actClear()
|
||||
{
|
||||
qobject_cast<DeckLoader *>(model->getDeckList())->clearSetNamesAndNumbers();
|
||||
DeckLoader::clearSetNamesAndNumbers(model->getDeckList());
|
||||
accept();
|
||||
}
|
||||
|
||||
void DlgSelectSetForCards::actSetAllToPreferred()
|
||||
{
|
||||
qobject_cast<DeckLoader *>(model->getDeckList())->clearSetNamesAndNumbers();
|
||||
qobject_cast<DeckLoader *>(model->getDeckList())->setProviderIdToPreferredPrinting();
|
||||
DeckLoader::clearSetNamesAndNumbers(model->getDeckList());
|
||||
DeckLoader::setProviderIdToPreferredPrinting(model->getDeckList());
|
||||
accept();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue