mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
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:
parent
55b490ade0
commit
ec0caaf421
8 changed files with 23 additions and 23 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue