mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 19:13:55 -07:00
Add setting to hide visual deck storage in game lobby (#5570)
This commit is contained in:
parent
1ee0e87ba7
commit
d951b082c4
10 changed files with 56 additions and 5 deletions
|
|
@ -517,6 +517,11 @@ void DeckView::setDeck(const DeckList &_deck)
|
|||
deckViewScene->setDeck(_deck);
|
||||
}
|
||||
|
||||
void DeckView::clearDeck()
|
||||
{
|
||||
deckViewScene->clearContents();
|
||||
}
|
||||
|
||||
void DeckView::resetSideboardPlan()
|
||||
{
|
||||
deckViewScene->resetSideboardPlan();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ private:
|
|||
DeckList *deck;
|
||||
QMap<QString, DeckViewCardContainer *> cardContainers;
|
||||
qreal optimalAspectRatio;
|
||||
void clearContents();
|
||||
void rebuildTree();
|
||||
|
||||
public:
|
||||
|
|
@ -123,6 +122,7 @@ public:
|
|||
{
|
||||
return locked;
|
||||
}
|
||||
void clearContents();
|
||||
void setDeck(const DeckList &_deck);
|
||||
void setOptimalAspectRatio(qreal _optimalAspectRatio)
|
||||
{
|
||||
|
|
@ -152,6 +152,7 @@ signals:
|
|||
public:
|
||||
explicit DeckView(QWidget *parent = nullptr);
|
||||
void setDeck(const DeckList &_deck);
|
||||
void clearDeck();
|
||||
void setLocked(bool _locked)
|
||||
{
|
||||
deckViewScene->setLocked(_locked);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
|||
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||
refreshShortcuts();
|
||||
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
||||
&DeckViewContainer::updateShowVisualDeckStorage);
|
||||
|
||||
switchToDeckSelectView();
|
||||
}
|
||||
|
||||
|
|
@ -122,8 +125,8 @@ static void setVisibility(QPushButton *button, bool visible)
|
|||
|
||||
void DeckViewContainer::switchToDeckSelectView()
|
||||
{
|
||||
deckView->setVisible(false);
|
||||
visualDeckStorageWidget->setVisible(true);
|
||||
deckView->setHidden(SettingsCache::instance().getVisualDeckStorageInGame());
|
||||
visualDeckStorageWidget->setHidden(!SettingsCache::instance().getVisualDeckStorageInGame());
|
||||
deckViewLayout->update();
|
||||
|
||||
setVisibility(loadLocalButton, true);
|
||||
|
|
@ -143,8 +146,8 @@ void DeckViewContainer::switchToDeckSelectView()
|
|||
|
||||
void DeckViewContainer::switchToDeckLoadedView()
|
||||
{
|
||||
deckView->setVisible(true);
|
||||
visualDeckStorageWidget->setVisible(false);
|
||||
deckView->setHidden(false);
|
||||
visualDeckStorageWidget->setHidden(true);
|
||||
deckViewLayout->update();
|
||||
|
||||
setVisibility(loadLocalButton, false);
|
||||
|
|
@ -179,8 +182,21 @@ void DeckViewContainer::refreshShortcuts()
|
|||
sideboardLockButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/sideboardLockButton"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update VDS visibility when settings change
|
||||
*/
|
||||
void DeckViewContainer::updateShowVisualDeckStorage(bool enabled)
|
||||
{
|
||||
// view mode state isn't stored in a field, so we determine state by checking the button
|
||||
if (loadLocalButton->isEnabled()) {
|
||||
deckView->setHidden(enabled);
|
||||
visualDeckStorageWidget->setHidden(!enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void DeckViewContainer::unloadDeck()
|
||||
{
|
||||
deckView->clearDeck();
|
||||
switchToDeckSelectView();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ private slots:
|
|||
void sideboardLockButtonClicked();
|
||||
void updateSideboardLockButtonText();
|
||||
void refreshShortcuts();
|
||||
void updateShowVisualDeckStorage(bool enabled);
|
||||
signals:
|
||||
void newCardAdded(AbstractCardItem *card);
|
||||
void notIdle();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue