game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
ThemeManager Class Reference

#include <theme_manager.h>

Inheritance diagram for ThemeManager:
Collaboration diagram for ThemeManager:

Public Member Functions

 ThemeManager (const ThemeManager &)=delete
QColor accentColor () const
 Get current accent color (custom or theme default).
QFont applicationFont () const
 Get the base application font (with zoom and custom family applied).
void applyToApplication ()
 Apply current theme to the entire application.
QPalette buildPalette () const
 Build QPalette from current theme.
QString buildStyleSheet () const
 Build global stylesheet for widgets not covered by QPalette.
const ThemeColors & colors () const
 Get effective colors (with accent customization applied).
const Theme * currentTheme () const
 Get current theme.
QString currentThemeId () const
 Get current theme ID.
QString fontFamily () const
 Get current font family (empty = system default).
std::vector< QString > getAvailableThemeIds () const
 Get list of available theme IDs.
const Theme * getTheme (const QString &id) const
 Get theme by ID (returns nullptr if not found).
bool hasCustomAccent () const
 Check if using custom accent color.
void initialize (core::SettingsController *settingsController)
void loadFromSettings ()
 Load theme settings from settings controller.
QString menuStyleSheet () const
 Get standalone menu stylesheet (for dynamically created menus).
ThemeManager & operator= (const ThemeManager &)=delete
void resetAccentToDefault ()
 Reset accent to theme default.
void saveToSettings ()
 Save theme settings to settings controller.
QFont scaledFont (const QFont &baseFont) const
 Get scaled font (applies zoom + custom family if set).
int scaledFontSize (int baseSize) const
 Get scaled font size for given base size.
int scaledSize (int baseSize) const
 Get scaled dimension for layouts/spacing.
void setAccentColor (const QColor &color)
 Set custom accent color (overrides theme default).
void setFontFamily (const QString &family)
 Set font family.
void setTheme (const QString &themeId)
 Set active theme by ID.
void setZoomLevel (int percent)
 Set zoom level (75-150).
void styleMenu (QMenu *menu) const
 Apply complete menu styling (stylesheet + palette) to a QMenu.
void themeChanged ()
 Emitted when theme or accent color changes.
void zoomChanged ()
 Emitted when zoom level or font changes.
int zoomLevel () const
 Get current zoom level (75-150, default 100).

Static Public Member Functions

static QColor darkenColor (const QColor &color, int amount)
 Darken a color by decreasing its lightness.
static QColor ensureContrast (const QColor &fg, const QColor &bg, int minDiff=120)
 Ensure foreground has sufficient contrast against background.
static ThemeManager & instance ()
static QColor lightenColor (const QColor &color, int amount)
 Lighten a color by increasing its lightness.

Detailed Description

Definition at line 84 of file theme_manager.h.

Constructor & Destructor Documentation

◆ ThemeManager()

ThemeManager::ThemeManager ( const ThemeManager & )
delete

References ThemeManager().

Referenced by ThemeManager(), instance(), and operator=().

Member Function Documentation

◆ accentColor()

QColor ThemeManager::accentColor ( ) const

Get current accent color (custom or theme default).

Definition at line 1080 of file theme_manager.cpp.

◆ applicationFont()

QFont ThemeManager::applicationFont ( ) const

Get the base application font (with zoom and custom family applied).

Definition at line 2167 of file theme_manager.cpp.

References scaledSize().

Referenced by applyToApplication().

◆ applyToApplication()

void ThemeManager::applyToApplication ( )

Apply current theme to the entire application.

Definition at line 1194 of file theme_manager.cpp.

References applicationFont(), buildPalette(), and buildStyleSheet().

Referenced by MainWindow::MainWindow(), main(), setFontFamily(), and setZoomLevel().

◆ buildPalette()

◆ buildStyleSheet()

◆ colors()

const ThemeColors & ThemeManager::colors ( ) const

Get effective colors (with accent customization applied).

Definition at line 1103 of file theme_manager.cpp.

Referenced by CollapsibleSection::applyTheme(), and GameListDelegate::updateCachedColors().

◆ currentTheme()

const Theme * ThemeManager::currentTheme ( ) const

Get current theme.

Definition at line 1038 of file theme_manager.cpp.

References getTheme().

◆ currentThemeId()

QString ThemeManager::currentThemeId ( ) const

Get current theme ID.

Definition at line 1043 of file theme_manager.cpp.

Referenced by FirstRunWizard::markCompleted().

◆ darkenColor()

QColor ThemeManager::darkenColor ( const QColor & color,
int amount )
static

◆ ensureContrast()

QColor ThemeManager::ensureContrast ( const QColor & fg,
const QColor & bg,
int minDiff = 120 )
static

Ensure foreground has sufficient contrast against background.

Definition at line 1149 of file theme_manager.cpp.

Referenced by buildPalette(), buildStyleSheet(), menuStyleSheet(), and styleMenu().

◆ fontFamily()

QString ThemeManager::fontFamily ( ) const

Get current font family (empty = system default).

Definition at line 2119 of file theme_manager.cpp.

◆ getAvailableThemeIds()

std::vector< QString > ThemeManager::getAvailableThemeIds ( ) const

Get list of available theme IDs.

Definition at line 984 of file theme_manager.cpp.

◆ getTheme()

const Theme * ThemeManager::getTheme ( const QString & id) const

Get theme by ID (returns nullptr if not found).

Definition at line 1028 of file theme_manager.cpp.

Referenced by currentTheme().

◆ hasCustomAccent()

bool ThemeManager::hasCustomAccent ( ) const

Check if using custom accent color.

Definition at line 1085 of file theme_manager.cpp.

◆ initialize()

void ThemeManager::initialize ( core::SettingsController * settingsController)

Definition at line 51 of file theme_manager.cpp.

References loadFromSettings().

Referenced by MainWindow::MainWindow().

◆ instance()

◆ lightenColor()

QColor ThemeManager::lightenColor ( const QColor & color,
int amount )
static

Lighten a color by increasing its lightness.

Definition at line 1174 of file theme_manager.cpp.

Referenced by DetailsPanelManager::Impl::applyTheme().

◆ loadFromSettings()

void ThemeManager::loadFromSettings ( )

Load theme settings from settings controller.

Definition at line 2047 of file theme_manager.cpp.

Referenced by initialize().

◆ menuStyleSheet()

QString ThemeManager::menuStyleSheet ( ) const

Get standalone menu stylesheet (for dynamically created menus).

Definition at line 1935 of file theme_manager.cpp.

References ThemeColors::accent, ThemeColors::border, ThemeColors::borderLight, ThemeColors::cardBackground, ensureContrast(), ThemeColors::textOnAccent, ThemeColors::textPrimary, and ThemeColors::textSecondary.

Referenced by styleMenu().

◆ operator=()

ThemeManager & ThemeManager::operator= ( const ThemeManager & )
delete

References ThemeManager().

◆ resetAccentToDefault()

void ThemeManager::resetAccentToDefault ( )

Reset accent to theme default.

Definition at line 1090 of file theme_manager.cpp.

References themeChanged().

◆ saveToSettings()

void ThemeManager::saveToSettings ( )

Save theme settings to settings controller.

Definition at line 2032 of file theme_manager.cpp.

Referenced by MainWindow::MainWindow().

◆ scaledFont()

QFont ThemeManager::scaledFont ( const QFont & baseFont) const

Get scaled font (applies zoom + custom family if set).

Definition at line 2147 of file theme_manager.cpp.

References scaledSize().

◆ scaledFontSize()

int ThemeManager::scaledFontSize ( int baseSize) const

Get scaled font size for given base size.

Definition at line 2134 of file theme_manager.cpp.

◆ scaledSize()

int ThemeManager::scaledSize ( int baseSize) const

Get scaled dimension for layouts/spacing.

Definition at line 2142 of file theme_manager.cpp.

Referenced by applicationFont(), and scaledFont().

◆ setAccentColor()

void ThemeManager::setAccentColor ( const QColor & color)

Set custom accent color (overrides theme default).

Definition at line 1068 of file theme_manager.cpp.

References themeChanged().

◆ setFontFamily()

void ThemeManager::setFontFamily ( const QString & family)

Set font family.

Definition at line 2124 of file theme_manager.cpp.

References applyToApplication(), and zoomChanged().

◆ setTheme()

void ThemeManager::setTheme ( const QString & themeId)

Set active theme by ID.

Definition at line 1048 of file theme_manager.cpp.

References themeChanged().

◆ setZoomLevel()

void ThemeManager::setZoomLevel ( int percent)

Set zoom level (75-150).

Definition at line 2108 of file theme_manager.cpp.

References applyToApplication(), and zoomChanged().

◆ styleMenu()

void ThemeManager::styleMenu ( QMenu * menu) const

Apply complete menu styling (stylesheet + palette) to a QMenu.

Definition at line 1995 of file theme_manager.cpp.

References ThemeColors::accent, ThemeColors::cardBackground, ensureContrast(), menuStyleSheet(), ThemeColors::textMuted, ThemeColors::textOnAccent, and ThemeColors::textPrimary.

◆ themeChanged()

void ThemeManager::themeChanged ( )

Emitted when theme or accent color changes.

Referenced by ActivityHeatmapWidget::ActivityHeatmapWidget(), AddGameDialog::AddGameDialog(), ArtworkPreviewWidget::ArtworkPreviewWidget(), BackupOptionsWidget::BackupOptionsWidget(), BarChartWidget::BarChartWidget(), CommandPalette::CommandPalette(), EnvVarCheckBox::EnvVarCheckBox(), ExportOptionsWidget::ExportOptionsWidget(), FileResultWidget::FileResultWidget(), FirstRunWizard::FirstRunWizard(), FrameMetricsWidget::FrameMetricsWidget(), GameImportDialog::GameImportDialog(), GameStatisticsDialog::GameStatisticsDialog(), GameVerificationDialog::GameVerificationDialog(), HomeAssistantPanel::HomeAssistantPanel(), ImportOptionsWidget::ImportOptionsWidget(), LibraryExportDialog::LibraryExportDialog(), MainWindow::MainWindow(), PerformanceProfileDialog::PerformanceProfileDialog(), PerformanceProfileDialog::PerformanceProfileDialog(), PieChartWidget::PieChartWidget(), PrefixSnapshotDialog::PrefixSnapshotDialog(), RecommendationsWidget::RecommendationsWidget(), RunnerManagerDialog::RunnerManagerDialog(), RunningGameStatusWidget::RunningGameStatusWidget(), StatCard::StatCard(), SteamGridDBSelectorDialog::SteamGridDBSelectorDialog(), SystemReadinessWidget::SystemReadinessWidget(), ToolbarDragHandle::ToolbarDragHandle(), VerificationSummaryWidget::VerificationSummaryWidget(), WineDependencyDialog::WineDependencyDialog(), resetAccentToDefault(), setAccentColor(), setTheme(), SidebarManager::setupSidebar(), and DownloadQueueDialog::showEvent().

◆ zoomChanged()

void ThemeManager::zoomChanged ( )

Emitted when zoom level or font changes.

Referenced by setFontFamily(), and setZoomLevel().

◆ zoomLevel()

int ThemeManager::zoomLevel ( ) const

Get current zoom level (75-150, default 100).

Definition at line 2103 of file theme_manager.cpp.


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