Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effects refactoring minor changes #4482

Merged
merged 5 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 32 additions & 28 deletions src/preferences/dialog/dlgprefeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#include "moc_dlgprefeq.cpp"

namespace {
const QString kConfigKey = "[Mixer Profile]";
const QString kConfigKeyPrefix = "EffectForGroup_";
const QString kEnableEqs = "EnableEQs";
const QString kEqsOnly = "EQsOnly";
const QString kSingleEq = "SingleEQEffect";
const QString kConfigKey = QStringLiteral("[Mixer Profile]");
uklotzde marked this conversation as resolved.
Show resolved Hide resolved
const QString kEffectForGroupPrefix = QStringLiteral("EffectForGroup_");
const QString kEnableEqs = QStringLiteral("EnableEQs");
const QString kEqsOnly = QStringLiteral("EQsOnly");
const QString kSingleEq = QStringLiteral("SingleEQEffect");
const QString kDefaultEqId = BiquadFullKillEQEffect::getId() + " " +
EffectsBackend::backendTypeToString(EffectBackendType::BuiltIn);
const QString kDefaultMainEqId = QString();
Expand All @@ -40,8 +40,8 @@ DlgPrefEQ::DlgPrefEQ(
std::shared_ptr<EffectsManager> pEffectsManager,
UserSettingsPointer pConfig)
: DlgPreferencePage(pParent),
m_COLoFreq(kConfigKey, "LoEQFrequency"),
m_COHiFreq(kConfigKey, "HiEQFrequency"),
m_COLoFreq(kConfigKey, QStringLiteral("LoEQFrequency")),
m_COHiFreq(kConfigKey, QStringLiteral("HiEQFrequency")),
m_pConfig(pConfig),
m_lowEqFreq(0.0),
m_highEqFreq(0.0),
Expand Down Expand Up @@ -107,9 +107,9 @@ void DlgPrefEQ::slotNumDecksChanged(double numDecks) {
QLabel* label = new QLabel(QObject::tr("Deck %1").arg(deckNo), this);

// Create the drop down list for deck EQs
QComboBox* eqComboBox = new QComboBox(this);
m_deckEqEffectSelectors.append(eqComboBox);
connect(eqComboBox,
QComboBox* pEqComboBox = new QComboBox(this);
m_deckEqEffectSelectors.append(pEqComboBox);
connect(pEqComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&DlgPrefEQ::slotEffectChangedOnDeck);
Expand All @@ -123,9 +123,10 @@ void DlgPrefEQ::slotNumDecksChanged(double numDecks) {

// Setup the GUI
gridLayout_3->addWidget(label, deckNo, 0);
gridLayout_3->addWidget(eqComboBox, deckNo, 1);
gridLayout_3->addItem(new QSpacerItem(
40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum),
gridLayout_3->addWidget(pEqComboBox, deckNo, 1);
gridLayout_3->addItem(
new QSpacerItem(
40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum),
deckNo,
3,
1,
Expand All @@ -136,8 +137,8 @@ void DlgPrefEQ::slotNumDecksChanged(double numDecks) {
// Set the configured effect for box and simpleBox or default
// if none is configured
QString group = PlayerManager::groupForDeck(i);
QString configuredEffect = m_pConfig->getValue(ConfigKey(kConfigKey,
kConfigKeyPrefix + group),
QString configuredEffect = m_pConfig->getValue(
ConfigKey(kConfigKey, kEffectForGroupPrefix + group),
kDefaultEqId);

const EffectManifestPointer pEQManifest =
Expand Down Expand Up @@ -246,20 +247,23 @@ void DlgPrefEQ::loadSettings() {
QString highEqPrecise = m_pConfig->getValueString(ConfigKey(kConfigKey, "HiEQFrequencyPrecise"));
QString lowEqCourse = m_pConfig->getValueString(ConfigKey(kConfigKey, "LoEQFrequency"));
QString lowEqPrecise = m_pConfig->getValueString(ConfigKey(kConfigKey, "LoEQFrequencyPrecise"));
m_bEqAutoReset = static_cast<bool>(m_pConfig->getValueString(
ConfigKey(kConfigKey, "EqAutoReset"))
.toInt());
m_bEqAutoReset = static_cast<bool>(
m_pConfig->getValueString(ConfigKey(kConfigKey, "EqAutoReset"))
.toInt());
CheckBoxEqAutoReset->setChecked(m_bEqAutoReset);
m_bGainAutoReset = static_cast<bool>(m_pConfig->getValueString(
ConfigKey(kConfigKey, "GainAutoReset"))
.toInt());
m_bGainAutoReset = static_cast<bool>(
m_pConfig->getValueString(ConfigKey(kConfigKey, "GainAutoReset"))
.toInt());
CheckBoxGainAutoReset->setChecked(m_bGainAutoReset);
CheckBoxBypass->setChecked(m_pConfig->getValue(
ConfigKey(kConfigKey, kEnableEqs), QString("yes")) == "no");
CheckBoxEqOnly->setChecked(m_pConfig->getValue(
ConfigKey(kConfigKey, kEqsOnly), "yes") == "yes");
CheckBoxSingleEqEffect->setChecked(m_pConfig->getValue(
ConfigKey(kConfigKey, kSingleEq), "yes") == "yes");
CheckBoxBypass->setChecked(
m_pConfig->getValue(
ConfigKey(kConfigKey, kEnableEqs), QString("yes")) == "no");
CheckBoxEqOnly->setChecked(
m_pConfig->getValue(
ConfigKey(kConfigKey, kEqsOnly), "yes") == "yes");
CheckBoxSingleEqEffect->setChecked(
m_pConfig->getValue(
ConfigKey(kConfigKey, kSingleEq), "yes") == "yes");

double lowEqFreq = 0.0;
double highEqFreq = 0.0;
Expand Down Expand Up @@ -380,7 +384,7 @@ void DlgPrefEQ::applySelectionsToDecks() {
if (pManifest) {
configString = pManifest->uniqueId();
}
m_pConfig->set(ConfigKey(kConfigKey, kConfigKeyPrefix + group),
m_pConfig->set(ConfigKey(kConfigKey, kEffectForGroupPrefix + group),
configString);

// This is required to remove a previous selected effect that does not
Expand Down
1 change: 1 addition & 0 deletions src/widget/weffectchainpresetbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
WEffectChainPresetButton::WEffectChainPresetButton(QWidget* parent, EffectsManager* pEffectsManager)
: QPushButton(parent),
WBaseWidget(this),
m_iChainNumber(0),
m_pEffectsManager(pEffectsManager),
m_pChainPresetManager(pEffectsManager->getChainPresetManager()),
m_pMenu(make_parented<QMenu>(new QMenu(this))) {
Expand Down