[Refactor] Pass around LoadedDeck instead of DeckLoader (#6422)

This commit is contained in:
RickyRister 2025-12-20 04:39:00 -08:00 committed by GitHub
parent 367507e054
commit d6db21419c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 253 additions and 264 deletions

View file

@ -90,14 +90,14 @@ void ArchidektApiResponseDeckDisplayWidget::onGroupCriteriaChange(const QString
void ArchidektApiResponseDeckDisplayWidget::actOpenInDeckEditor()
{
auto loader = new DeckLoader(this);
loader->getDeckList()->loadFromString_Native(model->getDeckList()->writeToString_Native());
loader->getDeckList()->setName(response.getDeckName());
loader->getDeckList()->setGameFormat(
DeckList deckList(*model->getDeckList());
deckList.setName(response.getDeckName());
deckList.setGameFormat(
ArchidektFormats::formatToCockatriceName(ArchidektFormats::DeckFormat(response.getDeckFormat() - 1)));
emit openInDeckEditor(loader);
LoadedDeck loadedDeck = {deckList, {}};
emit openInDeckEditor(loadedDeck);
}
void ArchidektApiResponseDeckDisplayWidget::clearAllDisplayWidgets()

View file

@ -31,7 +31,7 @@
*
* ### Signals
* - `requestNavigation(QString url)` triggered when navigation to a deck URL is requested.
* - `openInDeckEditor(DeckLoader *loader)` emitted when the user chooses to open the deck
* - `openInDeckEditor(const LoadedDeck &deck)` emitted when the user chooses to open the deck
* in the deck editor.
*
* ### Features
@ -52,9 +52,9 @@ signals:
/**
* @brief Emitted when the deck should be opened in the deck editor.
* @param loader Initialized DeckLoader containing the deck data.
* @param deck LoadedDeck containing the deck data.
*/
void openInDeckEditor(DeckLoader *loader);
void openInDeckEditor(const LoadedDeck &deck);
public:
/**
@ -75,7 +75,7 @@ public:
void retranslateUi();
/**
* @brief Opens the deck in the deck editor via DeckLoader.
* @brief Opens the deck in the deck editor.
*/
void actOpenInDeckEditor();