mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
Add animations toggles for the life counter and battlefield
Per-effect toggles plus Enable/Disable-all buttons: a life-counter flash on loss and a crimson battlefield shimmer on damage. Took 24 seconds
This commit is contained in:
parent
48776cfeba
commit
39371f9185
5 changed files with 51 additions and 0 deletions
|
|
@ -116,6 +116,15 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
connect(&tapAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
connect(&tapAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||||
&CardsDisplaySettings::setTapAnimation);
|
&CardsDisplaySettings::setTapAnimation);
|
||||||
|
|
||||||
|
lifeCounterAnimationsCheckBox.setChecked(
|
||||||
|
SettingsCache::instance().userInterface().getLifeCounterAnimationsEnabled());
|
||||||
|
connect(&lifeCounterAnimationsCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||||
|
&InterfaceSettings::setLifeCounterAnimationsEnabled);
|
||||||
|
|
||||||
|
battlefieldFlashCheckBox.setChecked(SettingsCache::instance().userInterface().getBattlefieldFlashEnabled());
|
||||||
|
connect(&battlefieldFlashCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||||
|
&InterfaceSettings::setBattlefieldFlashEnabled);
|
||||||
|
|
||||||
connect(&enableAllAnimationsButton, &QPushButton::clicked, this, &UserInterfaceSettingsPage::enableAllAnimations);
|
connect(&enableAllAnimationsButton, &QPushButton::clicked, this, &UserInterfaceSettingsPage::enableAllAnimations);
|
||||||
connect(&disableAllAnimationsButton, &QPushButton::clicked, this, &UserInterfaceSettingsPage::disableAllAnimations);
|
connect(&disableAllAnimationsButton, &QPushButton::clicked, this, &UserInterfaceSettingsPage::disableAllAnimations);
|
||||||
|
|
||||||
|
|
@ -123,6 +132,8 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
animationGrid->addWidget(&enableAllAnimationsButton, 0, 0);
|
animationGrid->addWidget(&enableAllAnimationsButton, 0, 0);
|
||||||
animationGrid->addWidget(&disableAllAnimationsButton, 0, 1);
|
animationGrid->addWidget(&disableAllAnimationsButton, 0, 1);
|
||||||
animationGrid->addWidget(&tapAnimationCheckBox, 1, 0);
|
animationGrid->addWidget(&tapAnimationCheckBox, 1, 0);
|
||||||
|
animationGrid->addWidget(&lifeCounterAnimationsCheckBox, 2, 0);
|
||||||
|
animationGrid->addWidget(&battlefieldFlashCheckBox, 3, 0);
|
||||||
|
|
||||||
animationGroupBox = new QGroupBox;
|
animationGroupBox = new QGroupBox;
|
||||||
animationGroupBox->setLayout(animationGrid);
|
animationGroupBox->setLayout(animationGrid);
|
||||||
|
|
@ -276,11 +287,17 @@ void UserInterfaceSettingsPage::setNotificationEnabled(QT_STATE_CHANGED_T i)
|
||||||
void UserInterfaceSettingsPage::enableAllAnimations()
|
void UserInterfaceSettingsPage::enableAllAnimations()
|
||||||
{
|
{
|
||||||
tapAnimationCheckBox.setChecked(true);
|
tapAnimationCheckBox.setChecked(true);
|
||||||
|
lifeCounterAnimationsCheckBox.setChecked(true);
|
||||||
|
battlefieldFlashCheckBox.setChecked(true);
|
||||||
|
visualDeckStorageSelectionAnimationCheckBox.setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterfaceSettingsPage::disableAllAnimations()
|
void UserInterfaceSettingsPage::disableAllAnimations()
|
||||||
{
|
{
|
||||||
tapAnimationCheckBox.setChecked(false);
|
tapAnimationCheckBox.setChecked(false);
|
||||||
|
lifeCounterAnimationsCheckBox.setChecked(false);
|
||||||
|
battlefieldFlashCheckBox.setChecked(false);
|
||||||
|
visualDeckStorageSelectionAnimationCheckBox.setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterfaceSettingsPage::updateCommanderSpellbookUiState()
|
void UserInterfaceSettingsPage::updateCommanderSpellbookUiState()
|
||||||
|
|
@ -328,6 +345,8 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||||
enableAllAnimationsButton.setText(tr("&Enable all animations"));
|
enableAllAnimationsButton.setText(tr("&Enable all animations"));
|
||||||
disableAllAnimationsButton.setText(tr("&Disable all animations"));
|
disableAllAnimationsButton.setText(tr("&Disable all animations"));
|
||||||
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
||||||
|
lifeCounterAnimationsCheckBox.setText(tr("Life counter flash"));
|
||||||
|
battlefieldFlashCheckBox.setText(tr("Battlefield flash on damage"));
|
||||||
deckEditorGroupBox->setTitle(tr("Deck editor/storage settings"));
|
deckEditorGroupBox->setTitle(tr("Deck editor/storage settings"));
|
||||||
openDeckInNewTabCheckBox.setText(tr("Open deck in new tab by default"));
|
openDeckInNewTabCheckBox.setText(tr("Open deck in new tab by default"));
|
||||||
visualDeckStorageInGameCheckBox.setText(tr("Use visual deck storage in game lobby"));
|
visualDeckStorageInGameCheckBox.setText(tr("Use visual deck storage in game lobby"));
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ private:
|
||||||
QPushButton enableAllAnimationsButton;
|
QPushButton enableAllAnimationsButton;
|
||||||
QPushButton disableAllAnimationsButton;
|
QPushButton disableAllAnimationsButton;
|
||||||
QCheckBox tapAnimationCheckBox;
|
QCheckBox tapAnimationCheckBox;
|
||||||
|
QCheckBox lifeCounterAnimationsCheckBox;
|
||||||
|
QCheckBox battlefieldFlashCheckBox;
|
||||||
QCheckBox openDeckInNewTabCheckBox;
|
QCheckBox openDeckInNewTabCheckBox;
|
||||||
QLabel visualDeckStoragePromptForConversionLabel;
|
QLabel visualDeckStoragePromptForConversionLabel;
|
||||||
QComboBox visualDeckStoragePromptForConversionSelector;
|
QComboBox visualDeckStoragePromptForConversionSelector;
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public:
|
||||||
[[nodiscard]] virtual bool getShowStatusBar() const = 0;
|
[[nodiscard]] virtual bool getShowStatusBar() const = 0;
|
||||||
[[nodiscard]] virtual bool getShowShortcuts() const = 0;
|
[[nodiscard]] virtual bool getShowShortcuts() const = 0;
|
||||||
[[nodiscard]] virtual bool getShowGameSelectorFilterToolbar() const = 0;
|
[[nodiscard]] virtual bool getShowGameSelectorFilterToolbar() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getLifeCounterAnimationsEnabled() const = 0;
|
||||||
|
[[nodiscard]] virtual bool getBattlefieldFlashEnabled() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
#endif // COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,16 @@ bool InterfaceSettings::getShowGameSelectorFilterToolbar() const
|
||||||
return getValue("showGameSelectorFilterToolbar", QString(), QString(), true).toBool();
|
return getValue("showGameSelectorFilterToolbar", QString(), QString(), true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InterfaceSettings::getLifeCounterAnimationsEnabled() const
|
||||||
|
{
|
||||||
|
return getValue("lifeCounterAnimationsEnabled", QString(), QString(), true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InterfaceSettings::getBattlefieldFlashEnabled() const
|
||||||
|
{
|
||||||
|
return getValue("battlefieldFlashEnabled", QString(), QString(), true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
void InterfaceSettings::setUseTearOffMenus(bool _useTearOffMenus)
|
void InterfaceSettings::setUseTearOffMenus(bool _useTearOffMenus)
|
||||||
{
|
{
|
||||||
setValue(_useTearOffMenus, "useTearOffMenus");
|
setValue(_useTearOffMenus, "useTearOffMenus");
|
||||||
|
|
@ -326,3 +336,15 @@ void InterfaceSettings::setShowGameSelectorFilterToolbar(bool _showGameSelectorF
|
||||||
setValue(_showGameSelectorFilterToolbar, "showGameSelectorFilterToolbar");
|
setValue(_showGameSelectorFilterToolbar, "showGameSelectorFilterToolbar");
|
||||||
emit showGameSelectorFilterToolbarChanged(_showGameSelectorFilterToolbar);
|
emit showGameSelectorFilterToolbarChanged(_showGameSelectorFilterToolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InterfaceSettings::setLifeCounterAnimationsEnabled(bool _lifeCounterAnimationsEnabled)
|
||||||
|
{
|
||||||
|
setValue(_lifeCounterAnimationsEnabled, "lifeCounterAnimationsEnabled");
|
||||||
|
emit lifeCounterAnimationsEnabledChanged(_lifeCounterAnimationsEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InterfaceSettings::setBattlefieldFlashEnabled(bool _battlefieldFlashEnabled)
|
||||||
|
{
|
||||||
|
setValue(_battlefieldFlashEnabled, "battlefieldFlashEnabled");
|
||||||
|
emit battlefieldFlashEnabledChanged(_battlefieldFlashEnabled);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ public:
|
||||||
[[nodiscard]] bool getShowStatusBar() const override;
|
[[nodiscard]] bool getShowStatusBar() const override;
|
||||||
[[nodiscard]] bool getShowShortcuts() const override;
|
[[nodiscard]] bool getShowShortcuts() const override;
|
||||||
[[nodiscard]] bool getShowGameSelectorFilterToolbar() const override;
|
[[nodiscard]] bool getShowGameSelectorFilterToolbar() const override;
|
||||||
|
[[nodiscard]] bool getLifeCounterAnimationsEnabled() const override;
|
||||||
|
[[nodiscard]] bool getBattlefieldFlashEnabled() const override;
|
||||||
|
|
||||||
void setUseTearOffMenus(bool _useTearOffMenus);
|
void setUseTearOffMenus(bool _useTearOffMenus);
|
||||||
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
|
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
|
||||||
|
|
@ -74,6 +76,8 @@ public:
|
||||||
void setShowStatusBar(bool _showStatusBar);
|
void setShowStatusBar(bool _showStatusBar);
|
||||||
void setShowShortcuts(bool _showShortcuts);
|
void setShowShortcuts(bool _showShortcuts);
|
||||||
void setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar);
|
void setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar);
|
||||||
|
void setLifeCounterAnimationsEnabled(bool _lifeCounterAnimationsEnabled);
|
||||||
|
void setBattlefieldFlashEnabled(bool _battlefieldFlashEnabled);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void useTearOffMenusChanged(bool state);
|
void useTearOffMenusChanged(bool state);
|
||||||
|
|
@ -85,6 +89,8 @@ signals:
|
||||||
void tallyTypeChanged(int type);
|
void tallyTypeChanged(int type);
|
||||||
void showStatusBarChanged(bool state);
|
void showStatusBarChanged(bool state);
|
||||||
void showGameSelectorFilterToolbarChanged(bool state);
|
void showGameSelectorFilterToolbarChanged(bool state);
|
||||||
|
void lifeCounterAnimationsEnabledChanged(bool state);
|
||||||
|
void battlefieldFlashEnabledChanged(bool state);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit InterfaceSettings(const QString &settingPath, QObject *parent = nullptr);
|
explicit InterfaceSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue