mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:10:04 +00:00 
			
		
		
		
	Added enable support and sorted keys for WFO audio method
This commit is contained in:
		
							parent
							
								
									bf24dac317
								
							
						
					
					
						commit
						12f84d7d22
					
				
					 3 changed files with 30 additions and 3 deletions
				
			
		|  | @ -31,7 +31,7 @@ typedef std::unordered_map<char, StateMap>           FormatMap; | ||||||
| static bool                                         initialized_ {false}; | static bool                                         initialized_ {false}; | ||||||
| static FormatMap                                    countyDatabase_; | static FormatMap                                    countyDatabase_; | ||||||
| static std::unordered_map<std::string, std::string> stateMap_; | static std::unordered_map<std::string, std::string> stateMap_; | ||||||
| static std::unordered_map<std::string, std::string> wfoMap_; | static std::map<std::string, std::string> wfoMap_; | ||||||
| 
 | 
 | ||||||
| void Initialize() | void Initialize() | ||||||
| { | { | ||||||
|  | @ -264,7 +264,7 @@ const std::unordered_map<std::string, std::string>& GetStates() | ||||||
|    return stateMap_; |    return stateMap_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const std::unordered_map<std::string, std::string>& GetWFOs() | const std::map<std::string, std::string>& GetWFOs() | ||||||
| { | { | ||||||
|    return wfoMap_; |    return wfoMap_; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
| #include <string> | #include <string> | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| #include <vector> | #include <vector> | ||||||
|  | #include <map> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -19,7 +20,7 @@ std::string GetCountyName(const std::string& id); | ||||||
| std::unordered_map<std::string, std::string> | std::unordered_map<std::string, std::string> | ||||||
| GetCounties(const std::string& state); | GetCounties(const std::string& state); | ||||||
| const std::unordered_map<std::string, std::string>& GetStates(); | const std::unordered_map<std::string, std::string>& GetStates(); | ||||||
| const std::unordered_map<std::string, std::string>& GetWFOs(); | const std::map<std::string, std::string>& GetWFOs(); | ||||||
| const std::string& GetWFOName(const std::string& wfoId); | const std::string& GetWFOName(const std::string& wfoId); | ||||||
| 
 | 
 | ||||||
| } // namespace CountyDatabase
 | } // namespace CountyDatabase
 | ||||||
|  |  | ||||||
|  | @ -950,6 +950,8 @@ void SettingsDialogImpl::SetupAudioTab() | ||||||
|             locationMethod == types::LocationMethod::RadarSite; |             locationMethod == types::LocationMethod::RadarSite; | ||||||
|          bool countyEntryEnabled = |          bool countyEntryEnabled = | ||||||
|             locationMethod == types::LocationMethod::County; |             locationMethod == types::LocationMethod::County; | ||||||
|  |          bool wfoEntryEnabled = | ||||||
|  |             locationMethod == types::LocationMethod::WFO; | ||||||
| 
 | 
 | ||||||
|          self_->ui->alertAudioLatitudeSpinBox->setEnabled( |          self_->ui->alertAudioLatitudeSpinBox->setEnabled( | ||||||
|             coordinateEntryEnabled); |             coordinateEntryEnabled); | ||||||
|  | @ -976,6 +978,9 @@ void SettingsDialogImpl::SetupAudioTab() | ||||||
|          self_->ui->alertAudioCountySelectButton->setEnabled( |          self_->ui->alertAudioCountySelectButton->setEnabled( | ||||||
|             countyEntryEnabled); |             countyEntryEnabled); | ||||||
|          self_->ui->resetAlertAudioCountyButton->setEnabled(countyEntryEnabled); |          self_->ui->resetAlertAudioCountyButton->setEnabled(countyEntryEnabled); | ||||||
|  | 
 | ||||||
|  |          self_->ui->alertAudioWFOComboBox->setEnabled(wfoEntryEnabled); | ||||||
|  |          self_->ui->resetAlertAudioWFOButton->setEnabled(wfoEntryEnabled); | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|    settings::AudioSettings& audioSettings = settings::AudioSettings::Instance(); |    settings::AudioSettings& audioSettings = settings::AudioSettings::Instance(); | ||||||
|  | @ -1203,6 +1208,27 @@ void SettingsDialogImpl::SetupAudioTab() | ||||||
|       self_->ui->alertAudioWFOComboBox->addItem( |       self_->ui->alertAudioWFOComboBox->addItem( | ||||||
|          QString::fromStdString(pair.first)); |          QString::fromStdString(pair.first)); | ||||||
|    } |    } | ||||||
|  |    /*
 | ||||||
|  |    alertAudioWFO_.SetMapFromValueFunction([](const std::string& value) -> std::string { | ||||||
|  |             if (value == "") { | ||||||
|  |                return ""; | ||||||
|  |             } | ||||||
|  |             return config::CountyDatabase::GetWFOs().at(value); | ||||||
|  |          }); | ||||||
|  |    alertAudioWFO_.SetMapToValueFunction([](const std::string& value) -> std::string { | ||||||
|  |             if (value == "") { | ||||||
|  |                return ""; | ||||||
|  |             } | ||||||
|  |             for (const auto& pair : config::CountyDatabase::GetWFOs()) | ||||||
|  |             { | ||||||
|  |                if (value == pair.second) | ||||||
|  |                { | ||||||
|  |                   return pair.first; | ||||||
|  |                } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             return ""; | ||||||
|  |          });*/ | ||||||
|    alertAudioWFO_.SetEditWidget(self_->ui->alertAudioWFOComboBox); |    alertAudioWFO_.SetEditWidget(self_->ui->alertAudioWFOComboBox); | ||||||
|    alertAudioWFO_.SetResetButton(self_->ui->resetAlertAudioWFOButton); |    alertAudioWFO_.SetResetButton(self_->ui->resetAlertAudioWFOButton); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak