mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Merge pull request #13122 from TryTwo/PR_Audio_Configs
AudioPanel: Refactor to use Config system.
This commit is contained in:
@ -153,13 +153,23 @@ void ConfigComplexChoice::UpdateComboIndex()
|
||||
};
|
||||
|
||||
auto it = std::find_if(m_options.begin(), m_options.end(), is_correct_option);
|
||||
int index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
int index;
|
||||
|
||||
if (it == m_options.end())
|
||||
index = m_default_index;
|
||||
else
|
||||
index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
|
||||
// Will crash if not blocked
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::SetDefault(int index)
|
||||
{
|
||||
m_default_index = index;
|
||||
}
|
||||
|
||||
const std::pair<Config::Location, Config::Location> ConfigComplexChoice::GetLocation() const
|
||||
{
|
||||
auto visit = [](auto& v) { return v.GetLocation(); };
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
void Add(const QString& name, const OptionVariant option1, const OptionVariant option2);
|
||||
void Refresh();
|
||||
void Reset();
|
||||
void SetDefault(int index);
|
||||
const std::pair<Config::Location, Config::Location> GetLocation() const;
|
||||
|
||||
private:
|
||||
@ -73,4 +74,5 @@ private:
|
||||
const InfoVariant m_setting1;
|
||||
const InfoVariant m_setting2;
|
||||
std::vector<std::pair<OptionVariant, OptionVariant>> m_options;
|
||||
int m_default_index = -1;
|
||||
};
|
||||
|
Reference in New Issue
Block a user