| 44 | } |
| 45 | |
| 46 | Theme 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 | |
| 68 | void ThemeManager::resolveTheme() |
| 69 | { |
nothing calls this directly
no test coverage detected