|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
#include <theme_manager.h>
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. | |
Definition at line 84 of file theme_manager.h.
|
delete |
References ThemeManager().
Referenced by ThemeManager(), instance(), and operator=().
| QColor ThemeManager::accentColor | ( | ) | const |
Get current accent color (custom or theme default).
Definition at line 1080 of file theme_manager.cpp.
| 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().
| 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().
| QPalette ThemeManager::buildPalette | ( | ) | const |
Build QPalette from current theme.
Definition at line 1244 of file theme_manager.cpp.
References ThemeColors::accent, ThemeColors::cardBackground, ensureContrast(), ThemeColors::info, ThemeColors::inputBackground, ThemeColors::panelBackground, ThemeColors::textMuted, ThemeColors::textOnAccent, ThemeColors::textPrimary, and ThemeColors::windowBackground.
Referenced by applyToApplication().
| QString ThemeManager::buildStyleSheet | ( | ) | const |
Build global stylesheet for widgets not covered by QPalette.
Definition at line 1296 of file theme_manager.cpp.
References ThemeColors::accent, ThemeColors::accentHover, ThemeColors::accentPressed, ThemeColors::border, ThemeColors::borderLight, ThemeColors::cardBackground, ensureContrast(), ThemeColors::error, ThemeColors::hoverBackground, ThemeColors::inputBackground, ThemeColors::panelBackground, ThemeColors::scrollbarThumb, ThemeColors::scrollbarThumbHover, ThemeColors::scrollbarTrack, ThemeColors::success, ThemeColors::textOnAccent, ThemeColors::textPrimary, ThemeColors::textSecondary, and ThemeColors::windowBackground.
Referenced by applyToApplication().
| 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().
| const Theme * ThemeManager::currentTheme | ( | ) | const |
| QString ThemeManager::currentThemeId | ( | ) | const |
Get current theme ID.
Definition at line 1043 of file theme_manager.cpp.
Referenced by FirstRunWizard::markCompleted().
|
static |
Darken a color by decreasing its lightness.
Definition at line 1182 of file theme_manager.cpp.
Referenced by DetailsPanelManager::Impl::applyTheme(), FrameMetricsWidget::applyTheme(), FrameMetricsWidget::paintEvent(), DetailsPanelManager::Impl::update(), and DetailsPanelManager::Impl::updateRunningInfo().
|
static |
Ensure foreground has sufficient contrast against background.
Definition at line 1149 of file theme_manager.cpp.
Referenced by buildPalette(), buildStyleSheet(), menuStyleSheet(), and styleMenu().
| QString ThemeManager::fontFamily | ( | ) | const |
Get current font family (empty = system default).
Definition at line 2119 of file theme_manager.cpp.
| std::vector< QString > ThemeManager::getAvailableThemeIds | ( | ) | const |
Get list of available theme IDs.
Definition at line 984 of file theme_manager.cpp.
| 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().
| bool ThemeManager::hasCustomAccent | ( | ) | const |
Check if using custom accent color.
Definition at line 1085 of file theme_manager.cpp.
| void ThemeManager::initialize | ( | core::SettingsController * | settingsController | ) |
Definition at line 51 of file theme_manager.cpp.
References loadFromSettings().
Referenced by MainWindow::MainWindow().
|
static |
Definition at line 27 of file theme_manager.cpp.
References ThemeManager(), and instance().
Referenced by MainWindow::MainWindow(), CollapsibleSection::applyTheme(), instance(), main(), FirstRunWizard::markCompleted(), ShortcutsController::registerPaletteCommands(), and GameListDelegate::updateCachedColors().
|
static |
Lighten a color by increasing its lightness.
Definition at line 1174 of file theme_manager.cpp.
Referenced by DetailsPanelManager::Impl::applyTheme().
| void ThemeManager::loadFromSettings | ( | ) |
Load theme settings from settings controller.
Definition at line 2047 of file theme_manager.cpp.
Referenced by initialize().
| 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().
|
delete |
References ThemeManager().
| void ThemeManager::resetAccentToDefault | ( | ) |
Reset accent to theme default.
Definition at line 1090 of file theme_manager.cpp.
References themeChanged().
| void ThemeManager::saveToSettings | ( | ) |
Save theme settings to settings controller.
Definition at line 2032 of file theme_manager.cpp.
Referenced by MainWindow::MainWindow().
| 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().
| int ThemeManager::scaledFontSize | ( | int | baseSize | ) | const |
Get scaled font size for given base size.
Definition at line 2134 of file theme_manager.cpp.
| 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().
| void ThemeManager::setAccentColor | ( | const QColor & | color | ) |
Set custom accent color (overrides theme default).
Definition at line 1068 of file theme_manager.cpp.
References themeChanged().
| void ThemeManager::setFontFamily | ( | const QString & | family | ) |
Set font family.
Definition at line 2124 of file theme_manager.cpp.
References applyToApplication(), and zoomChanged().
| void ThemeManager::setTheme | ( | const QString & | themeId | ) |
Set active theme by ID.
Definition at line 1048 of file theme_manager.cpp.
References themeChanged().
| void ThemeManager::setZoomLevel | ( | int | percent | ) |
Set zoom level (75-150).
Definition at line 2108 of file theme_manager.cpp.
References applyToApplication(), and zoomChanged().
| 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.
| 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().
| void ThemeManager::zoomChanged | ( | ) |
Emitted when zoom level or font changes.
Referenced by setFontFamily(), and setZoomLevel().
| int ThemeManager::zoomLevel | ( | ) | const |
Get current zoom level (75-150, default 100).
Definition at line 2103 of file theme_manager.cpp.