diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2019-06-26 22:05:32 +0200 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2019-06-26 22:05:32 +0200 |
commit | a8d170cbbcd6e0837a37081f12e46877dafa014f (patch) | |
tree | 9e69710310d0d52b98bf760c4fe009f92e795fa7 /src | |
parent | 967a8a98f10fda72b53a291e13e10f65c45eb4f4 (diff) |
Select the default analyzer if the stored one is unknown.
Diffstat (limited to 'src')
-rw-r--r-- | src/preferences/dialog/dlgprefbeats.cpp | 26 | ||||
-rw-r--r-- | src/preferences/dialog/dlgprefkey.cpp | 17 |
2 files changed, 28 insertions, 15 deletions
diff --git a/src/preferences/dialog/dlgprefbeats.cpp b/src/preferences/dialog/dlgprefbeats.cpp index 10869b5ee0..2f817eee45 100644 --- a/src/preferences/dialog/dlgprefbeats.cpp +++ b/src/preferences/dialog/dlgprefbeats.cpp @@ -63,8 +63,6 @@ void DlgPrefBeats::loadSettings() { } void DlgPrefBeats::slotResetToDefaults() { - // NOTE(rryan): Do not hard-code defaults here! Put them in - // BeatDetectionSettings. if (m_availablePlugins.size() > 0) { m_selectedAnalyzerId = m_availablePlugins[0].id; } @@ -127,15 +125,23 @@ void DlgPrefBeats::slotUpdate() { return; } - for (int i = 0; i < m_availablePlugins.size(); ++i) { - const auto& info = m_availablePlugins.at(i); - if (info.id == m_selectedAnalyzerId) { - plugincombo->setCurrentIndex(i); - if (!m_availablePlugins[i].constantTempoSupported) { - bfixedtempo->setEnabled(false); - boffset->setEnabled(false); + if (m_availablePlugins.size() > 0) { + bool found = false; + for (int i = 0; i < m_availablePlugins.size(); ++i) { + const auto& info = m_availablePlugins.at(i); + if (info.id == m_selectedAnalyzerId) { + found = true; + plugincombo->setCurrentIndex(i); + if (!m_availablePlugins[i].constantTempoSupported) { + bfixedtempo->setEnabled(false); + boffset->setEnabled(false); + } + break; } - break; + } + if (!found) { + plugincombo->setCurrentIndex(0); + m_selectedAnalyzerId = m_availablePlugins[0].id; } } diff --git a/src/preferences/dialog/dlgprefkey.cpp b/src/preferences/dialog/dlgprefkey.cpp index ff6138b5c3..2237c25efa 100644 --- a/src/preferences/dialog/dlgprefkey.cpp +++ b/src/preferences/dialog/dlgprefkey.cpp @@ -243,11 +243,18 @@ void DlgPrefKey::slotUpdate() { return; } - for (int i = 0; i < m_availablePlugins.size(); ++i) { - const auto& info = m_availablePlugins.at(i); - if (info.id == m_selectedAnalyzerId) { - plugincombo->setCurrentIndex(i); - break; + if (m_availablePlugins.size() > 0) { + bool found = false; + for (int i = 0; i < m_availablePlugins.size(); ++i) { + const auto& info = m_availablePlugins.at(i); + if (info.id == m_selectedAnalyzerId) { + plugincombo->setCurrentIndex(i); + break; + } + } + if (!found) { + plugincombo->setCurrentIndex(0); + m_selectedAnalyzerId = m_availablePlugins[0].id; } } } |