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

Preferences: apply only in slotApply() #13302

Merged
merged 3 commits into from
Jun 3, 2024
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
1 change: 0 additions & 1 deletion src/preferences/dialog/dlgprefcolors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ void DlgPrefColors::slotResetToDefaults() {
mixxx::PredefinedColorPalettes::kDefaultTrackColorPalette.size());
comboBoxLoopDefaultColor->setCurrentIndex(
mixxx::PredefinedColorPalettes::kDefaultTrackColorPalette.size() - 1);
slotApply();
}

// Apply and save any changes made in the dialog
Expand Down
6 changes: 2 additions & 4 deletions src/preferences/dialog/dlgprefkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ void DlgPrefKey::slotResetToDefaults() {
radioNotationOpenKey->setChecked(true);
notation_type = KeyUtils::KeyNotation::OpenKey;
}
setNotation(notation_type);

slotUpdate();
setNotation(notation_type); // calls slotUpdate()
}

void DlgPrefKey::pluginSelected(int i) {
Expand All @@ -185,7 +183,7 @@ void DlgPrefKey::fastAnalysisEnabled(int i) {
slotUpdate();
}

void DlgPrefKey::reanalyzeEnabled(int i){
void DlgPrefKey::reanalyzeEnabled(int i) {
m_bReanalyzeEnabled = static_cast<bool>(i);
slotUpdate();
}
Expand Down
1 change: 0 additions & 1 deletion src/preferences/dialog/dlgprefmixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ void DlgPrefMixer::slotResetToDefaults() {

setDefaultShelves();
comboBoxMainEq->setCurrentIndex(0); // '---' no EQ
slotApply();
}

void DlgPrefMixer::slotEQEffectSelectionChanged(int effectIndex) {
Expand Down
33 changes: 11 additions & 22 deletions src/preferences/dialog/dlgprefrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig)
&DlgPrefRecord::slotSliderCompression);
}

DlgPrefRecord::~DlgPrefRecord()
{
DlgPrefRecord::~DlgPrefRecord() {
// Note: I don't disconnect signals, since that's supposedly done automatically
// when the object is deleted
for (QRadioButton* button : std::as_const(m_formatButtons)) {
Expand All @@ -140,8 +139,7 @@ DlgPrefRecord::~DlgPrefRecord()
m_optionWidgets.clear();
}

void DlgPrefRecord::slotApply()
{
void DlgPrefRecord::slotApply() {
saveRecordingFolder();
saveMetaData();
saveEncoding();
Expand All @@ -150,8 +148,7 @@ void DlgPrefRecord::slotApply()
}

// This function updates/refreshes the contents of this dialog.
void DlgPrefRecord::slotUpdate()
{
void DlgPrefRecord::slotUpdate() {
// Find out the max width of the labels. This is needed to keep the
// UI fixed in size when hiding or showing elements.
// It is not perfect, but it didn't get better than this.
Expand Down Expand Up @@ -189,8 +186,7 @@ void DlgPrefRecord::slotUpdate()
}
}

void DlgPrefRecord::slotResetToDefaults()
{
void DlgPrefRecord::slotResetToDefaults() {
m_formatButtons.first()->setChecked(true);
m_selFormat = EncoderFactory::getFactory().getFormatFor(
m_formatButtons.first()->objectName());
Expand All @@ -208,9 +204,7 @@ void DlgPrefRecord::slotResetToDefaults()
CheckBoxRecordCueFile->setChecked(kDefaultCueEnabled);
}


void DlgPrefRecord::slotBrowseRecordingsDir()
{
void DlgPrefRecord::slotBrowseRecordingsDir() {
QString fd = QFileDialog::getExistingDirectory(
this, tr("Choose recordings directory"),
m_pConfig->getValueString(
Expand All @@ -228,8 +222,7 @@ void DlgPrefRecord::slotBrowseRecordingsDir()
}
}

void DlgPrefRecord::slotFormatChanged()
{
void DlgPrefRecord::slotFormatChanged() {
QObject *senderObj = sender();
m_selFormat = EncoderFactory::getFactory().getFormatFor(senderObj->objectName());
setupEncoderUI();
Expand Down Expand Up @@ -305,8 +298,7 @@ void DlgPrefRecord::setupEncoderUI() {
}
}

void DlgPrefRecord::slotSliderQuality()
{
void DlgPrefRecord::slotSliderQuality() {
updateTextQuality();
// Settings are only stored when doing an apply so that "cancel" can actually cancel.
}
Expand Down Expand Up @@ -339,8 +331,7 @@ void DlgPrefRecord::updateTextQuality() {
}
}

void DlgPrefRecord::slotSliderCompression()
{
void DlgPrefRecord::slotSliderCompression() {
updateTextCompression();
// Settings are only stored when doing an apply so that "cancel" can actually cancel.
}
Expand Down Expand Up @@ -371,9 +362,7 @@ void DlgPrefRecord::loadMetaData() {
LineEditAlbum->setText(m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Album")));
}


void DlgPrefRecord::saveRecordingFolder()
{
void DlgPrefRecord::saveRecordingFolder() {
QString newPath = LineEditRecordings->text();
if (newPath != m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Directory"))) {
QFileInfo fileInfo(newPath);
Expand Down Expand Up @@ -402,8 +391,8 @@ void DlgPrefRecord::saveRecordingFolder()
m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Directory"), newPath);
}
}
void DlgPrefRecord::saveMetaData()
{

void DlgPrefRecord::saveMetaData() {
m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Title"), ConfigValue(LineEditTitle->text()));
m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Author"), ConfigValue(LineEditAuthor->text()));
m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Album"), ConfigValue(LineEditAlbum->text()));
Expand Down
11 changes: 2 additions & 9 deletions src/preferences/dialog/dlgprefreplaygain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ DlgPrefReplayGain::DlgPrefReplayGain(QWidget* parent, UserSettingsPointer pConfi
m_enabled(kConfigKey, kReplayGainEnabled) {
setupUi(this);

m_analysisButtonGroup.addButton(radioButtonRG1);
m_analysisButtonGroup.addButton(radioButtonRG2);
m_analysisButtonGroup.addButton(radioButtonDisable);

connect(EnableGain, &QCheckBox::stateChanged, this, &DlgPrefReplayGain::slotSetRGEnabled);
connect(&m_analysisButtonGroup,
connect(buttonGroupAnalyzer,
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
&QButtonGroup::idClicked,
#else
Expand Down Expand Up @@ -68,7 +64,6 @@ void DlgPrefReplayGain::loadSettings() {
SliderReplayGainBoost->setValue(iReplayGainBoost);
setLabelCurrentReplayGainBoost(iReplayGainBoost);


int iDefaultBoost = m_rgSettings.getInitialDefaultBoost();
SliderDefaultBoost->setValue(iDefaultBoost);
LabelCurrentDefaultBoost->setText(
Expand All @@ -79,15 +74,13 @@ void DlgPrefReplayGain::loadSettings() {

bool analyzerEnabled = m_rgSettings.getReplayGainAnalyzerEnabled();
int version = m_rgSettings.getReplayGainAnalyzerVersion();

if (!analyzerEnabled) {
radioButtonDisable->setChecked(true);
} else if (version == 1) {
radioButtonRG1->setChecked(true);
} else {
radioButtonRG2->setChecked(true);
}

checkBoxReanalyze->setEnabled(analyzerEnabled);

bool reanalyse = m_rgSettings.getReplayGainReanalyze();
Expand All @@ -100,7 +93,7 @@ void DlgPrefReplayGain::loadSettings() {

void DlgPrefReplayGain::slotResetToDefaults() {
EnableGain->setChecked(true);
// Turn ReplayGain Analyzer on by default as it does not give appreciable
// Turn ReplayGain Analyzer on by default as it does not give noticeable
// delay on recent hardware (<5 years old).
radioButtonRG2->setChecked(true);
checkBoxReanalyze->setChecked(false);
Expand Down
2 changes: 0 additions & 2 deletions src/preferences/dialog/dlgprefreplaygain.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ class DlgPrefReplayGain: public DlgPreferencePage,
PollingControlProxy m_replayGainBoost;
PollingControlProxy m_defaultBoost;
PollingControlProxy m_enabled;

QButtonGroup m_analysisButtonGroup;
};
21 changes: 21 additions & 0 deletions src/preferences/dialog/dlgprefreplaygaindlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -231,20 +231,29 @@
<property name="text">
<string>ReplayGain 2.0 (ITU-R BS.1770)</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAnalyzer</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonRG1">
<property name="text">
<string>ReplayGain 1.0</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAnalyzer</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonDisable">
<property name="text">
<string>Disabled</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupAnalyzer</string>
</attribute>
</widget>
</item>
<item>
Expand Down Expand Up @@ -307,6 +316,18 @@ The loudness target is approximate and assumes track pregain and main output lev
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>EnableGain</tabstop>
<tabstop>SliderReplayGainBoost</tabstop>
<tabstop>SliderDefaultBoost</tabstop>
<tabstop>radioButtonRG1</tabstop>
<tabstop>radioButtonRG2</tabstop>
<tabstop>radioButtonDisable</tabstop>
<tabstop>checkBoxReanalyze</tabstop>
</tabstops>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupAnalyzer"/>
</buttongroups>
</ui>