MCPcopy Create free account
hub / github.com/YACReader/yacreader / themeFromId

Method themeFromId

common/themes/theme_manager.cpp:46–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46Theme ThemeManager::themeFromId(const QString &id, ThemeVariant fallbackVariant)
47{
48 // Try the repository first (handles both builtin and user themes via JSON)
49 if (repository && repository->contains(id)) {
50 QJsonObject json = repository->loadThemeJson(id);
51 if (!json.isEmpty())
52 return makeTheme(json);
53 }
54
55 // Fallback to the builtin that matches the current dark/light intent.
56 const QString fallbackId = (fallbackVariant == ThemeVariant::Dark)
57 ? QStringLiteral("builtin/dark")
58 : QStringLiteral("builtin/light");
59 if (repository && repository->contains(fallbackId)) {
60 QJsonObject json = repository->loadThemeJson(fallbackId);
61 if (!json.isEmpty())
62 return makeTheme(json);
63 }
64
65 return { };
66}
67
68void ThemeManager::resolveTheme()
69{

Callers

nothing calls this directly

Calls 4

loadThemeJsonMethod · 0.80
isEmptyMethod · 0.80
makeThemeFunction · 0.50
containsMethod · 0.45

Tested by

no test coverage detected