Convert json data holder to structs, rename variables, extract widget

- Extract bracket estimation UI from DeckEditorDeckDockWidget into a
  new CommanderBracketWidget
- Move CommanderSpellbook integration settings from CardsDisplaySettings
  to DeckEditorSettings (matching the settings refactor on master)
- Rename CommanderSpellbook integration variables to drop the redundant
  'DeckEditor' prefix

Took 4 minutes

# Commit time for manual adjustment:
# Took 6 minutes

# Commit time for manual adjustment:
# Took 8 minutes
This commit is contained in:
Lukas Brübach 2026-08-08 23:19:58 +02:00
parent b0035d41cb
commit 375898c565
30 changed files with 575 additions and 568 deletions

View file

@ -214,29 +214,3 @@ void CardsDisplaySettings::setSampleHandSize(int _sampleHandSize)
setValue(_sampleHandSize, "sampleHandSize", "cards", "cardSize");
emit sampleHandSizeChanged(_sampleHandSize);
}
int CardsDisplaySettings::getDeckEditorCommanderSpellbookIntegrationEnabled() const
{
return getValue("deckeditorcommanderspellbookintegrationenabled", "interface", QString(),
deckEditorCommanderSpellbookIntegrationEnabledIndexUnprompted)
.toInt();
}
bool CardsDisplaySettings::getDeckEditorCommanderSpellbookIntegrationUseOfficialBracketNames() const
{
return getValue("deckeditorcommanderspellbookintegrationuseofficialbracketnames", "interface", QString(), false)
.toBool();
}
void CardsDisplaySettings::setDeckEditorCommanderSpellbookIntegrationEnabled(int _enabled)
{
setValue(_enabled, "deckeditorcommanderspellbookintegrationenabled", "interface");
emit deckEditorCommanderSpellbookIntegrationEnabledChanged(_enabled);
}
void CardsDisplaySettings::setDeckEditorCommanderSpellbookIntegrationUseOfficialBracketNames(
bool _useOfficialBracketNames)
{
setValue(_useOfficialBracketNames, "deckeditorcommanderspellbookintegrationuseofficialbracketnames", "interface");
emit deckEditorCommanderSpellbookIntegrationUseOfficialBracketNamesChanged(_useOfficialBracketNames);
}

View file

@ -5,14 +5,6 @@
#include <libcockatrice/interfaces/interface_cards_display_settings_provider.h>
enum deckEditorCommanderSpellbookIntegrationEnabledIndex
{
deckEditorCommanderSpellbookIntegrationEnabledIndexDisabled,
deckEditorCommanderSpellbookIntegrationEnabledIndexEnabled,
deckEditorCommanderSpellbookIntegrationEnabledIndexAutomatic,
deckEditorCommanderSpellbookIntegrationEnabledIndexUnprompted,
};
class CardsDisplaySettings : public SettingsManager, public ICardsDisplaySettingsProvider
{
Q_OBJECT
@ -39,12 +31,6 @@ public:
[[nodiscard]] int getArchidektPreviewSize() const override;
[[nodiscard]] int getSampleHandSize() const override;
[[nodiscard]] int getDeckEditorCommanderSpellbookIntegrationEnabled() const;
[[nodiscard]] bool getDeckEditorCommanderSpellbookIntegrationUseOfficialBracketNames() const;
void setDeckEditorCommanderSpellbookIntegrationEnabled(int _deckEditorCommanderSpellbookIntegrationEnabled);
void setDeckEditorCommanderSpellbookIntegrationUseOfficialBracketNames(
bool _deckEditorCommanderSpellbookIntegrationUseOfficialBracketNames);
void setDisplayCardNames(bool _displayCardNames);
void setRoundCardCorners(bool _roundCardCorners);
void setOverrideAllCardArtWithPersonalPreference(bool _overrideAllCardArt);
@ -80,8 +66,6 @@ signals:
void edhRecCardSizeChanged();
void archidektPreviewSizeChanged();
void sampleHandSizeChanged(int amount);
void deckEditorCommanderSpellbookIntegrationEnabledChanged(int _enabled);
void deckEditorCommanderSpellbookIntegrationUseOfficialBracketNamesChanged(bool _useOfficialBracketNames);
public:
explicit CardsDisplaySettings(const QString &settingPath, QObject *parent = nullptr);

View file

@ -191,4 +191,4 @@ QString CommanderBracketSettings::explanation(const QString &tag) const
bool CommanderBracketSettings::contains(const QString &tag) const
{
return definitions.contains(tag);
}
}

View file

@ -46,3 +46,27 @@ void DeckEditorSettings::setDefaultDeckEditorType(int _defaultDeckEditorType)
{
setValue(_defaultDeckEditorType, "defaultDeckEditorType");
}
int DeckEditorSettings::getCommanderSpellbookIntegrationEnabled() const
{
return getValue("commanderspellbookintegrationenabled", QString(), QString(),
commanderSpellbookIntegrationEnabledIndexUnprompted)
.toInt();
}
bool DeckEditorSettings::getCommanderSpellbookIntegrationUseOfficialBracketNames() const
{
return getValue("commanderspellbookintegrationuseofficialbracketnames", QString(), QString(), false).toBool();
}
void DeckEditorSettings::setCommanderSpellbookIntegrationEnabled(int _commanderSpellbookIntegrationEnabled)
{
setValue(_commanderSpellbookIntegrationEnabled, "commanderspellbookintegrationenabled");
emit commanderSpellbookIntegrationEnabledChanged(_commanderSpellbookIntegrationEnabled);
}
void DeckEditorSettings::setCommanderSpellbookIntegrationUseOfficialBracketNames(bool _useOfficialBracketNames)
{
setValue(_useOfficialBracketNames, "commanderspellbookintegrationuseofficialbracketnames");
emit commanderSpellbookIntegrationUseOfficialBracketNamesChanged(_useOfficialBracketNames);
}

View file

@ -5,6 +5,14 @@
#include <libcockatrice/interfaces/interface_deck_editor_settings_provider.h>
enum commanderSpellbookIntegrationEnabledIndex
{
commanderSpellbookIntegrationEnabledIndexDisabled,
commanderSpellbookIntegrationEnabledIndexEnabled,
commanderSpellbookIntegrationEnabledIndexAutomatic,
commanderSpellbookIntegrationEnabledIndexUnprompted,
};
class DeckEditorSettings : public SettingsManager, public IDeckEditorSettingsProvider
{
Q_OBJECT
@ -15,15 +23,21 @@ public:
[[nodiscard]] bool getBannerCardComboBoxVisible() const override;
[[nodiscard]] bool getTagsWidgetVisible() const override;
[[nodiscard]] int getDefaultDeckEditorType() const override;
[[nodiscard]] int getCommanderSpellbookIntegrationEnabled() const;
[[nodiscard]] bool getCommanderSpellbookIntegrationUseOfficialBracketNames() const;
void setOpenDeckInNewTab(bool _openDeckInNewTab);
void setBannerCardComboBoxVisible(bool _bannerCardComboBoxVisible);
void setTagsWidgetVisible(bool _tagsWidgetVisible);
void setDefaultDeckEditorType(int _defaultDeckEditorType);
void setCommanderSpellbookIntegrationEnabled(int _commanderSpellbookIntegrationEnabled);
void setCommanderSpellbookIntegrationUseOfficialBracketNames(bool _useOfficialBracketNames);
signals:
void bannerCardComboBoxVisibleChanged(bool visible);
void tagsWidgetVisibleChanged(bool visible);
void commanderSpellbookIntegrationEnabledChanged(int enabled);
void commanderSpellbookIntegrationUseOfficialBracketNamesChanged(bool useOfficialBracketNames);
public:
explicit DeckEditorSettings(const QString &settingPath, QObject *parent = nullptr);