Cockatrice/libcockatrice_settings/libcockatrice/settings/appearance_settings.cpp
Lukas Brübach 8c2bfc46ff [Fonts] Retire max font size setting into theme CardText min/max range
The per-card text size lives in the theme now, so a theme can pick the size
it was designed for instead of every user overriding it globally.

- CardText stores family + max point size; CardTextMinSize stores the
  overlay shrink-to-fit floor (omitted from fonts.toml when 1).
- ThemeManager::cardTextMaxSize()/cardTextMinSize() resolve the range with
  the retired defaults (12 max, 1 min), and cardTextMaxSize() falls back to
  the CardText role size that #7541 made live.
- The overlay widget starts at the explicit size when one is set (deck
  preview), else the theme max, and shrinks down to the theme floor.
- The appearance page's "Maximum font size" spin is gone; the range is
  edited in the theme's font grid, whose min/max spins now keep the saved
  range consistent with each other.
- Migration: appearance/maxFontSize is seeded into every user theme folder
  and into the active theme's folder (created when the theme is a shipped
  one that only exists in the system directory). The retired
  game/maxfontsize -> appearance/maxFontSize mapping stays, so users still
  on global.ini keep their value through the chain.
2026-11-03 00:21:48 +01:00

89 lines
2.4 KiB
C++

#include "appearance_settings.h"
#include "libcockatrice/settings/settings_manager.h"
#include <QVariant>
class QObject;
AppearanceSettings::AppearanceSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "appearance.ini", "appearance", QString(), parent)
{
}
QString AppearanceSettings::getThemeName() const
{
return getValue("themeName", QString(), QString()).toString();
}
void AppearanceSettings::setThemeName(const QString &_themeName)
{
setValue(_themeName, "themeName");
emit themeNameChanged();
}
bool AppearanceSettings::getStyleUserList() const
{
return getValue("styleUserList", QString(), QString(), true).toBool();
}
void AppearanceSettings::setStyleUserList(bool _styleUserList)
{
setValue(_styleUserList, "styleUserList");
emit styleUserListChanged();
}
QString AppearanceSettings::getHomeTabBackgroundSource() const
{
return getValue("homeTabBackgroundSource", QString(), QString(), "themed").toString();
}
void AppearanceSettings::setHomeTabBackgroundSource(const QString &_backgroundSource)
{
setValue(_backgroundSource, "homeTabBackgroundSource");
emit homeTabBackgroundSourceChanged();
}
int AppearanceSettings::getHomeTabBackgroundShuffleFrequency() const
{
return getValue("homeTabBackgroundShuffleFrequency", QString(), QString(), 0).toInt();
}
void AppearanceSettings::setHomeTabBackgroundShuffleFrequency(int _frequency)
{
setValue(_frequency, "homeTabBackgroundShuffleFrequency");
emit homeTabBackgroundShuffleFrequencyChanged();
}
bool AppearanceSettings::getHomeTabDisplayCardName() const
{
return getValue("homeTabDisplayCardName", QString(), QString(), true).toBool();
}
void AppearanceSettings::setHomeTabDisplayCardName(bool _displayCardName)
{
setValue(_displayCardName, "homeTabDisplayCardName");
emit homeTabDisplayCardNameChanged();
}
bool AppearanceSettings::getHomeTabBackgroundDim() const
{
return getValue("homeTabBackgroundDim", QString(), QString(), true).toBool();
}
void AppearanceSettings::setHomeTabBackgroundDim(bool _dimBackground)
{
setValue(_dimBackground, "homeTabBackgroundDim");
emit homeTabBackgroundDimChanged();
}
int AppearanceSettings::getHomeTabButtonColorSourceIndex() const
{
return getValue("homeTabButtonColorSource", "", "", 0).toInt();
}
void AppearanceSettings::setHomeTabButtonColorSourceIndex(int index)
{
setValue(index, "homeTabButtonColorSource");
emit homeTabButtonColorChanged();
}