mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 13:30:06 +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 FormatMap countyDatabase_;
|
||||
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()
|
||||
{
|
||||
|
|
@ -264,7 +264,7 @@ const std::unordered_map<std::string, std::string>& GetStates()
|
|||
return stateMap_;
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, std::string>& GetWFOs()
|
||||
const std::map<std::string, std::string>& GetWFOs()
|
||||
{
|
||||
return wfoMap_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -19,7 +20,7 @@ std::string GetCountyName(const std::string& id);
|
|||
std::unordered_map<std::string, std::string>
|
||||
GetCounties(const std::string& state);
|
||||
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);
|
||||
|
||||
} // namespace CountyDatabase
|
||||
|
|
|
|||
|
|
@ -950,6 +950,8 @@ void SettingsDialogImpl::SetupAudioTab()
|
|||
locationMethod == types::LocationMethod::RadarSite;
|
||||
bool countyEntryEnabled =
|
||||
locationMethod == types::LocationMethod::County;
|
||||
bool wfoEntryEnabled =
|
||||
locationMethod == types::LocationMethod::WFO;
|
||||
|
||||
self_->ui->alertAudioLatitudeSpinBox->setEnabled(
|
||||
coordinateEntryEnabled);
|
||||
|
|
@ -976,6 +978,9 @@ void SettingsDialogImpl::SetupAudioTab()
|
|||
self_->ui->alertAudioCountySelectButton->setEnabled(
|
||||
countyEntryEnabled);
|
||||
self_->ui->resetAlertAudioCountyButton->setEnabled(countyEntryEnabled);
|
||||
|
||||
self_->ui->alertAudioWFOComboBox->setEnabled(wfoEntryEnabled);
|
||||
self_->ui->resetAlertAudioWFOButton->setEnabled(wfoEntryEnabled);
|
||||
});
|
||||
|
||||
settings::AudioSettings& audioSettings = settings::AudioSettings::Instance();
|
||||
|
|
@ -1203,6 +1208,27 @@ void SettingsDialogImpl::SetupAudioTab()
|
|||
self_->ui->alertAudioWFOComboBox->addItem(
|
||||
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_.SetResetButton(self_->ui->resetAlertAudioWFOButton);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue