Skip to content

Commit

Permalink
Merge pull request #4136 from ronso0/pref-key-restore-custom-notation
Browse files Browse the repository at this point in the history
Preferences > Key: restore custom notation
  • Loading branch information
uklotzde authored Jul 27, 2021
2 parents 49b08aa + 761487c commit 3e11751
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/preferences/dialog/dlgprefkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ void DlgPrefKey::loadSettings() {
QMap<mixxx::track::io::key::ChromaticKey, QString> notation;
if (notation_name == KEY_NOTATION_CUSTOM) {
radioNotationCustom->setChecked(true);
// Read the custom notation from the config and store it in a temp QMap
for (auto it = m_keyLineEdits.constBegin();
it != m_keyLineEdits.constEnd(); ++it) {
it.value()->setText(m_keySettings.getCustomKeyNotation(it.key()));
notation[it.key()] = it.value()->text();
}
setNotationCustom(true);
notation_type = KeyUtils::KeyNotation::Custom;
} else {
if (notation_name == KEY_NOTATION_LANCELOT) {
Expand All @@ -128,8 +128,11 @@ void DlgPrefKey::loadSettings() {
}
}

setNotation(notation_type);
// Store notation map for later recall...
KeyUtils::setNotation(notation);
// ... BEFORE invoking setNotation() which populates the QLineEdits from
// the map retrieved from KeyUtils.
setNotation(notation_type);
m_pKeyNotation->set(static_cast<double>(notation_type));

slotUpdate();
Expand Down Expand Up @@ -265,25 +268,20 @@ void DlgPrefKey::slotUpdate() {
}
}

void DlgPrefKey::setNotationCustom(bool active) {
if (!active) {
return;
}

void DlgPrefKey::setNotation(KeyUtils::KeyNotation notation) {
for (auto it = m_keyLineEdits.constBegin();
it != m_keyLineEdits.constEnd(); ++it) {
it.value()->setEnabled(true);
it.value()->setText(KeyUtils::keyToString(it.key(), notation));
// QLineEdits are only enabled for Custom notation.
it.value()->setEnabled(notation == KeyUtils::KeyNotation::Custom);
}
slotUpdate();
}

void DlgPrefKey::setNotation(KeyUtils::KeyNotation notation) {
for (auto it = m_keyLineEdits.constBegin();
it != m_keyLineEdits.constEnd(); ++it) {
it.value()->setText(KeyUtils::keyToString(it.key(), notation));
it.value()->setEnabled(false);
void DlgPrefKey::setNotationCustom(bool active) {
if (active) {
setNotation(KeyUtils::KeyNotation::Custom);
}
slotUpdate();
}

void DlgPrefKey::setNotationTraditional(bool active) {
Expand Down

0 comments on commit 3e11751

Please sign in to comment.