Merge pull request #12 from haganbmj/stylesheet_settings_underscores

fix: use canonical name for stylesheet settings (fixes #8)
This commit is contained in:
Brendan Hagan
2022-07-08 23:05:50 -04:00
committed by GitHub
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -18,7 +18,8 @@ Features:
* Merge String capitilization changes by @SoaringMoon.
Bug fixes:
* Make viewer image rotate button operate clockwise to match dropdown options.
* Make viewer image rotate button operate clockwise to match dropdown options. (#9)
* Fix storage/retrieval of Stylesheet Settings when the stylesheet name includes spaces. (#8)
------------------------------------------------------------------------------
HEAD: new items added as changes are made
+4 -2
View File
@@ -223,8 +223,10 @@ ColumnSettings& Settings::columnSettingsFor(const Game& game, const Field& field
}
return cs;
}
StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet) {
StyleSheetSettingsP& ss = stylesheet_settings[stylesheet.name()];
StyleSheetSettings& Settings::stylesheetSettingsFor(const StyleSheet& stylesheet) {
// Use the canonical form here since the stylesheet name will be used as a stored key.
// This does introduce the possibility of collision if two stylesheets return the same value canonically, but I think that's just a necessary risk.
StyleSheetSettingsP& ss = stylesheet_settings[canonical_name_form(stylesheet.name())];
if (!ss) ss = make_intrusive<StyleSheetSettings>();
ss->useDefault(default_stylesheet_settings); // update default settings
return *ss;