Skip to content

Commit

Permalink
Preferences: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed May 29, 2024
1 parent 61bd026 commit db408f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/preferences/dialog/dlgprefkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,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
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

0 comments on commit db408f8

Please sign in to comment.