Cockatrice/libcockatrice_settings/libcockatrice/settings/deck_editor_settings.cpp
BruebachL 827e44a4d3
[DeckEditor] Use CommanderSpellbook.com to estimate bracket if format is 'commander' (#6415)
* [DeckEditor] Use CommanderSpellbook.com to estimate bracket if format is 'commander'

Took 2 minutes

Took 16 minutes

* 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

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-08-09 00:46:17 +02:00

72 lines
2.5 KiB
C++

#include "deck_editor_settings.h"
DeckEditorSettings::DeckEditorSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "deck_editor.ini", "deckeditor", QString(), parent)
{
}
bool DeckEditorSettings::getOpenDeckInNewTab() const
{
return getValue("openDeckInNewTab", QString(), QString(), false).toBool();
}
bool DeckEditorSettings::getBannerCardComboBoxVisible() const
{
return getValue("bannerCardComboBoxVisible", QString(), QString(), true).toBool();
}
bool DeckEditorSettings::getTagsWidgetVisible() const
{
return getValue("tagsWidgetVisible", QString(), QString(), true).toBool();
}
int DeckEditorSettings::getDefaultDeckEditorType() const
{
return getValue("defaultDeckEditorType", QString(), QString(), 1).toInt();
}
void DeckEditorSettings::setOpenDeckInNewTab(bool _openDeckInNewTab)
{
setValue(_openDeckInNewTab, "openDeckInNewTab");
}
void DeckEditorSettings::setBannerCardComboBoxVisible(bool _bannerCardComboBoxVisible)
{
setValue(_bannerCardComboBoxVisible, "bannerCardComboBoxVisible");
emit bannerCardComboBoxVisibleChanged(_bannerCardComboBoxVisible);
}
void DeckEditorSettings::setTagsWidgetVisible(bool _tagsWidgetVisible)
{
setValue(_tagsWidgetVisible, "tagsWidgetVisible");
emit tagsWidgetVisibleChanged(_tagsWidgetVisible);
}
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);
}