| 1513 | } |
| 1514 | |
| 1515 | void FlexControlDialog::refreshButtonActions() |
| 1516 | { |
| 1517 | auto& settings = AppSettings::instance(); |
| 1518 | for (int i = 0; i < m_auxCombos.size(); ++i) { |
| 1519 | auto* combo = m_auxCombos.value(i); |
| 1520 | const QString key = QStringLiteral("FlexControlBtn%1Action0").arg(i + 1); |
| 1521 | const QString fallback = (i == 0) ? QStringLiteral("StepUp") |
| 1522 | : (i == 1) ? QStringLiteral("ToggleMox") |
| 1523 | : QStringLiteral("ToggleMute"); |
| 1524 | if (combo) { |
| 1525 | const QString saved = settings.value(key, fallback).toString(); |
| 1526 | const int savedIndex = combo->findData(saved); |
| 1527 | const QSignalBlocker blocker(combo); |
| 1528 | combo->setCurrentIndex(savedIndex >= 0 ? savedIndex : combo->findData(fallback)); |
| 1529 | } |
| 1530 | |
| 1531 | auto* doubleCombo = m_auxDoubleCombos.value(i); |
| 1532 | const QString doubleKey = QStringLiteral("FlexControlBtn%1Action1").arg(i + 1); |
| 1533 | const QString doubleFallback = (i == 0) ? QStringLiteral("StepDown") |
| 1534 | : (i == 1) ? QStringLiteral("ToggleTune") |
| 1535 | : QStringLiteral("ToggleLock"); |
| 1536 | if (doubleCombo) { |
| 1537 | const QString saved = settings.value(doubleKey, doubleFallback).toString(); |
| 1538 | const int savedIndex = doubleCombo->findData(saved); |
| 1539 | const QSignalBlocker blocker(doubleCombo); |
| 1540 | doubleCombo->setCurrentIndex(savedIndex >= 0 |
| 1541 | ? savedIndex : doubleCombo->findData(doubleFallback)); |
| 1542 | } |
| 1543 | } |
| 1544 | if (m_pushButton) { |
| 1545 | const QString tapAction = settings |
| 1546 | .value("FlexControlBtn4Action0", QStringLiteral("StepUp")).toString(); |
| 1547 | const QString doubleAction = settings |
| 1548 | .value("FlexControlBtn4Action1", QStringLiteral("StepDown")).toString(); |
| 1549 | m_pushButton->setText(QStringLiteral("PUSH")); |
| 1550 | m_pushButton->setToolTip(QStringLiteral("Single tap: %1\nDouble tap: %2") |
| 1551 | .arg(labelForActionId(tapAction), labelForActionId(doubleAction))); |
| 1552 | if (m_pushHintLabel) { |
| 1553 | m_pushHintLabel->setToolTip(QStringLiteral( |
| 1554 | "When an Aux wheel mode is selected, a single tap returns the wheel to Tune Slice. " |
| 1555 | "Otherwise, it runs the configured single-tap action.")); |
| 1556 | } |
| 1557 | if (m_pushSingleCombo) { |
| 1558 | const int index = m_pushSingleCombo->findData(tapAction); |
| 1559 | const QSignalBlocker blocker(m_pushSingleCombo); |
| 1560 | m_pushSingleCombo->setCurrentIndex(index >= 0 |
| 1561 | ? index : m_pushSingleCombo->findData(QStringLiteral("StepUp"))); |
| 1562 | } |
| 1563 | if (m_pushDoubleCombo) { |
| 1564 | const int index = m_pushDoubleCombo->findData(doubleAction); |
| 1565 | const QSignalBlocker blocker(m_pushDoubleCombo); |
| 1566 | m_pushDoubleCombo->setCurrentIndex(index >= 0 |
| 1567 | ? index : m_pushDoubleCombo->findData(QStringLiteral("StepDown"))); |
| 1568 | } |
| 1569 | } |
| 1570 | if (m_activeAux >= 0 && !auxActionControlsWheel(m_activeAux)) |
| 1571 | clearAuxSelection(); |
| 1572 | else |
no test coverage detected