mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
let view be turned off
This commit is contained in:
parent
3b2ae68941
commit
dde338e78d
4 changed files with 28 additions and 5 deletions
|
|
@ -517,6 +517,11 @@ void DeckView::setDeck(const DeckList &_deck)
|
||||||
deckViewScene->setDeck(_deck);
|
deckViewScene->setDeck(_deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckView::clearDeck()
|
||||||
|
{
|
||||||
|
deckViewScene->clearContents();
|
||||||
|
}
|
||||||
|
|
||||||
void DeckView::resetSideboardPlan()
|
void DeckView::resetSideboardPlan()
|
||||||
{
|
{
|
||||||
deckViewScene->resetSideboardPlan();
|
deckViewScene->resetSideboardPlan();
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,6 @@ private:
|
||||||
DeckList *deck;
|
DeckList *deck;
|
||||||
QMap<QString, DeckViewCardContainer *> cardContainers;
|
QMap<QString, DeckViewCardContainer *> cardContainers;
|
||||||
qreal optimalAspectRatio;
|
qreal optimalAspectRatio;
|
||||||
void clearContents();
|
|
||||||
void rebuildTree();
|
void rebuildTree();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -123,6 +122,7 @@ public:
|
||||||
{
|
{
|
||||||
return locked;
|
return locked;
|
||||||
}
|
}
|
||||||
|
void clearContents();
|
||||||
void setDeck(const DeckList &_deck);
|
void setDeck(const DeckList &_deck);
|
||||||
void setOptimalAspectRatio(qreal _optimalAspectRatio)
|
void setOptimalAspectRatio(qreal _optimalAspectRatio)
|
||||||
{
|
{
|
||||||
|
|
@ -152,6 +152,7 @@ signals:
|
||||||
public:
|
public:
|
||||||
explicit DeckView(QWidget *parent = nullptr);
|
explicit DeckView(QWidget *parent = nullptr);
|
||||||
void setDeck(const DeckList &_deck);
|
void setDeck(const DeckList &_deck);
|
||||||
|
void clearDeck();
|
||||||
void setLocked(bool _locked)
|
void setLocked(bool _locked)
|
||||||
{
|
{
|
||||||
deckViewScene->setLocked(_locked);
|
deckViewScene->setLocked(_locked);
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,9 @@ DeckViewContainer::DeckViewContainer(int _playerId, TabGame *parent)
|
||||||
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
|
||||||
refreshShortcuts();
|
refreshShortcuts();
|
||||||
|
|
||||||
|
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageInGameChanged, this,
|
||||||
|
&DeckViewContainer::updateShowVisualDeckStorage);
|
||||||
|
|
||||||
switchToDeckSelectView();
|
switchToDeckSelectView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,8 +125,8 @@ static void setVisibility(QPushButton *button, bool visible)
|
||||||
|
|
||||||
void DeckViewContainer::switchToDeckSelectView()
|
void DeckViewContainer::switchToDeckSelectView()
|
||||||
{
|
{
|
||||||
deckView->setVisible(false);
|
deckView->setHidden(SettingsCache::instance().getVisualDeckStorageInGame());
|
||||||
visualDeckStorageWidget->setVisible(true);
|
visualDeckStorageWidget->setHidden(!SettingsCache::instance().getVisualDeckStorageInGame());
|
||||||
deckViewLayout->update();
|
deckViewLayout->update();
|
||||||
|
|
||||||
setVisibility(loadLocalButton, true);
|
setVisibility(loadLocalButton, true);
|
||||||
|
|
@ -143,8 +146,8 @@ void DeckViewContainer::switchToDeckSelectView()
|
||||||
|
|
||||||
void DeckViewContainer::switchToDeckLoadedView()
|
void DeckViewContainer::switchToDeckLoadedView()
|
||||||
{
|
{
|
||||||
deckView->setVisible(true);
|
deckView->setHidden(false);
|
||||||
visualDeckStorageWidget->setVisible(false);
|
visualDeckStorageWidget->setHidden(true);
|
||||||
deckViewLayout->update();
|
deckViewLayout->update();
|
||||||
|
|
||||||
setVisibility(loadLocalButton, false);
|
setVisibility(loadLocalButton, false);
|
||||||
|
|
@ -179,8 +182,21 @@ void DeckViewContainer::refreshShortcuts()
|
||||||
sideboardLockButton->setShortcut(shortcuts.getSingleShortcut("DeckViewContainer/sideboardLockButton"));
|
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()
|
void DeckViewContainer::unloadDeck()
|
||||||
{
|
{
|
||||||
|
deckView->clearDeck();
|
||||||
switchToDeckSelectView();
|
switchToDeckSelectView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ 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();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue