Give deckList a signal to emit when the tags change and hook up the display widget to that. (#5497)

* Give deckList a signal to emit when the tags change and hook up the display widget to that.

* Reload from file when loading a visual deck to ensure latest changes propagate to the decklist.

* Eliminate loadVisualDeck and use loadDeckFromFile instead.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-01-19 13:32:39 +01:00 committed by GitHub
parent 55b490ade0
commit ec0caaf421
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 23 additions and 23 deletions

View file

@ -86,8 +86,8 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
connect(deckView, SIGNAL(sideboardPlanChanged()), this, SLOT(sideboardPlanChanged()));
visualDeckStorageWidget = new VisualDeckStorageWidget(this);
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckPreviewDoubleClicked, this,
&DeckViewContainer::loadVisualDeck);
connect(visualDeckStorageWidget, &VisualDeckStorageWidget::deckLoadRequested, this,
&DeckViewContainer::loadDeckFromFile);
deckViewLayout = new QVBoxLayout;
deckViewLayout->addLayout(buttonHBox);
@ -178,24 +178,6 @@ void DeckViewContainer::refreshShortcuts()
sideboardLockButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/sideboardLockButton"));
}
void DeckViewContainer::loadVisualDeck(QMouseEvent *event, DeckPreviewWidget *instance)
{
Q_UNUSED(event);
QString deckString = instance->deckLoader->writeToString_Native();
if (deckString.length() > MAX_FILE_LENGTH) {
QMessageBox::critical(this, tr("Error"), tr("The selected file could not be loaded."));
return;
}
Command_DeckSelect cmd;
cmd.set_deck(deckString.toStdString());
PendingCommand *pend = parentGame->prepareGameCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
SLOT(deckSelectFinished(const Response &)));
parentGame->sendGameCommand(pend, playerId);
}
void DeckViewContainer::unloadDeck()
{
switchToDeckSelectView();