mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
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.
44 lines
1.9 KiB
C++
44 lines
1.9 KiB
C++
#ifndef SETTINGS_MIGRATION_H
|
|
#define SETTINGS_MIGRATION_H
|
|
|
|
#include <QString>
|
|
|
|
class SettingsMigration
|
|
{
|
|
public:
|
|
static bool migrateSettingsFromGlobalIni(const QString &settingsPath);
|
|
static bool migrateLegacySettings(const QString &settingsPath);
|
|
|
|
/**
|
|
* Moves pre-camelCase gamefilters.ini keys (snake_case, game_type/<hash>) to the camelCase
|
|
* keys used since #7084, for profiles that already migrated before that rename and therefore
|
|
* never pass through migrateLegacySettings again. Copies values only where the new key is
|
|
* absent, never deletes the old keys, and returns true when anything was copied. Idempotent,
|
|
* so it runs on every startup.
|
|
*/
|
|
static bool migrateGameFiltersToCamelCase(const QString &settingsPath);
|
|
|
|
/**
|
|
* Moves a non-default appearance/maxFontSize value into each user-writable theme
|
|
* directory lacking an explicit CardText max (creating/merging fonts.toml, never
|
|
* overwriting an explicit max), then deletes the legacy key. Default (12) or absent
|
|
* values only delete the key and create no files, since the ThemeManager fallback
|
|
* already covers them. Idempotent, safe to run on every startup.
|
|
*/
|
|
static bool migrateAppearanceMaxFontSizeToTheme(const QString &settingsPath);
|
|
|
|
/**
|
|
* Returns true when at least one of the two migrations would still do work, i.e. when a
|
|
* backup of the settings directory is worth taking before they run.
|
|
*/
|
|
static bool isMigrationPending(const QString &settingsPath);
|
|
|
|
/**
|
|
* Copies the whole settings directory to a timestamped sibling folder, so a migration that
|
|
* overwrites per-domain files can be undone by hand. Returns the backup path, or an empty
|
|
* string when there was nothing to back up or the copy failed. Never aborts the migration.
|
|
*/
|
|
static QString backupSettingsDirectory(const QString &settingsPath);
|
|
};
|
|
|
|
#endif // SETTINGS_MIGRATION_H
|