mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:30:04 +00:00 
			
		
		
		
	Make palette order deterministic across platforms
This commit is contained in:
		
							parent
							
								
									d74d12ea7e
								
							
						
					
					
						commit
						97035e5596
					
				
					 1 changed files with 23 additions and 3 deletions
				
			
		|  | @ -16,6 +16,27 @@ namespace settings | ||||||
| 
 | 
 | ||||||
| static const std::string logPrefix_ = "scwx::qt::settings::palette_settings"; | static const std::string logPrefix_ = "scwx::qt::settings::palette_settings"; | ||||||
| 
 | 
 | ||||||
|  | static const std::array<std::string, 17> kPaletteKeys_ { | ||||||
|  |    // Level 2 / Common Products
 | ||||||
|  |    "BR", | ||||||
|  |    "BV", | ||||||
|  |    "SW", | ||||||
|  |    "CC", | ||||||
|  |    "ZDR", | ||||||
|  |    "PHI2", | ||||||
|  |    // Level 3 Products
 | ||||||
|  |    "DOD", | ||||||
|  |    "DSD", | ||||||
|  |    "ET", | ||||||
|  |    "STP", | ||||||
|  |    "OHP", | ||||||
|  |    "STPIN", | ||||||
|  |    "OHPIN", | ||||||
|  |    "PHI3", | ||||||
|  |    "SRV", | ||||||
|  |    "VIL", | ||||||
|  |    "???"}; | ||||||
|  | 
 | ||||||
| static const std::unordered_map<std::string, std::string> kDefaultPalettes_ { | static const std::unordered_map<std::string, std::string> kDefaultPalettes_ { | ||||||
|    // Level 2 / Common Products
 |    // Level 2 / Common Products
 | ||||||
|    {"BR", ":/res/palettes/wct/DR.pal"}, |    {"BR", ":/res/palettes/wct/DR.pal"}, | ||||||
|  | @ -56,10 +77,9 @@ class PaletteSettingsImpl | ||||||
| public: | public: | ||||||
|    explicit PaletteSettingsImpl() |    explicit PaletteSettingsImpl() | ||||||
|    { |    { | ||||||
|       for (const auto& palette : kDefaultPalettes_) |       for (const auto& name : kPaletteKeys_) | ||||||
|       { |       { | ||||||
|          const std::string& name         = palette.first; |          const std::string& defaultValue = kDefaultPalettes_.at(name); | ||||||
|          const std::string& defaultValue = palette.second; |  | ||||||
| 
 | 
 | ||||||
|          auto result = |          auto result = | ||||||
|             palette_.emplace(name, SettingsVariable<std::string> {name}); |             palette_.emplace(name, SettingsVariable<std::string> {name}); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat