Cockatrice 2026-06-01-Development-3.1.0-beta.3
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
ThemeManager Class Reference

#include <theme_manager.h>

Inheritance diagram for ThemeManager:
[legend]
Collaboration diagram for ThemeManager:
[legend]

Public Types

enum  Role {
  MinRole = 0 , Hand = MinRole , Stack , Table ,
  Player , MaxRole = Player
}

Signals

void themeChanged ()

Public Member Functions

 ThemeManager (QObject *parent=nullptr)
bool isBuiltInTheme ()
bool isDarkMode (const QString &themeDirPath)
QStringMapgetAvailableThemes ()
QString getCurrentThemePath () const
void setColorScheme (const QString &scheme)
void reloadCurrentTheme ()
void previewPalette (const PaletteConfig &cfg, const QString &scheme)
QBrush & getBgBrush (Role zone)
QBrush getExtraBgBrush (Role zone, int zoneId=0)

Static Public Member Functions

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)

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
QString currentThemePath
std::array< QBrush, Role::MaxRole+1 > brushes
QStringMap availableThemes
std::array< QBrushMap, Role::MaxRole+1 > brushesCache

Member Enumeration Documentation

◆ Role

Enumerator
MinRole 
Hand 
Stack 
Table 
Player 
MaxRole 

Constructor & Destructor Documentation

◆ ThemeManager()

ThemeManager::ThemeManager ( QObject * parent = nullptr)
Todo
Workaround for windows11 style being broken.
Here is the call graph for this function:

Member Function Documentation

◆ applyStyleAndPalette()

void ThemeManager::applyStyleAndPalette ( const QString & themeName,
const ThemeConfig & themeCfg,
const PaletteConfig & palCfg,
const QString & activeScheme )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureThemeDirectoryExists()

void ThemeManager::ensureThemeDirectoryExists ( )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAvailableThemes()

QStringMap & ThemeManager::getAvailableThemes ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBgBrush()

QBrush & ThemeManager::getBgBrush ( Role zone)
Here is the caller graph for this function:

◆ getCurrentThemePath()

QString ThemeManager::getCurrentThemePath ( ) const
inline

◆ getExtraBgBrush()

QBrush ThemeManager::getExtraBgBrush ( Role zone,
int zoneId = 0 )
Here is the call graph for this function:

◆ isBuiltInTheme()

bool ThemeManager::isBuiltInTheme ( )
Here is the call graph for this function:

◆ isDarkMode()

bool ThemeManager::isDarkMode ( const QString & themeDirPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadBrush()

QBrush ThemeManager::loadBrush ( QString fileName,
QColor fallbackColor )
protected
Here is the caller graph for this function:

◆ loadExtraBrush()

QBrush ThemeManager::loadExtraBrush ( QString fileName,
QBrush & fallbackBrush )
protected
Here is the caller graph for this function:

◆ loadGlobalConfig()

ThemeConfig ThemeManager::loadGlobalConfig ( const QString & themeDirPath)
static
Here is the call graph for this function:

◆ loadPaletteConfig()

PaletteConfig ThemeManager::loadPaletteConfig ( const QString & themeDirPath,
const QString & colorScheme )
static
Here is the call graph for this function:

◆ previewPalette()

void ThemeManager::previewPalette ( const PaletteConfig & cfg,
const QString & scheme )
Here is the call graph for this function:

◆ reloadCurrentTheme()

void ThemeManager::reloadCurrentTheme ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveGlobalConfig()

bool ThemeManager::saveGlobalConfig ( const QString & themeDirPath,
const ThemeConfig & cfg )
static
Here is the call graph for this function:

◆ savePaletteConfig()

bool ThemeManager::savePaletteConfig ( const QString & themeDirPath,
const QString & colorScheme,
const PaletteConfig & cfg )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setColorScheme()

void ThemeManager::setColorScheme ( const QString & scheme)
Here is the call graph for this function:

◆ themeChanged

void ThemeManager::themeChanged ( )
signal
Here is the caller graph for this function:

◆ themeChangedSlot

void ThemeManager::themeChangedSlot ( )
protectedslot
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ availableThemes

QStringMap ThemeManager::availableThemes
private

◆ brushes

std::array<QBrush, Role::MaxRole + 1> ThemeManager::brushes
private

◆ brushesCache

std::array<QBrushMap, Role::MaxRole + 1> ThemeManager::brushesCache
private

◆ currentThemePath

QString ThemeManager::currentThemePath
private

◆ defaultStyleName

QString ThemeManager::defaultStyleName
private

The documentation for this class was generated from the following files: