Cockatrice/libcockatrice_settings/libcockatrice/settings/appearance_settings.h
BruebachL 3d24597134
[Fonts] Retire max font size setting into theme CardText min/max range (#7544)
* [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.

* [Fonts] Resolve CardText sizes against the shipped theme

Seeding themes/<name>/fonts.toml made getAvailableThemes() resolve the user dir, which shadowed the shipped theme.cfg and stylesheet: styleName came back empty and QSS was cleared. Fall back to the shipped theme dir for theme.cfg and QSS when the user dir exists, and resolve CardText sizes through FontConfig's 6..72 range so a migrated 80..100 renders at the size the editor shows. Insert CardTextMaxSize inside [Fonts] when another section follows.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-11-09 14:02:59 +01:00

54 lines
1.6 KiB
C++

/**
* @file appearance_settings.h
* @ingroup CoreSettings
*/
//! \todo Document this file.
#ifndef APPEARANCE_SETTINGS_H
#define APPEARANCE_SETTINGS_H
#include "settings_manager.h"
#include <QString>
#include <qtmetamacros.h>
class QObject;
class AppearanceSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
[[nodiscard]] QString getThemeName() const;
void setThemeName(const QString &_themeName);
[[nodiscard]] bool getStyleUserList() const;
void setStyleUserList(bool _styleUserList);
[[nodiscard]] QString getHomeTabBackgroundSource() const;
void setHomeTabBackgroundSource(const QString &_backgroundSource);
[[nodiscard]] int getHomeTabBackgroundShuffleFrequency() const;
void setHomeTabBackgroundShuffleFrequency(int _frequency);
[[nodiscard]] bool getHomeTabDisplayCardName() const;
void setHomeTabDisplayCardName(bool _displayCardName);
[[nodiscard]] bool getHomeTabBackgroundDim() const;
void setHomeTabBackgroundDim(bool _dimBackground);
[[nodiscard]] int getHomeTabButtonColorSourceIndex() const;
void setHomeTabButtonColorSourceIndex(int index);
signals:
void themeNameChanged();
void styleUserListChanged();
void homeTabBackgroundSourceChanged();
void homeTabBackgroundShuffleFrequencyChanged();
void homeTabDisplayCardNameChanged();
void homeTabBackgroundDimChanged();
void homeTabButtonColorChanged();
public:
explicit AppearanceSettings(const QString &settingPath, QObject *parent = nullptr);
private:
AppearanceSettings(const AppearanceSettings & /*other*/);
};
#endif // APPEARANCE_SETTINGS_H