mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Destroy VDS in game lobby once game starts (#5643)
* push back setting change * rename method and make it public * destroy vds on game start
This commit is contained in:
parent
0d6497fcdc
commit
21e22ed5fb
3 changed files with 15 additions and 9 deletions
|
|
@ -836,6 +836,7 @@ void TabGame::startGame(bool _resuming)
|
|||
while (i.hasNext()) {
|
||||
i.next();
|
||||
i.value()->setReadyStart(false);
|
||||
i.value()->setVisualDeckStorageExists(false);
|
||||
i.value()->hide();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
|||
refreshShortcuts();
|
||||
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
||||
&DeckViewContainer::updateShowVisualDeckStorage);
|
||||
&DeckViewContainer::setVisualDeckStorageExists);
|
||||
|
||||
switchToDeckSelectView();
|
||||
}
|
||||
|
|
@ -207,16 +207,21 @@ void DeckViewContainer::refreshShortcuts()
|
|||
}
|
||||
|
||||
/**
|
||||
* Update VDS existence when settings change
|
||||
* Updates the existence of the embedded Visual Deck Storage, destroying or creating it if needed.
|
||||
* Note that this change is temporary; the VDS may get recreated when the view transitions to the deck select state,
|
||||
* depending on current settings.
|
||||
*/
|
||||
void DeckViewContainer::updateShowVisualDeckStorage(bool enabled)
|
||||
void DeckViewContainer::setVisualDeckStorageExists(bool exists)
|
||||
{
|
||||
if (enabled) {
|
||||
tryCreateVisualDeckStorageWidget();
|
||||
if (exists) {
|
||||
// view mode state isn't stored in a field, so we determine state by checking the button
|
||||
bool isDeckSelectView = loadLocalButton->isEnabled();
|
||||
visualDeckStorageWidget->setHidden(!isDeckSelectView);
|
||||
deckView->setHidden(isDeckSelectView);
|
||||
if (loadLocalButton->isEnabled()) {
|
||||
// We only need to handle the setting changing while in deck select state; tryCreate already gets called
|
||||
// when switching from deck loaded to deck select state
|
||||
tryCreateVisualDeckStorageWidget();
|
||||
visualDeckStorageWidget->setHidden(false);
|
||||
deckView->setHidden(true);
|
||||
}
|
||||
} else {
|
||||
if (visualDeckStorageWidget) {
|
||||
visualDeckStorageWidget->deleteLater();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ private slots:
|
|||
void sideboardLockButtonClicked();
|
||||
void updateSideboardLockButtonText();
|
||||
void refreshShortcuts();
|
||||
void updateShowVisualDeckStorage(bool enabled);
|
||||
signals:
|
||||
void newCardAdded(AbstractCardItem *card);
|
||||
void notIdle();
|
||||
|
|
@ -78,6 +77,7 @@ public:
|
|||
void readyAndUpdate();
|
||||
void setSideboardLocked(bool locked);
|
||||
void setDeck(const DeckLoader &deck);
|
||||
void setVisualDeckStorageExists(bool exists);
|
||||
|
||||
public slots:
|
||||
void loadDeckFromFile(const QString &filePath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue