mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -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()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
i.value()->setReadyStart(false);
|
i.value()->setReadyStart(false);
|
||||||
|
i.value()->setVisualDeckStorageExists(false);
|
||||||
i.value()->hide();
|
i.value()->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
||||||
&DeckViewContainer::updateShowVisualDeckStorage);
|
&DeckViewContainer::setVisualDeckStorageExists);
|
||||||
|
|
||||||
switchToDeckSelectView();
|
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) {
|
if (exists) {
|
||||||
tryCreateVisualDeckStorageWidget();
|
|
||||||
// view mode state isn't stored in a field, so we determine state by checking the button
|
// view mode state isn't stored in a field, so we determine state by checking the button
|
||||||
bool isDeckSelectView = loadLocalButton->isEnabled();
|
if (loadLocalButton->isEnabled()) {
|
||||||
visualDeckStorageWidget->setHidden(!isDeckSelectView);
|
// We only need to handle the setting changing while in deck select state; tryCreate already gets called
|
||||||
deckView->setHidden(isDeckSelectView);
|
// when switching from deck loaded to deck select state
|
||||||
|
tryCreateVisualDeckStorageWidget();
|
||||||
|
visualDeckStorageWidget->setHidden(false);
|
||||||
|
deckView->setHidden(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (visualDeckStorageWidget) {
|
if (visualDeckStorageWidget) {
|
||||||
visualDeckStorageWidget->deleteLater();
|
visualDeckStorageWidget->deleteLater();
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ private slots:
|
||||||
void sideboardLockButtonClicked();
|
void sideboardLockButtonClicked();
|
||||||
void updateSideboardLockButtonText();
|
void updateSideboardLockButtonText();
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
void updateShowVisualDeckStorage(bool enabled);
|
|
||||||
signals:
|
signals:
|
||||||
void newCardAdded(AbstractCardItem *card);
|
void newCardAdded(AbstractCardItem *card);
|
||||||
void notIdle();
|
void notIdle();
|
||||||
|
|
@ -78,6 +77,7 @@ public:
|
||||||
void readyAndUpdate();
|
void readyAndUpdate();
|
||||||
void setSideboardLocked(bool locked);
|
void setSideboardLocked(bool locked);
|
||||||
void setDeck(const DeckLoader &deck);
|
void setDeck(const DeckLoader &deck);
|
||||||
|
void setVisualDeckStorageExists(bool exists);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadDeckFromFile(const QString &filePath);
|
void loadDeckFromFile(const QString &filePath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue