![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
#include <theme_manager.h>
Public Types | |
| enum | Role { MinRole = 0 , Hand = MinRole , Stack , Table , Player , MaxRole = Player } |
Signals | |
| void | themeChanged () |
| void | paletteChanged () |
Public Member Functions | |
| ThemeManager (QObject *parent=nullptr) | |
| bool | isDarkMode (const QString &themeDirPath) const |
| bool | isDarkModeActive () const |
| QStringMap & | getAvailableThemes () |
| QString | getCurrentThemePath () const |
| QString | assetPath (QStringView prefix) const |
| QString | schemeVariantPath (QStringView prefix) const |
| void | setColorScheme (const QString &scheme) |
| void | setStyleName (const QString &styleName) |
| void | reloadCurrentTheme () |
| void | previewPalette (const PaletteConfig &cfg, const QString &scheme) |
| QColor | appColor (AppColor::Role role) const |
| QBrush & | getBgBrush (Role zone) |
| QBrush | getExtraBgBrush (Role zone, int zoneId=0) |
Static Public Member Functions | |
| static QString | writableThemeDir (const QString &themeName) |
| static void | migrateLegacyThemeDir (const QString &themesPath, const QString ¤tThemeName) |
| static bool | isDirReallyWritable (const QString &dirPath) |
| static ThemeConfig | loadGlobalConfig (const QString &themeDirPath) |
| static bool | saveGlobalConfig (const QString &themeDirPath, const ThemeConfig &cfg) |
| static PaletteConfig | loadPaletteConfig (const QString &themeDirPath, const QString &colorScheme) |
| static bool | savePaletteConfig (const QString &themeDirPath, const QString &colorScheme, const PaletteConfig &cfg) |
| static PaletteConfig | loadDefaultPaletteConfig (const QString &themeDirPath, const QString &themeName, const QString &colorScheme) |
| static bool | commitPalette (const QString &themeDirPath, const QString &colorScheme, const PaletteConfig &cfg) |
| Writes cfg to disk as the theme's palette-<scheme>.toml and updates the theme's stored colour scheme to match. Shared by PaletteEditorDialog::onSave and FirstRunWizard's theme step so the two "generate + keep" paths can't drift. | |
Protected Slots | |
| void | themeChangedSlot () |
Protected Member Functions | |
| void | ensureThemeDirectoryExists () |
| QBrush | loadBrush (QString fileName, QColor fallbackColor) |
| QBrush | loadExtraBrush (QString fileName, QBrush &fallbackBrush) |
| void | applyStyleAndPalette (const QString &themeName, const ThemeConfig &themeCfg, const PaletteConfig &palCfg, const QString &activeScheme) |
Private Attributes | |
| QString | defaultStyleName |
| QPalette | defaultPalette |
| QString | currentThemePath |
| std::array< QBrush, Role::MaxRole+1 > | brushes |
| QStringMap | availableThemes |
| QMap< AppColor::Role, QColor > | currentAppColors |
| std::array< QBrushMap, Role::MaxRole+1 > | brushesCache |
| enum ThemeManager::Role |
| ThemeManager::ThemeManager | ( | QObject * | parent = nullptr | ) |
| QColor ThemeManager::appColor | ( | AppColor::Role | role | ) | const |
|
protected |
| QString ThemeManager::assetPath | ( | QStringView | prefix | ) | const |
|
static |
Writes cfg to disk as the theme's palette-<scheme>.toml and updates the theme's stored colour scheme to match. Shared by PaletteEditorDialog::onSave and FirstRunWizard's theme step so the two "generate + keep" paths can't drift.
|
protected |
| QStringMap & ThemeManager::getAvailableThemes | ( | ) |
| QBrush & ThemeManager::getBgBrush | ( | Role | zone | ) |
|
inline |
| QBrush ThemeManager::getExtraBgBrush | ( | Role | zone, |
| int | zoneId = 0 ) |
| bool ThemeManager::isDarkMode | ( | const QString & | themeDirPath | ) | const |
|
inline |
|
static |
|
protected |
|
static |
|
protected |
|
static |
|
static |
|
static |
|
signal |
| void ThemeManager::previewPalette | ( | const PaletteConfig & | cfg, |
| const QString & | scheme ) |
| void ThemeManager::reloadCurrentTheme | ( | ) |
|
static |
|
static |
| QString ThemeManager::schemeVariantPath | ( | QStringView | prefix | ) | const |
| void ThemeManager::setColorScheme | ( | const QString & | scheme | ) |
| void ThemeManager::setStyleName | ( | const QString & | styleName | ) |
|
signal |
|
protectedslot |
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |