mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[Theme] Add scheme-variant asset resolution (#7275)
* Add scheme-variant theme asset resolution (#7209-1) ThemeManager::assetPath() and schemeVariantPath() resolve a theme asset to its scheme-variant file (prefix-light/dark.png) with fallback to the plain asset, and themePixmap()/loadBrush()/loadExtraBrush() use them. CSS files load style-dark.css or style-light.css when present. Home widget re-resolves its background on theme change. Link pixel_map_generator.cpp into the oracle target, which needs Qt6::Xml for QDomDocument. * Fix clang-format wrap of theme format probe lists --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
202a5ac958
commit
e9bf1e6e46
7 changed files with 147 additions and 12 deletions
|
|
@ -87,6 +87,20 @@ public:
|
|||
// Load/save per-scheme palette colors
|
||||
static PaletteConfig loadPaletteConfig(const QString &themeDirPath, const QString &colorScheme);
|
||||
static bool savePaletteConfig(const QString &themeDirPath, const QString &colorScheme, const PaletteConfig &cfg);
|
||||
// Resolve prefix to a scheme-qualified "theme:" path. Existence is probed
|
||||
// internally across the formats themes may ship (.png/.jpg/.svg), so
|
||||
// callers load the returned path directly. Prefers "<prefix>-<dark|light>"
|
||||
// when a file exists at that stem, otherwise the plain "<prefix>" as the
|
||||
// super fallback. The resolved scheme covers explicit light/dark as well
|
||||
// as OS-resolved "system". Returns the path with its file extension when a
|
||||
// match is found; unqualified assets keep working unchanged.
|
||||
QString assetPath(QStringView prefix) const;
|
||||
// Like assetPath, but resolves only the scheme-qualified variant
|
||||
// ("<prefix>-<dark|light>.<ext>") and returns an empty string when no
|
||||
// variant exists — it never falls back to the plain "<prefix>" asset.
|
||||
// Callers that must distinguish "no authored variant" (e.g. to keep a
|
||||
// legacy runtime fallback alive) should use this instead of assetPath.
|
||||
QString schemeVariantPath(QStringView prefix) const;
|
||||
// Load the theme's shipped default palette, falling back to the system
|
||||
// theme directory when it is absent from the resolved (user) directory.
|
||||
static PaletteConfig
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue