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
The blanket animations switch plus per-effect toggles: a life-counter flash on loss and a crimson battlefield shimmer on damage. Took 2 minutes
This commit is contained in:
parent
a5f43c08fa
commit
c7ad813619
5 changed files with 83 additions and 1 deletions
|
|
@ -116,8 +116,37 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
|||
connect(&tapAnimationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setTapAnimation);
|
||||
|
||||
animationsEnabledCheckBox.setChecked(SettingsCache::instance().userInterface().getAnimationsEnabled());
|
||||
connect(&animationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setAnimationsEnabled);
|
||||
|
||||
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);
|
||||
|
||||
auto *animationGrid = new QGridLayout;
|
||||
animationGrid->addWidget(&tapAnimationCheckBox, 0, 0);
|
||||
animationGrid->addWidget(&animationsEnabledCheckBox, 0, 0);
|
||||
animationGrid->addWidget(&tapAnimationCheckBox, 1, 0);
|
||||
|
||||
// Subgroup for per-effect toggles, active only while the blanket "enable all" is on.
|
||||
auto *animationDetailGrid = new QGridLayout;
|
||||
animationDetailGrid->addWidget(&lifeCounterAnimationsCheckBox, 0, 0);
|
||||
animationDetailGrid->addWidget(&battlefieldFlashCheckBox, 1, 0);
|
||||
animationDetailGroupBox = new QGroupBox;
|
||||
animationDetailGroupBox->setLayout(animationDetailGrid);
|
||||
animationGrid->addWidget(animationDetailGroupBox, 2, 0);
|
||||
|
||||
const auto syncAnimationDetailEnabled = [this] {
|
||||
animationDetailGroupBox->setEnabled(SettingsCache::instance().userInterface().getAnimationsEnabled());
|
||||
};
|
||||
syncAnimationDetailEnabled();
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::animationsEnabledChanged, this,
|
||||
syncAnimationDetailEnabled);
|
||||
|
||||
animationGroupBox = new QGroupBox;
|
||||
animationGroupBox->setLayout(animationGrid);
|
||||
|
|
@ -310,7 +339,11 @@ void UserInterfaceSettingsPage::retranslateUi()
|
|||
specNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar for game events while you are spectating"));
|
||||
buddyConnectNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar when users in your buddy list connect"));
|
||||
animationGroupBox->setTitle(tr("Animation settings"));
|
||||
animationsEnabledCheckBox.setText(tr("Enable game &animations"));
|
||||
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
||||
animationDetailGroupBox->setTitle(tr("Individual animations"));
|
||||
lifeCounterAnimationsCheckBox.setText(tr("Life counter flash"));
|
||||
battlefieldFlashCheckBox.setText(tr("Battlefield flash on damage"));
|
||||
deckEditorGroupBox->setTitle(tr("Deck editor/storage settings"));
|
||||
openDeckInNewTabCheckBox.setText(tr("Open deck in new tab by default"));
|
||||
visualDeckStorageInGameCheckBox.setText(tr("Use visual deck storage in game lobby"));
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ private:
|
|||
QCheckBox useTearOffMenusCheckBox;
|
||||
QCheckBox keepGameChatFocusCheckBox;
|
||||
QCheckBox tapAnimationCheckBox;
|
||||
QCheckBox animationsEnabledCheckBox;
|
||||
QCheckBox lifeCounterAnimationsCheckBox;
|
||||
QCheckBox battlefieldFlashCheckBox;
|
||||
QCheckBox openDeckInNewTabCheckBox;
|
||||
QLabel visualDeckStoragePromptForConversionLabel;
|
||||
QComboBox visualDeckStoragePromptForConversionSelector;
|
||||
|
|
@ -52,6 +55,7 @@ private:
|
|||
QGroupBox *generalGroupBox;
|
||||
QGroupBox *notificationsGroupBox;
|
||||
QGroupBox *animationGroupBox;
|
||||
QGroupBox *animationDetailGroupBox;
|
||||
QGroupBox *deckEditorGroupBox;
|
||||
QGroupBox *replayGroupBox;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ public:
|
|||
[[nodiscard]] virtual bool getShowStatusBar() const = 0;
|
||||
[[nodiscard]] virtual bool getShowShortcuts() const = 0;
|
||||
[[nodiscard]] virtual bool getShowGameSelectorFilterToolbar() const = 0;
|
||||
[[nodiscard]] virtual bool getAnimationsEnabled() const = 0;
|
||||
[[nodiscard]] virtual bool getLifeCounterAnimationsEnabled() const = 0;
|
||||
[[nodiscard]] virtual bool getBattlefieldFlashEnabled() const = 0;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
||||
|
|
|
|||
|
|
@ -160,6 +160,21 @@ bool InterfaceSettings::getShowGameSelectorFilterToolbar() const
|
|||
return getValue("showGameSelectorFilterToolbar", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getAnimationsEnabled() const
|
||||
{
|
||||
return getValue("animationsEnabled", 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)
|
||||
{
|
||||
setValue(_useTearOffMenus, "useTearOffMenus");
|
||||
|
|
@ -326,3 +341,21 @@ void InterfaceSettings::setShowGameSelectorFilterToolbar(bool _showGameSelectorF
|
|||
setValue(_showGameSelectorFilterToolbar, "showGameSelectorFilterToolbar");
|
||||
emit showGameSelectorFilterToolbarChanged(_showGameSelectorFilterToolbar);
|
||||
}
|
||||
|
||||
void InterfaceSettings::setAnimationsEnabled(bool _animationsEnabled)
|
||||
{
|
||||
setValue(_animationsEnabled, "animationsEnabled");
|
||||
emit animationsEnabledChanged(_animationsEnabled);
|
||||
}
|
||||
|
||||
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,9 @@ public:
|
|||
[[nodiscard]] bool getShowStatusBar() const override;
|
||||
[[nodiscard]] bool getShowShortcuts() const override;
|
||||
[[nodiscard]] bool getShowGameSelectorFilterToolbar() const override;
|
||||
[[nodiscard]] bool getAnimationsEnabled() const override;
|
||||
[[nodiscard]] bool getLifeCounterAnimationsEnabled() const override;
|
||||
[[nodiscard]] bool getBattlefieldFlashEnabled() const override;
|
||||
|
||||
void setUseTearOffMenus(bool _useTearOffMenus);
|
||||
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
|
||||
|
|
@ -74,6 +77,9 @@ public:
|
|||
void setShowStatusBar(bool _showStatusBar);
|
||||
void setShowShortcuts(bool _showShortcuts);
|
||||
void setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar);
|
||||
void setAnimationsEnabled(bool _animationsEnabled);
|
||||
void setLifeCounterAnimationsEnabled(bool _lifeCounterAnimationsEnabled);
|
||||
void setBattlefieldFlashEnabled(bool _battlefieldFlashEnabled);
|
||||
|
||||
signals:
|
||||
void useTearOffMenusChanged(bool state);
|
||||
|
|
@ -85,6 +91,9 @@ signals:
|
|||
void tallyTypeChanged(int type);
|
||||
void showStatusBarChanged(bool state);
|
||||
void showGameSelectorFilterToolbarChanged(bool state);
|
||||
void animationsEnabledChanged(bool state);
|
||||
void lifeCounterAnimationsEnabledChanged(bool state);
|
||||
void battlefieldFlashEnabledChanged(bool state);
|
||||
|
||||
public:
|
||||
explicit InterfaceSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue