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

Store default recording format after "Resore Defaults", fixing lp1857806 #2414

Merged
merged 4 commits into from
Feb 3, 2020
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: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
==== 2.2.4 2020-mm-dd ====
* Store default recording format after "Restore Defaults" lp:1857806 #2414
* Prevent infinite loop when decoding corrupt MP3 files #2417
* Add workaround for broken libshout versions #2040 #2438
* Speed up purging of tracks lp:1845837 #2393
Expand Down
18 changes: 10 additions & 8 deletions src/preferences/dialog/dlgprefrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig)
m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(m_selFormat.internalName));
}

setupEncoderUI(m_selFormat);
setupEncoderUI();

// Setting Metadata
loadMetaData();
Expand Down Expand Up @@ -160,7 +160,7 @@ void DlgPrefRecord::slotUpdate()
break;
}
}
setupEncoderUI(m_selFormat);
setupEncoderUI();

loadMetaData();

Expand All @@ -178,8 +178,9 @@ void DlgPrefRecord::slotUpdate()
void DlgPrefRecord::slotResetToDefaults()
{
m_formatButtons.first()->setChecked(true);
setupEncoderUI(EncoderFactory::getFactory().getFormatFor(
m_formatButtons.first()->objectName()));
m_selFormat = EncoderFactory::getFactory().getFormatFor(
m_formatButtons.first()->objectName());
setupEncoderUI();
// TODO (XXX): It would be better that a defaultSettings() method is added
// to the EncoderSettings interface so that we know which option to set
m_optionWidgets.first()->setChecked(true);
Expand Down Expand Up @@ -218,12 +219,13 @@ void DlgPrefRecord::slotFormatChanged()
{
QObject *senderObj = sender();
m_selFormat = EncoderFactory::getFactory().getFormatFor(senderObj->objectName());
setupEncoderUI(m_selFormat);
setupEncoderUI();
}

void DlgPrefRecord::setupEncoderUI(Encoder::Format selformat)
{
EncoderSettingsPointer settings = EncoderFactory::getFactory().getEncoderSettings(selformat, m_pConfig);
void DlgPrefRecord::setupEncoderUI() {
EncoderSettingsPointer settings =
EncoderFactory::getFactory().getEncoderSettings(
m_selFormat, m_pConfig);
if (settings->usesQualitySlider()) {
LabelQuality->setVisible(true);
SliderQuality->setVisible(true);
Expand Down
2 changes: 1 addition & 1 deletion src/preferences/dialog/dlgprefrecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DlgPrefRecord : public DlgPreferencePage, public Ui::DlgPrefRecordDlg {
void retainSizeFor(QWidget* widget);
inline void showWidget(QWidget* widget);
inline void hideWidget(QWidget* widget);
void setupEncoderUI(Encoder::Format selformat);
void setupEncoderUI();
void loadMetaData();
void updateTextQuality();
void updateTextCompression();
Expand Down