From be6f93735d63c4d6468ff5bd409df3b380c24002 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 6 Jun 2023 23:19:45 +0200 Subject: [PATCH] Simplify if statements --- src/collection/collectionview.cpp | 4 ++-- src/internet/internetcollectionview.cpp | 4 ++-- src/settings/backendsettingspage.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index 06a9de8ad..47fe4148d 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -117,7 +117,7 @@ void CollectionView::SaveFocus() { QModelIndex current = currentIndex(); QVariant type = model()->data(current, CollectionModel::Role_Type); - if (!type.isValid() || !(type.toInt() == CollectionItem::Type_Song || type.toInt() == CollectionItem::Type_Container || type.toInt() == CollectionItem::Type_Divider)) { + if (!type.isValid() || (type.toInt() != CollectionItem::Type_Song && type.toInt() != CollectionItem::Type_Container && type.toInt() != CollectionItem::Type_Divider)) { return; } @@ -154,7 +154,7 @@ void CollectionView::SaveContainerPath(const QModelIndex &child) { QModelIndex current = model()->parent(child); QVariant type = model()->data(current, CollectionModel::Role_Type); - if (!type.isValid() || !(type.toInt() == CollectionItem::Type_Container || type.toInt() == CollectionItem::Type_Divider)) { + if (!type.isValid() || (type.toInt() != CollectionItem::Type_Container && type.toInt() != CollectionItem::Type_Divider)) { return; } diff --git a/src/internet/internetcollectionview.cpp b/src/internet/internetcollectionview.cpp index 6eba9a442..37ab9d8e4 100644 --- a/src/internet/internetcollectionview.cpp +++ b/src/internet/internetcollectionview.cpp @@ -109,7 +109,7 @@ void InternetCollectionView::SaveFocus() { QModelIndex current = currentIndex(); QVariant type = model()->data(current, CollectionModel::Role_Type); - if (!type.isValid() || !(type.toInt() == CollectionItem::Type_Song || type.toInt() == CollectionItem::Type_Container || type.toInt() == CollectionItem::Type_Divider)) { + if (!type.isValid() || (type.toInt() != CollectionItem::Type_Song && type.toInt() != CollectionItem::Type_Container && type.toInt() != CollectionItem::Type_Divider)) { return; } @@ -146,7 +146,7 @@ void InternetCollectionView::SaveContainerPath(const QModelIndex &child) { QModelIndex current = model()->parent(child); QVariant type = model()->data(current, CollectionModel::Role_Type); - if (!type.isValid() || !(type.toInt() == CollectionItem::Type_Container || type.toInt() == CollectionItem::Type_Divider)) { + if (!type.isValid() || (type.toInt() != CollectionItem::Type_Container && type.toInt() != CollectionItem::Type_Divider)) { return; } diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index 3d7382c02..aa8880c3d 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -792,7 +792,7 @@ void BackendSettingsPage::FadingOptionsChanged() { EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value(); if (engine()->type() == EngineBase::Type::GStreamer && - !(engine()->ALSADeviceSupport(output.name) && !ui_->lineedit_device->text().isEmpty() && (ui_->lineedit_device->text().contains(QRegularExpression("^hw:.*")) || ui_->lineedit_device->text().contains(QRegularExpression("^plughw:.*"))))) { + (!engine()->ALSADeviceSupport(output.name) || ui_->lineedit_device->text().isEmpty() || (!ui_->lineedit_device->text().contains(QRegularExpression("^hw:.*")) && !ui_->lineedit_device->text().contains(QRegularExpression("^plughw:.*"))))) { ui_->groupbox_fading->setEnabled(true); } else {