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

DlgPrefEq: Rename Master EQ to Main EQ #3868

Merged
merged 1 commit into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
67 changes: 34 additions & 33 deletions src/preferences/dialog/dlgprefeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const QString kEnableEqs = "EnableEQs";
const QString kEqsOnly = "EQsOnly";
const QString kSingleEq = "SingleEQEffect";
const QString kDefaultEqId = BiquadFullKillEQEffect::getId();
const QString kDefaultMasterEqId = QString();
const QString kDefaultMainEqId = QString();
const QString kDefaultQuickEffectId = FilterEffect::getId();

const int kFrequencyUpperLimit = 20050;
Expand Down Expand Up @@ -80,7 +80,7 @@ DlgPrefEQ::DlgPrefEQ(
m_pNumDecks->connectValueChanged(this, &DlgPrefEQ::slotNumDecksChanged);
slotNumDecksChanged(m_pNumDecks->get());

setUpMasterEQ();
setUpMainEQ();

loadSettings();
slotUpdate();
Expand Down Expand Up @@ -180,7 +180,7 @@ static bool isMixingEQ(EffectManifest* pManifest) {
return pManifest->isMixingEQ();
}

static bool isMasterEQ(EffectManifest* pManifest) {
static bool isMainEQ(EffectManifest* pManifest) {
return pManifest->isMasterEQ();
}

Expand Down Expand Up @@ -366,7 +366,7 @@ void DlgPrefEQ::setDefaultShelves()
}

void DlgPrefEQ::slotResetToDefaults() {
slotMasterEQToDefault();
slotMainEQToDefault();
setDefaultShelves();
foreach(QComboBox* pCombo, m_deckEqEffectSelectors) {
pCombo->setCurrentIndex(
Expand Down Expand Up @@ -573,8 +573,8 @@ void DlgPrefEQ::slotUpdateLoEQ() {
slotApply();
}

void DlgPrefEQ::slotUpdateMasterEQParameter(int value) {
EffectPointer effect(m_pEffectMasterEQ);
void DlgPrefEQ::slotUpdateMainEQParameter(int value) {
EffectPointer effect(m_pEffectMainEQ);
if (!effect.isNull()) {
QSlider* slider = qobject_cast<QSlider*>(sender());
int index = slider->property("index").toInt();
Expand Down Expand Up @@ -661,35 +661,36 @@ void DlgPrefEQ::slotBypass(int state) {
slotApply();
}

void DlgPrefEQ::setUpMasterEQ() {
connect(pbResetMasterEq, &QAbstractButton::clicked, this, &DlgPrefEQ::slotMasterEQToDefault);
void DlgPrefEQ::setUpMainEQ() {
connect(pbResetMainEq, &QAbstractButton::clicked, this, &DlgPrefEQ::slotMainEQToDefault);

connect(comboBoxMasterEq,
connect(comboBoxMainEq,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&DlgPrefEQ::slotMasterEqEffectChanged);
&DlgPrefEQ::slotMainEqEffectChanged);

QString configuredEffect = m_pConfig->getValue(ConfigKey(kConfigKey,
"EffectForGroup_[Master]"), kDefaultMasterEqId);
"EffectForGroup_[Master]"),
kDefaultMainEqId);

const QList<EffectManifestPointer> availableMasterEQEffects =
m_pEffectsManager->getAvailableEffectManifestsFiltered(isMasterEQ);
const QList<EffectManifestPointer> availableMainEQEffects =
m_pEffectsManager->getAvailableEffectManifestsFiltered(isMainEQ);

// Add empty item at the top: no Master EQ
comboBoxMasterEq->addItem(EffectsManager::kNoEffectString);
for (const auto& pManifest : availableMasterEQEffects) {
comboBoxMasterEq->addItem(pManifest->name(), QVariant(pManifest->id()));
// Add empty item at the top: no Main EQ
comboBoxMainEq->addItem(EffectsManager::kNoEffectString);
for (const auto& pManifest : availableMainEQEffects) {
comboBoxMainEq->addItem(pManifest->name(), QVariant(pManifest->id()));
}

int masterEqIndex = comboBoxMasterEq->findData(configuredEffect);
int masterEqIndex = comboBoxMainEq->findData(configuredEffect);
if (masterEqIndex < 0) {
// Configured effect not in list, clear selection
masterEqIndex = 0;
}
comboBoxMasterEq->setCurrentIndex(masterEqIndex);
comboBoxMainEq->setCurrentIndex(masterEqIndex);

// Load parameters from preferences:
EffectPointer effect(m_pEffectMasterEQ);
EffectPointer effect(m_pEffectMainEQ);
if (!effect.isNull()) {
int knobNum = effect->numKnobParameters();
for (int i = 0; i < knobNum; i++) {
Expand All @@ -700,14 +701,14 @@ void DlgPrefEQ::setUpMasterEQ() {
bool ok;
double value = strValue.toDouble(&ok);
if (ok) {
setMasterEQParameter(i, value);
setMainEQParameter(i, value);
}
}
}
}
}

void DlgPrefEQ::slotMasterEqEffectChanged(int effectIndex) {
void DlgPrefEQ::slotMainEqEffectChanged(int effectIndex) {
// clear parameters view first
qDeleteAll(m_masterEQSliders);
m_masterEQSliders.clear();
Expand All @@ -716,12 +717,12 @@ void DlgPrefEQ::slotMasterEqEffectChanged(int effectIndex) {
qDeleteAll(m_masterEQLabels);
m_masterEQLabels.clear();

QString effectId = comboBoxMasterEq->itemData(effectIndex).toString();
QString effectId = comboBoxMainEq->itemData(effectIndex).toString();

if (effectId.isNull()) {
pbResetMasterEq->hide();
pbResetMainEq->hide();
} else {
pbResetMasterEq->show();
pbResetMainEq->show();
}

EffectChainSlotPointer pChainSlot = m_pOutputEffectRack->getEffectChainSlot(0);
Expand All @@ -736,11 +737,11 @@ void DlgPrefEQ::slotMasterEqEffectChanged(int effectIndex) {

if (pEffect) {
pEffect->setEnabled(true);
m_pEffectMasterEQ = pEffect;
m_pEffectMainEQ = pEffect;

int knobNum = pEffect->numKnobParameters();

// Create and set up Master EQ's sliders
// Create and set up Main EQ's sliders
int i;
for (i = 0; i < knobNum; i++) {
EffectParameter* param = pEffect->getKnobParameterForSlot(i);
Expand All @@ -765,7 +766,7 @@ void DlgPrefEQ::slotMasterEqEffectChanged(int effectIndex) {
connect(slider,
&QAbstractSlider::sliderMoved,
this,
&DlgPrefEQ::slotUpdateMasterEQParameter);
&DlgPrefEQ::slotUpdateMainEQParameter);

QLabel* valueLabel = new QLabel(this);
m_masterEQValues.append(valueLabel);
Expand Down Expand Up @@ -831,22 +832,22 @@ QString DlgPrefEQ::getQuickEffectGroupForDeck(int deck) const {
return QString();
}

void DlgPrefEQ::slotMasterEQToDefault() {
EffectPointer effect(m_pEffectMasterEQ);
void DlgPrefEQ::slotMainEQToDefault() {
EffectPointer effect(m_pEffectMainEQ);
if (!effect.isNull()) {
int knobNum = effect->numKnobParameters();
for (int i = 0; i < knobNum; i++) {
EffectParameter* param = effect->getKnobParameterForSlot(i);
if (param) {
double defaultValue = param->getDefault();
setMasterEQParameter(i, defaultValue);
setMainEQParameter(i, defaultValue);
}
}
}
}

void DlgPrefEQ::setMasterEQParameter(int i, double value) {
EffectPointer effect(m_pEffectMasterEQ);
void DlgPrefEQ::setMainEQParameter(int i, double value) {
EffectPointer effect(m_pEffectMainEQ);
if (!effect.isNull()) {
EffectParameter* param = effect->getKnobParameterForSlot(i);
if (param) {
Expand Down
16 changes: 8 additions & 8 deletions src/preferences/dialog/dlgprefeq.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class DlgPrefEQ : public DlgPreferencePage, public Ui::DlgPrefEQDlg {
void slotUpdateEqAutoReset(int);
void slotUpdateGainAutoReset(int);
void slotBypass(int state);
// Update the Master EQ
void slotUpdateMasterEQParameter(int value);
void slotMasterEQToDefault();
void setMasterEQParameter(int i, double value);
void slotMasterEqEffectChanged(int effectIndex);
// Update the Main EQ
void slotUpdateMainEQParameter(int value);
void slotMainEQToDefault();
void setMainEQParameter(int i, double value);
void slotMainEqEffectChanged(int effectIndex);

signals:
void apply(const QString &);
Expand All @@ -59,7 +59,7 @@ class DlgPrefEQ : public DlgPreferencePage, public Ui::DlgPrefEQDlg {
int getSliderPosition(double eqFreq, int minimum, int maximum);
void validate_levels();
void updateBandFilter(int index, double value);
void setUpMasterEQ();
void setUpMainEQ();
void applySelections();

ControlProxy m_COLoFreq;
Expand All @@ -81,11 +81,11 @@ class DlgPrefEQ : public DlgPreferencePage, public Ui::DlgPrefEQDlg {

bool m_inSlotPopulateDeckEffectSelectors;

// Members needed for the Master EQ
// Members needed for the Main EQ
QList<QSlider*> m_masterEQSliders;
QList<QLabel*> m_masterEQValues;
QList<QLabel*> m_masterEQLabels;
QWeakPointer<Effect> m_pEffectMasterEQ;
QWeakPointer<Effect> m_pEffectMainEQ;

bool m_bEqAutoReset;
bool m_bGainAutoReset;
Expand Down
14 changes: 7 additions & 7 deletions src/preferences/dialog/dlgprefeqdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,18 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="MasterMasterEQ">
<widget class="QGroupBox" name="MainMainEQ">
<property name="title">
<string>Master EQ</string>
<string>Main EQ</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="comboBoxMasterEq"/>
<widget class="QComboBox" name="comboBoxMainEq"/>
</item>
<item>
<widget class="QPushButton" name="pbResetMasterEq">
<widget class="QPushButton" name="pbResetMainEq">
<property name="text">
<string>Reset Parameter</string>
</property>
Expand Down Expand Up @@ -423,10 +423,10 @@
Dynamically add Eq / Quick Effect comboboxes -->
<tabstop>SliderHiEQ</tabstop>
<tabstop>SliderLoEQ</tabstop>
<tabstop>comboBoxMasterEq</tabstop>
<tabstop>pbResetMasterEq</tabstop>
<tabstop>comboBoxMainEq</tabstop>
<tabstop>pbResetMainEq</tabstop>
<!-- TODO(ronso0)
Dynamically add Master EQ sliders -->
Dynamically add Main EQ sliders -->
<tabstop>CheckBoxEqAutoReset</tabstop>
<tabstop>CheckBoxGainAutoReset</tabstop>
<tabstop>CheckBoxBypass</tabstop>
Expand Down