Formatting

This commit is contained in:
Jonas Kvinge
2021-08-23 21:21:08 +02:00
parent ed7794f396
commit ea2bfbda44
111 changed files with 833 additions and 425 deletions

View File

@@ -288,10 +288,12 @@ void AppearanceSettingsPage::Save() {
}
s.setValue(kBackgroundImageType, background_image_type_);
if (background_image_type_ == BackgroundImageType_Custom)
if (background_image_type_ == BackgroundImageType_Custom) {
s.setValue(kBackgroundImageFilename, background_image_filename_);
else
}
else {
s.remove(kBackgroundImageFilename);
}
BackgroundImagePosition backgroundimageposition = BackgroundImagePosition(ui_->combobox_backgroundimageposition->itemData(ui_->combobox_backgroundimageposition->currentIndex()).toInt());
s.setValue(kBackgroundImageMaxSize, ui_->spinbox_background_image_maxsize->value());

View File

@@ -211,7 +211,9 @@ void BackendSettingsPage::Load() {
enginetype = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex()).value<Engine::EngineType>();
QString output_name;
if (ui_->combobox_output->currentText().isEmpty()) output_name = engine()->DefaultOutput();
if (ui_->combobox_output->currentText().isEmpty()) {
output_name = engine()->DefaultOutput();
}
else {
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
output_name = output.name;
@@ -439,7 +441,9 @@ void BackendSettingsPage::Save() {
QString output_name;
QVariant device_value;
if (ui_->combobox_output->currentText().isEmpty()) output_name = engine()->DefaultOutput();
if (ui_->combobox_output->currentText().isEmpty()) {
output_name = engine()->DefaultOutput();
}
else {
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
output_name = output.name;

View File

@@ -205,10 +205,12 @@ void BehaviourSettingsPage::Load() {
#endif
QString name = language_map_.key(s.value("language").toString());
if (name.isEmpty())
if (name.isEmpty()) {
ui_->combobox_language->setCurrentIndex(0);
else
}
else {
ui_->combobox_language->setCurrentIndex(ui_->combobox_language->findText(name));
}
ui_->combobox_menuplaymode->setCurrentIndex(ui_->combobox_menuplaymode->findData(s.value("menu_playmode", PlayBehaviour_Never).toInt()));

View File

@@ -138,7 +138,7 @@ void ContextSettingsPage::Load() {
ui_->context_custom_text1->setText(s.value(kSettingsTitleFmt, "%title% - %artist%").toString());
ui_->context_custom_text2->setText(s.value(kSettingsSummaryFmt, "%album%").toString());
for (int i = 0 ; i < ContextSettingsOrder::NELEMS ; ++i) {
for (int i = 0; i < ContextSettingsOrder::NELEMS; ++i) {
checkboxes_[i]->setChecked(s.value(kSettingsGroupEnable[i], checkboxes_[i]->isChecked()).toBool());
}

View File

@@ -97,7 +97,7 @@ void CoversSettingsPage::Load() {
void CoversSettingsPage::Save() {
QStringList providers;
for (int i = 0 ; i < ui_->providers->count() ; ++i) {
for (int i = 0; i < ui_->providers->count(); ++i) {
const QListWidgetItem *item = ui_->providers->item(i);
if (item->checkState() == Qt::Checked) providers << item->text(); // clazy:exclude=reserve-candidates
}

View File

@@ -297,12 +297,15 @@ void GlobalShortcutsSettingsPage::ItemClicked(QTreeWidgetItem *item) {
ui_->shortcut_options->setEnabled(true);
ui_->shortcut_options->setTitle(tr("Shortcut for %1").arg(shortcut.s.action->text()));
if (shortcut.key == shortcut.s.default_key)
if (shortcut.key == shortcut.s.default_key) {
ui_->radio_default->setChecked(true);
else if (shortcut.key.isEmpty())
}
else if (shortcut.key.isEmpty()) {
ui_->radio_none->setChecked(true);
else
}
else {
ui_->radio_custom->setChecked(true);
}
}

View File

@@ -97,7 +97,7 @@ void LyricsSettingsPage::Load() {
void LyricsSettingsPage::Save() {
QStringList providers;
for (int i = 0 ; i < ui_->providers->count() ; ++i) {
for (int i = 0; i < ui_->providers->count(); ++i) {
const QListWidgetItem *item = ui_->providers->item(i);
if (item->checkState() == Qt::Checked) providers << item->text(); // clazy:exclude=reserve-candidates
}

View File

@@ -111,8 +111,9 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog *dialog, QWi
QObject::connect(ui_->notifications_exp_chooser2, &QToolButton::triggered, this, &NotificationsSettingsPage::InsertVariableSecondLine);
QObject::connect(ui_->notifications_disable_duration, &QCheckBox::toggled, ui_->notifications_duration, &NotificationsSettingsPage::setDisabled);
if (!dialog->osd()->SupportsNativeNotifications())
if (!dialog->osd()->SupportsNativeNotifications()) {
ui_->notifications_native->setEnabled(false);
}
if (!dialog->osd()->SupportsTrayPopups()) ui_->notifications_tray->setEnabled(false);
QObject::connect(ui_->notifications_pretty, &QRadioButton::toggled, this, &NotificationsSettingsPage::UpdatePopupVisible);
@@ -191,12 +192,15 @@ void NotificationsSettingsPage::Load() {
ui_->notifications_opacity->setValue(static_cast<int>(pretty_popup_->background_opacity() * 100));
QRgb color = pretty_popup_->background_color();
if (color == OSDPretty::kPresetBlue)
if (color == OSDPretty::kPresetBlue) {
ui_->notifications_bg_preset->setCurrentIndex(0);
else if (color == OSDPretty::kPresetRed)
}
else if (color == OSDPretty::kPresetRed) {
ui_->notifications_bg_preset->setCurrentIndex(1);
else
}
else {
ui_->notifications_bg_preset->setCurrentIndex(2);
}
ui_->notifications_bg_preset->setItemData(2, QColor(color), Qt::DecorationRole);
ui_->notifications_disable_duration->setChecked(pretty_popup_->disable_duration());
@@ -285,8 +289,7 @@ void NotificationsSettingsPage::PrettyColorPresetChanged(int index) {
void NotificationsSettingsPage::ChooseBgColor() {
QColor color = QColorDialog::getColor(pretty_popup_->background_color(), this);
if (!color.isValid())
return;
if (!color.isValid()) return;
pretty_popup_->set_background_color(color.rgb());
ui_->notifications_bg_preset->setItemData(2, color, Qt::DecorationRole);
@@ -298,8 +301,7 @@ void NotificationsSettingsPage::ChooseBgColor() {
void NotificationsSettingsPage::ChooseFgColor() {
QColor color = QColorDialog::getColor(pretty_popup_->foreground_color(), this);
if (!color.isValid())
return;
if (!color.isValid()) return;
pretty_popup_->set_foreground_color(color.rgb());

View File

@@ -154,18 +154,24 @@ bool QobuzSettingsPage::eventFilter(QObject *object, QEvent *event) {
}
void QobuzSettingsPage::LogoutClicked() {
service_->Logout();
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
ui_->button_login->setEnabled(true);
}
void QobuzSettingsPage::LoginSuccess() {
if (!this->isVisible()) return;
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
ui_->button_login->setEnabled(true);
}
void QobuzSettingsPage::LoginFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
QMessageBox::warning(this, tr("Authentication failed"), failure_reason);
}

View File

@@ -198,19 +198,25 @@ void TidalSettingsPage::OAuthClicked(const bool enabled) {
}
void TidalSettingsPage::LogoutClicked() {
service_->Logout();
ui_->button_login->setEnabled(true);
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedOut);
}
void TidalSettingsPage::LoginSuccess() {
if (!this->isVisible()) return;
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
ui_->button_login->setEnabled(true);
}
void TidalSettingsPage::LoginFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
QMessageBox::warning(this, tr("Authentication failed"), failure_reason);
ui_->button_login->setEnabled(true);
}