mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 16:13:54 -07:00
Don't make new ThemeManager instance.
Took 8 minutes
This commit is contained in:
parent
2e754f6ec0
commit
c1098399da
2 changed files with 4 additions and 13 deletions
|
|
@ -267,7 +267,7 @@ void PaletteEditorDialog::onSave()
|
|||
}
|
||||
|
||||
// Record the active scheme in the user dir — never touch the system (read-only) dir
|
||||
ThemeConfig globalCfg = ThemeConfig::fromThemeDir(themeDirPath);
|
||||
ThemeConfig globalCfg = themeManager->effectiveThemeConfig(themeName);
|
||||
globalCfg.colorScheme = loadedScheme;
|
||||
globalCfg.save(userThemeDirPath);
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ QStringMap &ThemeManager::getAvailableThemes()
|
|||
|
||||
ThemeConfig ThemeManager::effectiveThemeConfig(const QString &themeName)
|
||||
{
|
||||
const QString dirPath = ThemeManager().getAvailableThemes().value(themeName);
|
||||
const QString dirPath = getAvailableThemes().value(themeName);
|
||||
const QString userDirPath = userThemeDirFor(themeName);
|
||||
|
||||
ThemeConfig userCfg = ThemeConfig::fromThemeDir(userDirPath);
|
||||
|
|
@ -310,14 +310,8 @@ void ThemeManager::reloadCurrentTheme()
|
|||
void ThemeManager::previewPalette(const PaletteConfig &cfg, const QString &scheme)
|
||||
{
|
||||
const QString themeName = SettingsCache::instance().getThemeName();
|
||||
const QString dirPath = getAvailableThemes().value(themeName);
|
||||
const QString userDirPath = userThemeDirFor(themeName);
|
||||
|
||||
ThemeConfig themeCfg = ThemeConfig::fromThemeDir(userDirPath);
|
||||
if (themeCfg.colorScheme.isEmpty() && themeCfg.styleName.isEmpty()) {
|
||||
themeCfg = ThemeConfig::fromThemeDir(dirPath);
|
||||
}
|
||||
|
||||
ThemeConfig themeCfg = effectiveThemeConfig(themeName);
|
||||
applyStyleAndPalette(themeName, themeCfg, cfg, scheme);
|
||||
}
|
||||
|
||||
|
|
@ -401,10 +395,7 @@ void ThemeManager::themeChangedSlot()
|
|||
}
|
||||
|
||||
// ThemeConfig — user override first, then system
|
||||
ThemeConfig themeCfg = ThemeConfig::fromThemeDir(userDirPath);
|
||||
if (themeCfg.colorScheme.isEmpty() && themeCfg.styleName.isEmpty()) {
|
||||
themeCfg = ThemeConfig::fromThemeDir(dirPath);
|
||||
}
|
||||
ThemeConfig themeCfg = effectiveThemeConfig(themeName);
|
||||
|
||||
const QString activeScheme = isDarkMode(dirPath, userDirPath) ? "Dark" : "Light";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue