summaryrefslogtreecommitdiffstats
path: root/src/preferences
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-15 01:05:33 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-15 01:57:06 +0100
commit0471998e13aada9a76e92b13ab3885c2d1c2fb84 (patch)
tree776d15ab92ef044956940bc2228b61256ca4feb9 /src/preferences
parent63b858b5d827797eec959d009ad0b970de167dc5 (diff)
Add missing braces around single-line statements
Diffstat (limited to 'src/preferences')
-rw-r--r--src/preferences/broadcastprofile.cpp6
-rw-r--r--src/preferences/broadcastsettings.cpp18
-rw-r--r--src/preferences/broadcastsettings_legacy.cpp3
-rw-r--r--src/preferences/broadcastsettingsmodel.cpp21
-rw-r--r--src/preferences/dialog/dlgprefbroadcast.cpp3
-rw-r--r--src/preferences/dialog/dlgpreferences.cpp3
-rw-r--r--src/preferences/dialog/dlgprefmodplug.cpp15
-rw-r--r--src/preferences/dialog/dlgprefsound.cpp12
-rw-r--r--src/preferences/dialog/dlgprefsounditem.cpp4
-rw-r--r--src/preferences/dialog/dlgprefvinyl.cpp25
-rw-r--r--src/preferences/effectsettingsmodel.cpp15
-rw-r--r--src/preferences/upgrade.cpp63
12 files changed, 131 insertions, 57 deletions
diff --git a/src/preferences/broadcastprofile.cpp b/src/preferences/broadcastprofile.cpp
index 3912a1bb2c..4bf00a59d7 100644
--- a/src/preferences/broadcastprofile.cpp
+++ b/src/preferences/broadcastprofile.cpp
@@ -108,8 +108,9 @@ QString BroadcastProfile::stripForbiddenChars(const QString& str) {
BroadcastProfilePtr BroadcastProfile::loadFromFile(
const QString& filename) {
QFileInfo xmlFile(filename);
- if (!xmlFile.exists())
+ if (!xmlFile.exists()) {
return BroadcastProfilePtr(nullptr);
+ }
QString profileFilename = xmlFile.baseName();
// The profile filename (without extension) is used to create the instance
@@ -260,8 +261,9 @@ void BroadcastProfile::adoptDefaultValues() {
bool BroadcastProfile::loadValues(const QString& filename) {
QDomElement doc = XmlParse::openXMLFile(filename, kDoctype);
- if (doc.childNodes().size() < 1)
+ if (doc.childNodes().size() < 1) {
return false;
+ }
m_filename = filename;
diff --git a/src/preferences/broadcastsettings.cpp b/src/preferences/broadcastsettings.cpp
index 4378257de7..c47af75f75 100644
--- a/src/preferences/broadcastsettings.cpp
+++ b/src/preferences/broadcastsettings.cpp
@@ -55,8 +55,9 @@ void BroadcastSettings::loadProfiles() {
BroadcastProfilePtr profile =
BroadcastProfile::loadFromFile(fileInfo.absoluteFilePath());
- if (profile)
+ if (profile) {
addProfile(profile);
+ }
}
} else {
kLogger.info() << "No profiles found. Creating default profile.";
@@ -72,8 +73,9 @@ void BroadcastSettings::loadProfiles() {
}
bool BroadcastSettings::addProfile(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return false;
+ }
if (m_profiles.size() >= BROADCAST_MAX_CONNECTIONS) {
kLogger.warning() << "addProfile: connection limit reached."
@@ -102,8 +104,9 @@ bool BroadcastSettings::addProfile(BroadcastProfilePtr profile) {
}
bool BroadcastSettings::saveProfile(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return false;
+ }
QString filename = profile->getLastFilename();
if (filename.isEmpty()) {
@@ -133,15 +136,17 @@ QString BroadcastSettings::filePathForProfile(const QString& profileName) {
}
QString BroadcastSettings::filePathForProfile(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return QString();
+ }
return filePathForProfile(profile->getProfileName());
}
bool BroadcastSettings::deleteFileForProfile(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return false;
+ }
QString filename = profile->getLastFilename();
if (filename.isEmpty()) {
@@ -170,8 +175,9 @@ void BroadcastSettings::saveAll() {
}
void BroadcastSettings::onProfileNameChanged(const QString& oldName, const QString& newName) {
- if (!m_profiles.contains(oldName))
+ if (!m_profiles.contains(oldName)) {
return;
+ }
BroadcastProfilePtr profile = m_profiles.take(oldName);
if (profile) {
diff --git a/src/preferences/broadcastsettings_legacy.cpp b/src/preferences/broadcastsettings_legacy.cpp
index 428f457f05..5e3b2d1d7e 100644
--- a/src/preferences/broadcastsettings_legacy.cpp
+++ b/src/preferences/broadcastsettings_legacy.cpp
@@ -33,8 +33,9 @@ const char* kStreamWebsite = "stream_website";
} // namespace
void BroadcastSettings::loadLegacySettings(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return;
+ }
// For each value, the current value is kept if it can't be found in the
// general settings file.
diff --git a/src/preferences/broadcastsettingsmodel.cpp b/src/preferences/broadcastsettingsmodel.cpp
index b3140e0cdd..72f05f5ece 100644
--- a/src/preferences/broadcastsettingsmodel.cpp
+++ b/src/preferences/broadcastsettingsmodel.cpp
@@ -41,8 +41,9 @@ void BroadcastSettingsModel::resetFromSettings(BroadcastSettingsPointer pSetting
}
bool BroadcastSettingsModel::addProfileToModel(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return false;
+ }
int position = m_profiles.size();
beginInsertRows(QModelIndex(), position, position);
@@ -67,8 +68,9 @@ bool BroadcastSettingsModel::addProfileToModel(BroadcastProfilePtr profile) {
}
void BroadcastSettingsModel::deleteProfileFromModel(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return;
+ }
QString name = profile->getProfileName();
int position = 0;
@@ -98,8 +100,9 @@ int BroadcastSettingsModel::columnCount(const QModelIndex& parent) const {
QVariant BroadcastSettingsModel::data(const QModelIndex& index, int role) const {
int rowIndex = index.row();
- if (!index.isValid() || rowIndex >= m_profiles.size())
+ if (!index.isValid() || rowIndex >= m_profiles.size()) {
return QVariant();
+ }
auto it = m_profiles.constBegin() + rowIndex;
if (it != m_profiles.constEnd()) {
@@ -149,11 +152,13 @@ QVariant BroadcastSettingsModel::headerData(int section, Qt::Orientation orienta
}
Qt::ItemFlags BroadcastSettingsModel::flags(const QModelIndex& index) const {
- if (index.column() == kColumnEnabled)
+ if (index.column() == kColumnEnabled) {
return QAbstractItemModel::flags(index) | Qt::ItemIsUserCheckable;
+ }
- if (index.column() == kColumnName)
+ if (index.column() == kColumnName) {
return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable;
+ }
return QAbstractItemModel::flags(index) | Qt::ItemIsEnabled;
}
@@ -170,8 +175,9 @@ bool BroadcastSettingsModel::setData(const QModelIndex& index, const QVariant& v
QString newName = value.toString();
newName = newName.trimmed();
- if (!newName.isNull() && !newName.isEmpty())
+ if (!newName.isNull() && !newName.isEmpty()) {
profile->setProfileName(newName);
+ }
}
}
}
@@ -218,8 +224,9 @@ QColor BroadcastSettingsModel::connectionStatusBgColor(BroadcastProfilePtr profi
}
void BroadcastSettingsModel::onProfileNameChanged(const QString& oldName, const QString& newName) {
- if (!m_profiles.contains(oldName))
+ if (!m_profiles.contains(oldName)) {
return;
+ }
BroadcastProfilePtr profile = m_profiles.take(oldName);
if (profile) {
diff --git a/src/preferences/dialog/dlgprefbroadcast.cpp b/src/preferences/dialog/dlgprefbroadcast.cpp
index f06add02c1..0c63359cbd 100644
--- a/src/preferences/dialog/dlgprefbroadcast.cpp
+++ b/src/preferences/dialog/dlgprefbroadcast.cpp
@@ -504,8 +504,9 @@ void DlgPrefBroadcast::getValuesFromProfile(BroadcastProfilePtr profile) {
}
void DlgPrefBroadcast::setValuesToProfile(BroadcastProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return;
+ }
profile->setSecureCredentialStorage(rbPasswordKeychain->isChecked());
diff --git a/src/preferences/dialog/dlgpreferences.cpp b/src/preferences/dialog/dlgpreferences.cpp
index 8d3fa0d427..e1351253d8 100644
--- a/src/preferences/dialog/dlgpreferences.cpp
+++ b/src/preferences/dialog/dlgpreferences.cpp
@@ -310,8 +310,9 @@ void DlgPreferences::createIcons() {
}
void DlgPreferences::changePage(QTreeWidgetItem* current, QTreeWidgetItem* previous) {
- if (!current)
+ if (!current) {
current = previous;
+ }
if (current == m_pSoundButton) {
switchToPage(m_soundPage);
diff --git a/src/preferences/dialog/dlgprefmodplug.cpp b/src/preferences/dialog/dlgprefmodplug.cpp
index f3c28fc221..3fac78ee81 100644
--- a/src/preferences/dialog/dlgprefmodplug.cpp
+++ b/src/preferences/dialog/dlgprefmodplug.cpp
@@ -146,16 +146,21 @@ void DlgPrefModplug::applySettings() {
// enabled features flags
settings.mFlags = 0;
- if (m_pUi->oversampling->isChecked())
+ if (m_pUi->oversampling->isChecked()) {
settings.mFlags |= ModPlug::MODPLUG_ENABLE_OVERSAMPLING;
- if (m_pUi->noiseReduction->isChecked())
+ }
+ if (m_pUi->noiseReduction->isChecked()) {
settings.mFlags |= ModPlug::MODPLUG_ENABLE_NOISE_REDUCTION;
- if (m_pUi->reverb->isChecked())
+ }
+ if (m_pUi->reverb->isChecked()) {
settings.mFlags |= ModPlug::MODPLUG_ENABLE_REVERB;
- if (m_pUi->megabass->isChecked())
+ }
+ if (m_pUi->megabass->isChecked()) {
settings.mFlags |= ModPlug::MODPLUG_ENABLE_MEGABASS;
- if (m_pUi->surround->isChecked())
+ }
+ if (m_pUi->surround->isChecked()) {
settings.mFlags |= ModPlug::MODPLUG_ENABLE_SURROUND;
+ }
switch (m_pUi->resampleMode->currentIndex()) {
case 0: // nearest neighbor
diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp
index 7b57b6a33e..077fd2cab0 100644
--- a/src/preferences/dialog/dlgprefsound.cpp
+++ b/src/preferences/dialog/dlgprefsound.cpp
@@ -405,7 +405,9 @@ void DlgPrefSound::insertItem(DlgPrefSoundItem *pItem, QVBoxLayout *pLayout) {
for (pos = 0; pos < pLayout->count() - 1; ++pos) {
DlgPrefSoundItem *pOther(qobject_cast<DlgPrefSoundItem*>(
pLayout->itemAt(pos)->widget()));
- if (!pOther) continue;
+ if (!pOther) {
+ continue;
+ }
if (pItem->type() < pOther->type()) {
break;
} else if (pItem->type() == pOther->type()
@@ -628,12 +630,16 @@ void DlgPrefSound::refreshDevices() {
* DlgPrefSound::slotApply knows to apply them.
*/
void DlgPrefSound::settingChanged() {
- if (m_loading) return; // doesn't count if we're just loading prefs
+ if (m_loading) {
+ return; // doesn't count if we're just loading prefs
+ }
m_settingsModified = true;
}
void DlgPrefSound::deviceSettingChanged() {
- if (m_loading) return;
+ if (m_loading) {
+ return;
+ }
checkLatencyCompensation();
m_settingsModified = true;
}
diff --git a/src/preferences/dialog/dlgprefsounditem.cpp b/src/preferences/dialog/dlgprefsounditem.cpp
index e493d60855..8efa2d3c04 100644
--- a/src/preferences/dialog/dlgprefsounditem.cpp
+++ b/src/preferences/dialog/dlgprefsounditem.cpp
@@ -80,7 +80,9 @@ void DlgPrefSoundItem::refreshDevices(const QList<SoundDevicePointer>& devices)
deviceComboBox->removeItem(deviceComboBox->count() - 1);
}
for (const auto& pDevice: qAsConst(m_devices)) {
- if (!hasSufficientChannels(*pDevice)) continue;
+ if (!hasSufficientChannels(*pDevice)) {
+ continue;
+ }
deviceComboBox->addItem(pDevice->getDisplayName(), QVariant::fromValue(pDevice->getDeviceId()));
}
int newIndex = deviceComboBox->findData(QVariant::fromValue(oldDev));
diff --git a/src/preferences/dialog/dlgprefvinyl.cpp b/src/preferences/dialog/dlgprefvinyl.cpp
index 31c09ba830..bc71880bab 100644
--- a/src/preferences/dialog/dlgprefvinyl.cpp
+++ b/src/preferences/dialog/dlgprefvinyl.cpp
@@ -197,51 +197,58 @@ void DlgPrefVinyl::slotUpdate() {
int combo_index =
ComboBoxVinylType1->findText(config->getValueString(
ConfigKey("[Channel1]", "vinylcontrol_vinyl_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylType1->setCurrentIndex(combo_index);
+ }
combo_index =
ComboBoxVinylType2->findText(config->getValueString(
ConfigKey("[Channel2]", "vinylcontrol_vinyl_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylType2->setCurrentIndex(combo_index);
+ }
combo_index =
ComboBoxVinylType3->findText(config->getValueString(
ConfigKey("[Channel3]", "vinylcontrol_vinyl_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylType3->setCurrentIndex(combo_index);
+ }
combo_index =
ComboBoxVinylType4->findText(config->getValueString(
ConfigKey("[Channel4]", "vinylcontrol_vinyl_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylType4->setCurrentIndex(combo_index);
-
+ }
combo_index =
ComboBoxVinylSpeed1->findText(config->getValueString(
ConfigKey("[Channel1]", "vinylcontrol_speed_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylSpeed1->setCurrentIndex(combo_index);
+ }
combo_index =
ComboBoxVinylSpeed2->findText(config->getValueString(
ConfigKey("[Channel2]", "vinylcontrol_speed_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylSpeed2->setCurrentIndex(combo_index);
+ }
combo_index =
ComboBoxVinylSpeed3->findText(config->getValueString(
ConfigKey("[Channel3]", "vinylcontrol_speed_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylSpeed3->setCurrentIndex(combo_index);
+ }
combo_index =
ComboBoxVinylSpeed4->findText(config->getValueString(
ConfigKey("[Channel4]", "vinylcontrol_speed_type")));
- if (combo_index != -1)
+ if (combo_index != -1) {
ComboBoxVinylSpeed4->setCurrentIndex(combo_index);
+ }
// set lead-in time
LeadinTime1->setValue((config->getValue(ConfigKey("[Channel1]", "vinylcontrol_lead_in_time"), "0")).toInt());
diff --git a/src/preferences/effectsettingsmodel.cpp b/src/preferences/effectsettingsmodel.cpp
index 324e63d0a1..0ad593c107 100644
--- a/src/preferences/effectsettingsmodel.cpp
+++ b/src/preferences/effectsettingsmodel.cpp
@@ -33,8 +33,9 @@ void EffectSettingsModel::resetFromEffectManager(EffectsManager* pEffectsManager
}
bool EffectSettingsModel::addProfileToModel(EffectProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return false;
+ }
int position = m_profiles.size();
beginInsertRows(QModelIndex(), position, position);
@@ -46,8 +47,9 @@ bool EffectSettingsModel::addProfileToModel(EffectProfilePtr profile) {
}
void EffectSettingsModel::deleteProfileFromModel(EffectProfilePtr profile) {
- if (!profile)
+ if (!profile) {
return;
+ }
int position = m_profiles.indexOf(profile);
if (position > -1) {
@@ -112,14 +114,17 @@ QVariant EffectSettingsModel::headerData(int section, Qt::Orientation orientatio
}
Qt::ItemFlags EffectSettingsModel::flags(const QModelIndex& index) const {
- if (index.column() == kColumnEnabled)
+ if (index.column() == kColumnEnabled) {
return QAbstractItemModel::flags(index) | Qt::ItemIsUserCheckable;
+ }
- if (index.column() == kColumnName)
+ if (index.column() == kColumnName) {
return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable;
+ }
- if (index.column() == kColumnType)
+ if (index.column() == kColumnType) {
return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable;
+ }
return QAbstractItemModel::flags(index) | Qt::ItemIsEnabled;
}
diff --git a/src/preferences/upgrade.cpp b/src/preferences/upgrade.cpp
index caea917b32..a5aeb415e6 100644
--- a/src/preferences/upgrade.cpp
+++ b/src/preferences/upgrade.cpp
@@ -69,8 +69,15 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
oldFile->remove();
}
else {
- if (oldFile->error()==14) qDebug() << errorText.arg("library", oldFilePath, newFilePath) << "The destination file already exists.";
- else qDebug() << errorText.arg("library", oldFilePath, newFilePath) << "Error #" << oldFile->error();
+ if (oldFile->error() == 14) {
+ qDebug() << errorText.arg(
+ "library", oldFilePath, newFilePath)
+ << "The destination file already exists.";
+ } else {
+ qDebug() << errorText.arg(
+ "library", oldFilePath, newFilePath)
+ << "Error #" << oldFile->error();
+ }
}
}
delete oldFile;
@@ -83,11 +90,18 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
newFilePath = newLocation.filePath("mixxxbpmscheme.xml");
oldFile = new QFile(oldFilePath);
if (oldFile->exists()) {
- if (oldFile->copy(newFilePath))
+ if (oldFile->copy(newFilePath)) {
oldFile->remove();
- else {
- if (oldFile->error()==14) qDebug() << errorText.arg("settings", oldFilePath, newFilePath) << "The destination file already exists.";
- else qDebug() << errorText.arg("settings", oldFilePath, newFilePath) << "Error #" << oldFile->error();
+ } else {
+ if (oldFile->error() == 14) {
+ qDebug() << errorText.arg(
+ "settings", oldFilePath, newFilePath)
+ << "The destination file already exists.";
+ } else {
+ qDebug() << errorText.arg(
+ "settings", oldFilePath, newFilePath)
+ << "Error #" << oldFile->error();
+ }
}
}
delete oldFile;
@@ -100,11 +114,20 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
oldFile = new QFile(oldFilePath);
if (oldFile->exists()) {
qWarning() << "The MIDI mapping file format has changed in this version of Mixxx. You will need to reconfigure your MIDI controller. See the Wiki for full details on the new format.";
- if (oldFile->copy(newFilePath))
+ if (oldFile->copy(newFilePath)) {
oldFile->remove();
- else {
- if (oldFile->error()==14) qDebug() << errorText.arg("MIDI mapping", oldFilePath, newFilePath) << "The destination file already exists.";
- else qDebug() << errorText.arg("MIDI mapping", oldFilePath, newFilePath) << "Error #" << oldFile->error();
+ } else {
+ if (oldFile->error() == 14) {
+ qDebug()
+ << errorText.arg(
+ "MIDI mapping", oldFilePath, newFilePath)
+ << "The destination file already exists.";
+ } else {
+ qDebug()
+ << errorText.arg(
+ "MIDI mapping", oldFilePath, newFilePath)
+ << "Error #" << oldFile->error();
+ }
}
}
// Tidy up
@@ -122,12 +145,19 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
#endif
newFilePath = newLocation.filePath(SETTINGS_FILE);
oldFile = new QFile(oldFilePath);
- if (oldFile->copy(newFilePath))
+ if (oldFile->copy(newFilePath)) {
oldFile->remove();
- else {
- if (oldFile->error()==14) qDebug() << errorText.arg("configuration", oldFilePath, newFilePath) << "The destination file already exists.";
- else qDebug() << errorText.arg("configuration", oldFilePath, newFilePath) << "Error #" << oldFile->error();
+ } else {
+ if (oldFile->error() == 14) {
+ qDebug() << errorText.arg(
+ "configuration", oldFilePath, newFilePath)
+ << "The destination file already exists.";
+ } else {
+ qDebug() << errorText.arg(
+ "configuration", oldFilePath, newFilePath)
+ << "Error #" << oldFile->error();
}
+ }
delete oldFile;
}
@@ -403,8 +433,9 @@ UserSettingsPointer Upgrade::versionUpgrade(const QString& settingsPath) {
config->set(ConfigKey("[Config]","Version"), ConfigValue(MIXXX_VERSION));
}
- if (configVersion == MIXXX_VERSION) qDebug() << "Configuration file is now at the current version" << MIXXX_VERSION;
- else {
+ if (configVersion == MIXXX_VERSION) {
+ qDebug() << "Configuration file is now at the current version" << MIXXX_VERSION;
+ } else {
qWarning() << "Configuration file is at version" << configVersion
<< "instead of the current" << MIXXX_VERSION;
}